Lib-jitsi-meet Sometimes joining muted and can't unmute

About 50% of the time that I join a test meeting from my electron client built with lib-jitsi-meet on Debian 11 my device joins ‘muted’.

I can leave the meeting and re-join with a 50% chance of my microphone immediately working. I don’t know how to unmute myself. localTracks[0].unmute() doesn’t unmute me.

localTracks[0] is my microphone.

The deviceId for localTracks[0] is the same whether it is working or not.

Upon joining:

  • localTracks[0] enabled = true (I would expect this to be false since I’m muted)
  • localTracks[0] muted = false
  • localTracks[0].isMuted() returns false

I’m not sure if it’s related or not but on a separate computer in the meeting I get this message in console and it seems like whenever the stream[id] ends in a ‘audio-1’ then the audio feed comes through properly and when it ends in ‘audio-2’ then I have the issue:

[modules/RTC/TraceablePeerConnection.js] <ha._remoteTrackRemoved>:  TPC[id=11,type=JVB] Removed track not found for stream[id=091ed4bb-audio-2,trackId=5c8dd2b6-4c4a-41ba-9da2-c5d539b573ab-2]

I am trying to build a kiosk application that always uses the same camera, mic, and speakers for every call.

Here is my code:

function onLocalTracks(tracks) {
    localTracks = tracks;
    console.log('localTracks: ' + localTracks)
    for (let i = 0; i < localTracks.length; i++) {
        localTracks[i].addEventListener(
            JitsiMeetJS.events.track.TRACK_AUDIO_LEVEL_CHANGED,
            audioLevel => console.log(`Audio Level local: ${audioLevel}`));
        localTracks[i].addEventListener(
            JitsiMeetJS.events.track.TRACK_MUTE_CHANGED,
            () => console.log('local track muted'));
        localTracks[i].addEventListener(
            JitsiMeetJS.events.track.LOCAL_TRACK_STOPPED,
            () => console.log('local track stopped'));
        localTracks[i].addEventListener(
            JitsiMeetJS.events.track.TRACK_AUDIO_OUTPUT_CHANGED,
            deviceId =>
                console.log(
                    `track audio output device was changed to ${deviceId}`));
        $('body').append(
            `<audio autoplay='1' muted='false' id='localAudio${i}' />`);
        localTracks[i].attach($(`#localAudio${i}`)[0]);
        localTracks[i].unmute()
    }
};

Any tips?

Are you creating the track and adding it to the JitsiConference before calling join() ?

Thanks Saúl,
No, the track is added after joining the conference. Should it be added before the join()?

Yes, we’ve seen a number of bugs if you don’t, due to changes in browser implementations. Please give it a try.

Still not working. When I add the track before joining the conference Jitsi shows that I have joined muted and I cannot figure out how to unmute.

I disabled P2P in /etc/jitsi/meet/config.js and haven’t had the issue since.

It seems like the issue arises when my custom client is responsible for starting P2P.

Have you tried latest versions of lib-jitsi-meet there were few bugs around p2p and muted tracks that were fixed.

Right now I’m sourcing lib-jitsi-meet from meet.jit.si:

  <script src="https://meet.jit.si/libs/lib-jitsi-meet.min.js"></script>

Is there anything else I need to do to pull a later version?

Nope, that is almost the latest and is ok.

Yeah, it will be interesting to see logs from a problem session.

I am testing with client A and client B.
Client A = standard Jitsi Meet web client
Client B = custom client built with lib-jitsi-meet

The following line appears in Client A’s console when the audio doesn’t work:

2022-04-29T22:31:32.595Z [JitsiConference.js] <jc._maybeStartOrStopP2P>:  I'm the bigger peersId - the other peer should start P2P dc945e67 a4613ba5

It seems as though there is an issue establishing audio in P2P when Client B is responsible for starting P2P. The video works properly, though. The issue goes away if I disable P2P.

What logs should I be looking at to troubleshoot?