twilio / twilio-video.js

Twilio’s Programmable Video JavaScript SDK
https://www.twilio.com/docs/video/javascript
Other
571 stars 217 forks source link

Mobile Safari 13.0.5 not sending Audio #938

Closed rkiller closed 4 years ago

rkiller commented 4 years ago

I am not sure whether this is related to all the other audio bugs but we have this library in production and our clients fail nearly 100% of the time when one of client is using it from an iPhone with Mobile Safari 13.0.5.

All other clients work as expected so I am assuming this is an issue with Twilio-video.js and/or webrtc implementation on iPhone.

Posting this here in case others are searching for resolution on this bug. Tried all workarounds to no avail. This is an extremely critical issue at this time as you can imagine (COVID19 related spike in utilization). Hopefully Twilio can resolve this ASAP.

Code to reproduce the issue:

// TODO

Expected behavior:

TODO

Actual behavior:

TODO

Software versions:

manjeshbhargav commented 4 years ago

Hi @rkiller ,

What you are seeing is most likely due to another tab or app which has reserved your microphone. We are recommending all developers that they should include a pre-connect mic check with an audio level indicator so the user can know that his/her mic is reserved by your web app. If the indicator does not move, then you should recommend the user to close all other apps and restart Safari.

Here is a guide on how to visualize audio samples from your microphone.

Thanks,

Manjesh Malavalli JSDK Team

rkiller commented 4 years ago

I don't think that is it. It is happening to too many cases for this to be the case and it seems like it's only happening on 13.0.5 ...

rkiller commented 4 years ago

Also, if one were to implement a visualizer, how would you get a MediaStream from LocalAudioTrack in order to make this work:

source = audioCtx.createMediaStreamSource(stream);

manjeshbhargav commented 4 years ago

@rkiller ,

The LocalAudioTrack has a mediaStreamTrack property which you can use to create a MediaStream as follows:

const mediaStream = new MediaStream([localAudioTrack.mediaStreamTrack]);
source = audioCtx.createMediaStreamSource(mediaStream);

In all our tests, this is the most likely reason why there are no audio bytes sent by the iOS Safari Participant, so I'm pretty confident that this is indeed the case. We have observed that even playing YouTube after joining a Room will cause this to happen. So, it would be great if you can try it out and let us know.

Thanks,

Manjesh Malavalli JSDK Team

rkiller commented 4 years ago

Thank you @manjeshbhargav . We've implemented the audio check. Let's see what happens.

anna-vasilko commented 4 years ago

@rkiller Just for your visibility here is a Safari ticket tracking this issue, they seemed to have fixed this very recently https://bugs.webkit.org/show_bug.cgi?id=208516

rkiller commented 4 years ago

Thank you Anna. This is exactly what we are experiencing. In production it seems about 50% of clients on iPhones will face this issue.