CloudHub Docs
Download Documents

RTC


CloudHub JSSDK

Stream Event

event: camera-access-allowed

Note: This callback notifies the App that the permission to use the local camera has been obtained.

Example:

stream.on("camera-access-allowed", function(){
    console.log(camera-access-allowed);
});

event: microphone-access-allowed

Note: This callback notifies the App that the local microphone has been used.

Example:

stream.on("microphone-access-allowed", function(){
    console.log(microphone-access-allowed);
});

event: camera-access-denied

Note: This callback notifies the App that the local camera usage permission has been prohibited.

Example:

stream.on("camera-access-denied", function(){
    console.log(camera-access-denied);
});

event: microphone-access-denied

Note: This callback notifies the App that the local microphone permission has been prohibited.

Example:

stream.on("microphone-access-denied", function(){
    console.log(microphone-access-denied);
});

event: stop-screen-sharing

Note: This callback notifies the app that screen sharing has stopped.

Example:

stream.on("stop-screen-sharing", function(){
    console.log(stop-screen-sharing);
});

event: video-track-ended

Note: The callback notifies the video track that it has stopped.

The reason for the stop may be to pull out, cancel the authorization. See MediaStreamTrack.onended

Example:

stream.on("video-track-ended", function(){
    console.log(video-track-ended);
});

event: audio-track-ended

Note: The callback notification audio track has stopped.

The reason for the stop may be to pull out, cancel the authorization. See MediaStreamTrack.onended

Example:

stream.on("audio-track-ended", function(){
    console.log(audio-track-ended);
});

event: video-track-mute

Note: This callback notification video track cannot send data.

See MediaStreamTrack.onmute

Note: After testing, some machines / cameras open multiple web pages to enter the channel on the same machine, which will cause the local camera to jam, this event will be triggered, and SDK will automatically re-acquire the camera device. [note: SDK will not automatically reacquire the device for streams created with self-collection attributes (audioSource and videoSource)]

Example:

stream.on("video-track-mute", function(){
    console.log(video-track-mute);
});

event: audio-track-mute

Note: This callback notification audio track cannot transmit data.

See MediaStreamTrack.onmute

Example:

stream.on("audio-track-mute", function(){
    console.log(audio-track-mute);
});

event: video-track-unmute

Note: This callback notification video track can once again send data.

See MediaStreamTrack.onunmute

Example:

stream.on("video-track-unmute", function(){
    console.log(video-track-unmute);
});

event: audio-track-unmute

Note: This callback notification audio track can once again send data.

See MediaStreamTrack.onunmute

Example:

stream.on("audio-track-unmute", function(){
    console.log(audio-track-unmute);
});

event: videoplayer-status-change

Note: This callback notifies the video playback state change.

On Windows, frequent DOM operations may cause the Chrome player to be suspended by the browser. To avoid this, you need to listen for the callback and try to call Stream.resumeVideo to resume playback.

The callback has the following properties.

Note: How to access the event details of status,如:stalled event address

Example:

stream.on("videoplayer-status-change", function(evt){
        if (evt.isErrorState && evt.status === "paused"){
            console.error(`Stream video is paused unexpectedly. Trying to resumeVideo...`);
            stream.resumeVideo().then(function(){
                console.log(`Stream video is resumed successfully`);
            }).catch(function(e){
                console.error(`Failed to resumeVideo stream. Error ${e.name} Reason ${e.message}`);
            });
        }
    });

event: audioplayer-status-change

Note: The callback notifies the audio playback of a change in playback status.

On Windows, frequent DOM operations may cause the Chrome player to be suspended by the browser. To avoid this, you need to listen for the callback and try to call Stream.resumeAudio to resume playback.

The callback has the following properties.

Note: How to access the event details of status,如:stalled event address

Example:

stream.on("audioplayer-status-change", function(evt){
    if (evt.isErrorState && evt.status === "paused"){
        console.error(`Stream audio is paused unexpectedly. Trying to resumeAudio...`);
        stream.resumeAudio().then(function(){
            console.log(`Stream audio is resumed successfully`);
        }).catch(function(e){
            console.error(`Failed to resumeAudio stream. Error ${e.name} Reason ${e.message}`);
        });
    }
});

event: stream-video-device-state-change

Note: The callback notifies the camera that the status of the device has changed.

Callback parameter evt structure:

{
    isNormalDevice: false,
    failinfo:failinfo,
    deviceId:deviceId
}

Note: When isNormalDevice is false, failinfo, the data format is {errflag: “NOT_ALLOWED_ERROR”, message: “Permission denied”}。

errflag The following values may appear in the field:

Example:

client.on("stream-video-device-state-change", function(evt){
    console.log(evt);
});

event: stream-audio-device-state-change

Note: This callback notification microphone device changes.

Callback parameter evt structure:

{
    isNormalDevice: false,
    failinfo:failinfo,
    deviceId:deviceId
}

Note: When isNormalDevice is false, failinfo, the data format is {errflag: “NOT_ALLOWED_ERROR”, message: “Permission denied”}。

errflag The following values may appear in the field:

Example:

client.on("stream-audio-device-state-change", function(evt){
    console.log(evt);
});