Start stream playback with muted audio¶
Sometimes, it is necessary to start stream playback with muted audio. To do this:
-
In WebSDK builds before 2.0.210 call the
Stream.muteRemoteAudio()
function by receivingSTREAM_STATUS.PLAYING
event:or setsession.createStream({ name: streamName, display: remoteVideo }).on(STREAM_STATUS.PENDING, function (stream) { ... }).on(STREAM_STATUS.PLAYING, function (stream) { stream.muteRemoteAudio(); ... }).on(STREAM_STATUS.STOPPED, function () { ... }).play();
muted
of video tag on the page byplaying
eventsession.createStream({ name: streamName, display: remoteVideo }).on(STREAM_STATUS.PENDING, function (stream) { var video = document.getElementById(stream.id()); if (!video.hasListeners) { video.hasListeners = true; video.addEventListener('playing', function (event) { video.muted = true; }); } }).on(STREAM_STATUS.PLAYING, function (stream) { ... }).on(STREAM_STATUS.STOPPED, function () { ... }).play();
-
In WebSDK builds since 2.0.210 and newer set the stream option
unmutePlayOnStart
tofalse
Later, stream audio can be unmuted by some user action by calling the function