Sometimes, it is necessary to start stream playback with muted audio. To do this:
1. In WebSDK builds before 2.0.210 call the Stream.muteRemoteAudio() function by receiving STREAM_STATUS.PLAYING event:
session.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();
or set muted of video tag on the page by playing event
session.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();
2. In WebSDK builds since 2.0.210 and newer set the stream option unmutePlayOnStart to false
session.createStream({
name: streamName,
display: remoteVideo,
unmutePlayOnStart: false
}).on(STREAM_STATUS.PENDING, function (stream) {
...
}).on(STREAM_STATUS.PLAYING, function (stream) {
...
}).on(STREAM_STATUS.STOPPED, function () {
...
}).play();
Later, stream audio can be unmuted by some user action by calling the function
stream.unmuteRemoteAudio();