Redirect Chromium/Jibri to record/live stream a different url?

I am try to get Chromium/Jibri to show a different screen than the default one. I have tried two methods: base_url and nginx_redirect.

Attemplt 1: Base Url

In /etc/jitsi/jibri/jibri.conf I can change the base url as such:

xmpp {
      // See example_xmpp_envs.conf for an example of what is expected here
       environments = [
                name = "prod environment"
                xmpp-server-hosts = [""]
                xmpp-domain = ""
                base-url = ""

                control-muc {
                    domain = ""
                    room-name = "JibriBrewery"
                    nickname = "jibri-replicant-3"

                control-login {
                    domain = ""
                    username = "jibri"
                    password = "jibriauthpass"

                call-login {
                    domain = ""
                    username = "recorder"
                    password = "jibrirecorderpass"

                strip-from-room-domain = "conference."
                usage-timeout = 0
                trust-all-xmpp-certs = true

The problem with this is the jid and the focus authentication fails when I change the base url.

Attempt 2: Nginx Redirect & Chromiun

The second method is using an nginx redirect when the user agent is Jibri. I start by in /etc/jitsi/jibri/jibri.conf, changing my chromiun flags to add a Jibri user agent.

chrome {
    // The flags which will be passed to chromium when launching
    flags = [
      "--user-agent='Jibri Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.96 Safari/537.36'"

Following by in my nginx I have a redirect as such:

server {
    listen 443 ssl;
    listen [::]:443 ssl;
   if ($http_user_agent !~ "Jibri") {
        rewrite ^/$ redirect;

And it seems to completely ignore the user agent. Any ideas of what I am doing wrong or is there a different way to change the screen that jibri will record/livestream?

It should be full url with scheme.

Can you join the meeting when opening in your browser?
If not, it doesn’t work.

This is a great question, what is the process of “joining”? Is jibri expecting some sort of response? Does it “hook” into something? Is there a place where I can read about how Jibri joins a video call?

jibri joins the meeting using a headless chrome. It opens “base-url/room-name#some-config-params” as link.

There is no difference to open the same link in our browser.

So basically, as long as my app with the url returns a webpage with the status code of 200, Jibri/Chrome will display its content, even if its not a video?

Nope. It must join the meeting using this link.

Ok and that is the process I am trying to understand. What is “joining” the meeting. base-url/room-name#some-config-params, but some response has to be sent to Jibri for the join to happen. What is that response?

What are you trying to accomplish? Jibri relies on injecting JS on the running page, and it assumes that to be Jitsi Meet. If you change that Jibri won’t work.

I have built a custom layout, and I want Jibri/Chrome to show that custom layout. What code is Jibri injecting and how does Jibri know if it was successful? If I knew how Jibri was determining a successful connection to a page, I could get the recording working on any page.

Check here: jibri/CallPage.kt at 4a4378cb0e2c025d7ff3c12ae9561045df961d40 · jitsi/jibri · GitHub

Thanks! So interesting approach with:

 try {
                WebDriverWait(driver, 30).until {
                    val result = driver.executeScript(
                        try {
                            return APP.conference._room.isJoined();
                        } catch (e) {
                            return e.message;
                    when (result) {
                        is Boolean -> result
                        else -> {
                            logger.debug { "Not joined yet: $result" }
            } catch (t: TimeoutException) {
                logger.error("Timed out waiting for call page to load")

I wasn’t aware that code in a browser could be called like that from an external source, I would this that would be a security issue…

How would that be a security issue? It’s equivalent to you typing in the JS console of your browser.