Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejs
themeRDark
    session.createStream({
        name: streamName,
        display: remoteVideo,
        ...
    }).on(STREAM_EVENT, function(streamEvent) {
        let mutedName="";
        if(streamEvent.payload !== undefined) {
            mutedName=streamEvent.payload.streamName;
        }
        switch (streamEvent.type) {
            case STREAM_EVENT_TYPE.AUDIO_MUTED:
                $("#audioMuted").text(true + " " + mutedName);
                break;
            case STREAM_EVENT_TYPE.AUDIO_UNMUTED:
                $("#audioMuted").text(false + " " + mutedName);
                break;
            case STREAM_EVENT_TYPE.VIDEO_MUTED:
                $("#videoMuted").text(true + " " + mutedName);
                break;
            case STREAM_EVENT_TYPE.VIDEO_UNMUTED:
                $("#videoMuted").text(false + " " + mutedName);
                break;

        }
        console.log("Received streamEvent ", streamEvent.type);
    }).play();

Stream status detection while subscriber is connecting to a stream

A new subscriber can detect if audio/video track is muted in the stream while connecting to the stream using Stream.getAudioState() and Stream.getVideoState() methiods in STREAM_STATUS.PLAYING handler:

Code Block
languagejs
themeRDark
    session.createStream({
        name: streamName,
        display: remoteVideo,
        ...
    }).on(STREAM_STATUS.PLAYING, function (stream) {
        if (stream.getAudioState()) {
            $("#audioMuted").text(stream.getAudioState().muted);
        }
        if (stream.getVideoState()) {
            $("#videoMuted").text(stream.getVideoState().muted);
        }
        ...
   }).play;

Mixer incoming streams status detection while connecting to a mixer outgoing stream

Since WCS build 5.2.1011, when a new subscriber connects to a mixer outgoing stream, it will receive a set of STREAM_EVENT events per every mixer incoming stream, if audio or video track was muted at lease once in any of them. In this case, STREAM_EVENT receiving order is not guaranteed and does not depend on streams addition order to the mixer.

Stream event processing on backend

...