Audio not played in Safari?

Options

Hi,

We recently had a call with around 15 participants.

We noticed that people using iPad and safari couldn't hear the room owner's audio (owner was in the room before the participants). However, the participants could see the video of the room owner. Moreover, they could play audio from other participants when they subscribed and played the track of specific participants.

To give you a bit of background, we use daily-js custom callObject and we set manual subscription to 'off.' We didn't see a similar problem for participants who used chrome or microsoft edge.

Is there any known issue with playing audio with safari?

Best,

Tomo

Answers

  • christian
    christian Dailynista
    Options

    Hey @TomohiroMaeda,

    Safari is definitely the most challenging browser, when it comes to playing audio, because of its very strict autoplay policies. Anytime an <audio> element is set up or gets a new srcObject assigned, the tab has to be in focus for the end user, or playing the audio must be done as part of a user gesture.

    Playing audio in Safari can fail for a variety of reasons, so it's definitely advised to catch any errors related to play() on audio elements, and reacting accordingly, e.g. by providing a button the user can click to resume audio playback.

    Daily React has a reference implementation for setting up an <audio> element in React with the DailyAudioTrack component, but the code can be adapted to other frameworks or vanillajs, too.

    In general:

    • when the video call tab in Safari is backgrounded, and a new <audio> tag is setup and attempted to play, it won't
    • when an attempt to play audio fails, render something that asks the user to click a button, then play all audio from that click event listener

    Hope this helps understand the issue a little better and sets you up to craft a solution!

    Christian

  • TomohiroMaeda
    Options

    @christian

    Thank you so much! It helped alot!