jonfelixrico / webrtc-poc

0 stars 0 forks source link

Audio does not play sometimes #33

Open jonfelixrico opened 3 hours ago

jonfelixrico commented 3 hours ago

This happens if the user has entered the call but hasn't interacted with the DOM yet (e.g. clicking buttons, clicking on random elements, etc). This has something to do with Chrome preventing popups/ads from playing audio if they got sneakily opened in the background by scripts

Rep steps
Have two users, user A and user B

  1. Connect user A to a call and open mic and video (latter might be optional)
  2. Connect user B to the same room and make the person behind user A speak

Expected: User A is heard by user B Actual: User A is not heard by user B

Workaround for rep steps above:

  1. Make user B interact with the UI
    • E.g. interacting with the buttons, opening up audio/video, etc -- anything that deals with interacting with the DOM
  2. Make user A turn off voice, then turn it on again, then speak

Expected & actual: User A is heard by user B

jonfelixrico commented 3 hours ago

Solution will be to implement a pre-join screen similar to the mainstream calling apps (e.g. Google Meet, Zoom, MS Teams). This forces the user to click on a control to confirm their join. Because the user has interacted with the DOM, whatever audio will play once they actually join the room.

It should be noted that we could implement a simpler solution that involves user interaction, but we might as well implement the above to improve the UX.