Audiocontext was not allowed to start in lib-jitsi-meet

1.4k views Asked by At

I'm developing a video chat application using lib-jitsi-meet. It's all working fine in Firefox, but when it comes to Chrome, it throws the following error in the console.

lib-jitsi-meet.min.js:1 The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page.

The participant can't use the microphone in the Chrome browser because of this error. I know this is related to the changes in Chrome autoplay policies. I could've done something if I'm using the pure web audio API, however, I couldn't understand what should I do to avoid this in lib-jitsi-meet.

I searched for this error in Jitsi community forums and many other places but didn't find any helpful answer to circumvent this.

How can I overcome this issue so that video chat participants from the Chrome browser can use their microphones and hear what others are saying? Thank you for all the helpful suggestions.

1

There are 1 answers

0
Pavindu On BEST ANSWER

This problem occurs with Jitsi Meet NPM package. Upon importing it to my React app as

import JitsiMeetJS from 'lib-jitsi-meet-dist'

it automatically creates a new AudioContext object. Since that is not allowed in Chrome due to its autoplay policies, I cannot either access the microphone or listen to other participants. I could've resumed the created AudioContext and go on, but there was no way to do that in the library.

As a solution, I added the Jitsi Meet library as a script in the index.html of my React app and used the JitsiMeetJS object in the app as window.JitsiMeetJS.

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

With that approach, there was still an AudioContext object initialized, but it's related to something called collecting local stats, not Jitsi Meet core functionality. Therefore, I could ignore it and move on.