Audio not joining in Safari

Hey @tommy @vic.yang ,
Facing audio issues in Safari even after following Audio related doc for Safari.

After an user interaction we are calling stream.startAudio method and after few seconds we get: A MediaStreamTrack ended due to a capture failure error in browser console and audio doesn’t get joined or even If it does gets join audio is not clear at all for remote user.

Browser Console Error
A MediaStreamTrack ended due to a capture failure

Which Web Video SDK version?
1.2.7

Device (please complete the following information):

  • Device: Macbook Pro
  • OS: macOS 11.6.1
  • Browser: Safari (15.2 (16612.3.6.1.8, 16612))

Additional context

  • First user who joins the session becomes the host.
  • I’m joining from the same machine for both local and remote users.
  • Execution Flow for Safari: Ask for AV permission → after permission is provided → client.join() → When audio encode = true & decode = true → user prompted to click join audio button → stream.startAudio → after few seconds the error gets thrown

Hey @shoaib ,

Do you have the event listener setup to detect when Audio has been initialized in Desktop Safari?

Can you share your implementation vs. what we suggest here:

Thanks,
Tommy

Yes @tommy, we are using same implementation with media-sdk-change callback to set status of audio encode & decode flags and on user click we are calling stream.startAudio() only when both encode and decode are true.

Also, I’ve checked Sample Video SDK, same issue is there as well in Safari browser. Its also throwing A MediaStreamTrack ended due to a capture failure error and audio is not getting joined.

Hey @shoaib ,

I want to provide a suggestion with your flow. Can you try calling client.join() first, and then → When audio encode = true & decode = true → user prompted to click join audio button → stream.startAudio.

Please let me know if that flow resolves the issue. That flow works for me.

Thanks,
Tommy

Hey @tommy , I tried that (calling client.join first without asking for AV permission) flow as well, its also giving the same error.
Have you checked React Video SDK Demo, is it working for you? as that is also not working for me in Safari.

Also, I’m assuming you are testing audio by connecting a remote user as well from any other browser as client.getCurrentUser.audio property returns “computer” only irrespective of the issue.

Also, I’ve observed that many times audio do gets joined but audio is not clear at all for remote user.

Hey @shoaib

Does the Safari on your machine pop up an “Allow to use your microphone?” dialog after calling the startAudio method? Does this issue occur on Safari 15.2? The latest version of Safari is 15.5.

Thanks
Vic

Hey @vic.yang ,
Yes, “Allow to use your microphone?” dialog comes after calling the startAudio method.

I also tried by getting AV permission before calling startAudio, but that flow was also giving same issue.

Does this issue occur on Safari 15.2?
Yes

You can check React Video SDK Demo once as well as audio is not working in that also for Safari.

Hey @tommy / @vic.yang,

Just a quick FYI, this is happening to me too on Safari 15.4.

I’ve also implemented something such that if the audio fails, I trigger a retry by the user clicking ‘retry’ to start the audio. mediaStream.startAudio().catch(() => // show audio retry modal code).

Interestingly, this all works perfectly on iOS Safari for me.

Cheers,

Nick

Hey @nickuk / @shoaib

Thanks for your feedback.

A small suggestion, try not to do async operations in the start audio event handler(such as the join audio button click handler), which may lead to audio does not work properly on Safari.

Thanks
Vic

Hey @vic.yang , Can you please make the necessary changes in React Video SDK Demo for our reference, If possible.

Hey @shoaib , @nickuk ,

We are investigating this issue further. Please stay tuned here for updates.

Thanks,
Tommy

1 Like

Hey @shoaib , @nickuk ,

Can you try restarting your computer? I was experiencing the same issue and error in the browser console, but after restarting my machine and trying again, it works as expected.

Please let me know.

Thanks,
Tommy

Hey @tommy ,
Okay, but can we fix its root cause and make it more stable, because If this issue arises for any of the user, then they won’t know this hack.

Hey @shoaib ,

Yes, we are taking a look to see what we can do from our end. :slight_smile:

Thanks,
Tommy

1 Like

okay, Thanks @tommy!