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
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.
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.
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.
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.
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.
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.
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.
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.