Web Video SDK Version 1.2.5

Hello Zoom Developers, here are the updates for the Web Video SDK version 1.2.5 release :slight_smile:

Added

Support for audio on iOS Safari.
Support for multiple videos (3 others + 1 self) on Chromium browsers without SharedArrayBuffer. Set the value of enforceMultipleVideos to true in the init method to enable this feature.

Fixed

Audio issues on Safari browser.
Unexpected failover when leaving or ending a session on Safari (related to the NSURLSession WebSocket experimental feature).
Issue of improperly clearing all sessionStorage when leaving the session.
An edge case issue with session idle timeouts and command channel.

Desktop Safari limitation

NOTE: The below logic is not required for Mobile iOS Safari. Just call stream.startAudio();

There are two limitations to be aware of when using audio on Desktop Safari:

  • You must call startAudio after the audio encoding or decoding web workers have been initialized.
  • Audio cannot start before users interact with the page. Unlike other browsers, Safari does not inform the SDK when this happens. This makes it impossible to defer incorrectly-timed startAudio calls until after user interaction.

Therefore, logic similar to below must be added to ensure that the web workers have been initialized correctly:

let audioDecode, audioEncode;

client.on("media-sdk-change", (payload) => {
  const { action, type, result } = payload;
  if (type === "audio" && result === "success") {
    // encode for sending audio stream (talk)
    if (action === "encode") {
      audioEncode = true;
    }
    // decode for receiving audio stream (hear)
     else if (action === "decode") {
      audioDecode = true;
    }
  }
});

// click event callback
joinAudioButton.addEventListener("click",event=>{
  var isSafari = window.safari !== undefined

  if(isSafari) {
    // if Desktop Safari Check https://stackoverflow.com/a/42189492/6592510
    if(audioEncode && audioDecode){
       stream.startAudio();
    } else {
       console.log('safari encode and decode has not finished')
    }
  } else {
    stream.startAudio();
  }
})

If calling in a scenario where the user interaction isn’t guaranteed (for example, after joining a meeting and web workers have initialized), a flag can be set to properly check the user interaction status:

let audioDecode, audioEncode;

client.on("media-sdk-change", (payload) => {
  const { action, type, result } = payload;
  if (type === "audio" && result === "success") {
    if (action === "encode") {
      audioEncode = true;
    } else if (action === "decode") {
      audioDecode = true;
    }
    if (audioDecode && audioEncode) {
      try {
        // start audio automatically in Safari
        stream.startAudio({ autoStartAudioInSafari: true });
      } catch (err) {
        console.warn(err);
      }
    }
  }
});

// Here you can catch the event
client.on("auto-play-audio-failed",()=>{
  console.log("Auto join audio failed, click anywhere on the page to automatically join the audio ")
})

You can also see the update listed on our Changelog: https://marketplace.zoom.us/docs/changelog

Thanks,
Tommy

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.