Error in lib-jitsi-meet during initJitsiConference


#1

I’m trying to get a simple client working using the lib-jitsi-meet library.

I’m receiving a TypeError: Cannot read property ‘substr’ of null when calling initJitsiConference.

It’s coming from the second line in lib-jitsi-meet.
var n = i.Strophe.getNodeFromJid(this.connection.jid),
this.authenticatedUser || (n = n.substr(0, 8)),

n is null

connection looks like this.

I create the connection using the following.
// FYI stuffing everything in window. until I get it working

    const initOptions = {
      disableAudioLevels: true,
      desktopSharingChromeDisabled: false,
      desktopSharingChromeSources: ['screen', 'window'],
      desktopSharingChromeMinExtVersion: '0.1',
      desktopSharingFirefoxDisabled: true,
    }

    window.JitsiMeetJS.init(initOptions)
      .then(() => {
        let connection = null
        connection = new window.JitsiMeetJS.JitsiConnection(null, null, options)
        window.connection = connection

        connection.addEventListener(
          window.JitsiMeetJS.events.connection.CONNECTION_ESTABLISHED,
          this.onConnectionSuccess()
        )

        connection.addEventListener(
          window.JitsiMeetJS.events.connection.CONNECTION_FAILED,
          this.onConnectionFailed
        )

        connection.addEventListener(
          window.JitsiMeetJS.events.connection.CONNECTION_DISCONNECTED,
          this.disconnect
        )

        window.JitsiMeetJS.mediaDevices.addEventListener(
          window.JitsiMeetJS.events.mediaDevices.DEVICE_LIST_CHANGED,
          this.onDeviceListChanged
        )

         connection.connect()

        window.JitsiMeetJS.createLocalTracks({ devices: ['audio', 'video'] })
          // .then(onLocalTracks)
          .catch(error => {
            throw error
          })
      })
      .catch(error => console.log(error))

And in the onConnectionSuccess callback.

 onConnectionSuccess() {
    const confOptions = {
      openBridgeChannel: true,
    }

    const connection = window.connection
    let room = null
    room = connection.initJitsiConference('conference', confOptions)
}

#2

FYI, options looks like this. discourse would let me post with mulitple links.

const options = {
      hosts: {
        domain: 'jitsi-dev.synzi.com',
        muc: 'conference.jitsi-dev.synzi.com',
      },
      bosh: '//jitsi-dev.synzi.com/http-bind',

      // clientNode removed so I can post in discourse
    }

#3

It looks like the this.connection.jid is empty.
are you using Prosody as your XMPP server and if yes then is the jitsi-dev.synzi.com domain configured for anonymous authentication ?


#4

Thanks Pawel, I forwarded this on to our backend team that is handling the server part.

I believe we are using Prosody. I had tried the same code hitting the beta.meet.jit.si are received the same result.

It feels like we need to send some authorization but not clear on how that works from the docs.


#5

You have error in your JS.

This will not add the function onConnectionSuccess as event listener, but will execute it. And it will execute it before calling connect and that is the reason you see that error, you try to create a conference without been xmpp connected.
Just change it to be:


#6

Thanks, @damencho. Didn’t even notice that. :slight_smile: Will try and see what happens.