| Event | Description |
|---|---|
| token_request | The token expired, needs to be updated immediately |
| token_will_expire | The token will expire, needs to be updated |
| sdk_auth_result | Return the token authentication results |
| publish_auth_fail | Failure to pass the publishing authentication will cut off the publishing |
| audio_track_end | The audio track ended, often encountered during mid-publishing microphone disconnection |
| video_track_end | The video track ended, often encountered during the mid-publishing camera disconnection |
| remote_stream_add | Detect a remote media stream in the room, which you can subscribe to according to your requirements |
| remote_stream_remove | When a remote media stream stops, the subscription is canceled according to the service requirements |
| remote_stream_update | The remote stream is updating. No need to process it |
| player_state_change | The player status changes |
| stream_reconnect_start | The media stream starts reconnecting |
| stream_reconnect_end | The media stream reconnected |
| first_audio_frame_decode | Subscribe to the first frame of the decoded audio |
| first_video_frame_decode | Subscribe to the first frame of the decoded video |
| active_speaker | The user with the loudest voice in the channel changes |
| audio_level_report | Report volume events regularly every 2 seconds |
| audio_input_changed | The audio input device added or removed |
| video_input_changed | The video input device added or removed |
| audio_output_changed | The audio output device added or removed |
| audio_mixing_played | The audio mixing published |
| audio_mixing_finished | The audio mixing completed |
| network_score | Report the local user's uplink and downlink network quality scores every 2 seconds |
| connected | Server connection succeeded |
| reconnect | Reconnecting to the server |
| exception | Media stream abnormality and recovery |
| push_stream_status | Stream pushing status |
| mute_play | Mute |
| mute_play_resume | Umute |
on(event: "token_request", callback: (event: string, data: { uid: string }) => void);
The token expired and needs to be updated immediately.
| Parameter | Description |
|---|---|
| event | 'token_request' |
| data.uid | User ID |
on(event: "token_will_expire", callback: (event: string, data: { uid: string, token: string }) => void);
The token will expire and needs to be updated.
| Parameter | Description |
|---|---|
| event | 'token_will_expire' |
| data.uid | User ID |
| data.token | Current token |
on(event: "sdk_auth_result", callback: (event: string, data: { uid: string, result: number }) => void);
Return the token authentication results
| Parameter | Description |
|---|---|
| event | 'sdk_auth_result' |
| data.uid | User ID |
| data.result | number type, see details in the table below |
| Return Code | Description |
|---|---|
| 0 | Authentication succeeded |
| 10000 | Internal server error, try again |
| 10001 | Without token |
| 10002 | The token authentication failed (incorrect digital signature), which may be caused by incorrect appSecret |
| 10003 | The appid in the token is inconsistent with the appid when authentication is executed |
| 10004 | The uid in the token is inconsistent with the uid when authentication is executed |
| 10005 | The token expired |
| 10006 | The application does not exist, which is not registered in the management background |
| 10007 | The token will expire |
| 10008 | The user is banned |
on(event: "publish_auth_fail", callback: (event: string, data: { uid: string, result: number }) => void);
Indicate failure to pass the publishing stream authentication.
on(event: "audio_track_end", callback: (event: string, data: { uid: string, roomId: string }) => void);
The audio track ended, often encountered when the microphone disconnects during the publishing.
| Parameter | Description |
|---|---|
| event | 'audio_track_end' |
| data.uid | User ID |
| data.roomId | User's room ID |
on(event: "video_track_end", callback: (event: string, data: { uid: string, roomId: string }) => void);
The video track ended, often encountered when the camera disconnects during the publishing.
| Parameter | Description |
|---|---|
| event | 'video_track_end' |
| data.uid | User ID |
| data.roomId | User's room ID |
on(event: "remote_stream_add", callback: (event: string, remoteStream: RemoteStream) => void);
Detect a remote media stream in the channel; you can then subscribe according to the service requirements.
| Parameter | Description |
|---|---|
| event | 'remote_stream_add' |
| remoteStream | RemoteStream remote stream information |
on(event: "remote_stream_remove", callback: (event: string, remoteStream: RemoteStream) => void);
When a remote media stream stops, the subscription is canceled according to the service requirements.
| Parameter | Description |
|---|---|
| event | 'remote_stream_remove' |
| remoteStream | RemoteStream remote stream information |
on(event: "remote_stream_update", callback: (event: string, remoteStream: RemoteStream) => void);
The remote stream is updating. No need to process it.
| Parameter | Description |
|---|---|
| event | 'remote_stream_update' |
| remoteStream | Remote stream information |
on(event: "player_state_change", callback: (event: string, data: { uid: string, reason: string, state: string }) => void);
The player status changes.
| Parameter | Description |
|---|---|
| event | 'player_state_change' |
| data.uid | User ID |
| data.reason | Reason for change |
| data.state | The current player status. "pause": playing paused, "play": currently playing, "end": playing completed |
on(event: "stream_reconnect_start", callback: (event: string, data: { uid: string, roomId: string }) => void);
The media stream has started reconnecting.
| Parameter | Description |
|---|---|
| event | 'stream_reconnect_start' |
| data.uid | User ID of the media stream |
| data.roomId | Room ID of the media stream |
on(event: "stream_reconnect_end", callback: (event: string, data: { uid: string, roomId: string }) => void);
The media stream reconnected.
| Parameter | Description |
|---|---|
| event | 'stream_reconnect_end' |
| data.uid | User ID of the media stream |
| data.roomId | Room ID of the media stream |
on(event: "first_audio_frame_decode", callback: (event: string, data: { uid: string, roomId: string }) => void);
Subscribe to the first frame of the decoded audio.
| Parameter | Description |
|---|---|
| event | 'first_audio_frame_decode' |
| data.uid | User ID of the media stream |
| data.roomId | Room ID of the media stream |
on(event: "first_video_frame_decode", callback: (event: string, data: { uid: string, roomId: string }) => void);
Subscribe to the first frame of the decoded video.
| Parameter | Description |
|---|---|
| event | 'first_video_frame_decode' |
| data.uid | Use ID of the media |
| data.roomId | Room ID of the media stream |
on(event: "active_speaker", callback: (event: string, uid: string) => void);
The user with the loudest voice in the channel changes.
Note:
- Calculation includes the local anchor stream
- Calculated as well with the local anchor stream publishing
| Parameter | Description |
|---|---|
| event | 'active_speaker' |
| uid | The loudest user's ID |
on(event: "audio_level_report", callback: (event: string, data: {uid: string, audioLevel: number}[]) => void);
Enable volume events reporting (every 2 seconds) by calling enableAudioLevelReport.
| Parameter | Description |
|---|---|
| event | 'audio_level_report' |
| Date | Array; each element includes uid and audioLevel, indicating the specified user's volume |
webRtc.on("audio_level_report", (event, data)=>{
for (let item of data) {
console.log(`uid: ${item.uid}, audioLevel: ${item.audioLevel}`);
}
});
on(event: "audio_input_changed", callback: (event: string, data: { state: 'added' | 'removed', deviceId: string }) => void);
The audio input device added or removed.
Detect and report after the room joined.
| Parameter | Description |
|---|---|
| event | 'audio_input_changed' |
| data.state | 'added': the added device; 'removed': the removed device |
| data.deviceId | Device ID |
on(event: "video_input_changed", callback: (event: string, data: { state: 'added' | 'removed', deviceId: string }) => void);
The video input device added or removed.
Detect and report after joing the room.
| Parameter | Description |
|---|---|
| event | 'video_input_changed' |
| data.state | 'added': the added device; 'removed': the removed devices |
| data.deviceId | Device ID |
on(event: "audio_output_changed", callback: (event: string, data: { state: 'added' | 'removed', deviceId: string }) => void);
The audio output device added or removed.
Detect and report after joing the room.
| Parameter | Description |
|---|---|
| event | 'audio_output_changed' |
| data.state | 'added' indicates the added devices; 'removed' indicates the removed devices |
| data.deviceId | Device ID |
on(event: "audio_mixing_played", callback: (event: string, data: { id: number, fileName: string }) => void);
Playing the mixed audio started.
| Parameter | Description |
|---|---|
| event | 'audio_mixing_played' |
| data.id | Mixed audio ID |
| data.fileName | Name of the mixed audio file |
on(event: "audio_mixing_finished", callback: (event: string, data: { id: number }) => void);
Playing the mixed audio completed.
| Parameter | Description |
|---|---|
| event | 'audio_mixing_finished' |
| data.id | Mixed audio ID |
on(event: "network_score", callback: (event: string, data: { uplinkNetworkScore: number, downlinkNetworkScore: number }) => void);
Report the local user's uplink and downlink network quality scores every 2 seconds.
Quality score standards: 0: unknown network quality; 1-5: excellent to very bad network quality; 6: network disconnected.
| Parameter | Description |
|---|---|
| event | 'network_score' |
| data.uplinkNetworkScore | Uplink network score |
| data.downlinkNetworkScore | Downlink network score |
on(event: "connected", callback: (event: string, data: { uid: string, roomId: string }) => void);
Connection to the server succeeded.
| Parameter | Description |
|---|---|
| event | 'connected' |
| data.uid | User ID |
| data.roomId | User's room ID |
on(event: "reconnect", callback: (event: string, data: { uid: string, roomId: string }) => void);
Connecting to the server.
| Parameter | Description |
|---|---|
| event | 'reconnect' |
| data.uid | User ID |
| data.roomId | User's room ID |
on(event: "exception", callback: (event: string, data: { uid: string, roomId: string, error: string }) => void);
Abnormality and recovery.
| Abnormal Content | Description |
|---|---|
| AUDIO_RECEIVE_BITRATE_TOO_LOW(_RESUME) | Audio receiving bit rate is too low (resumed) |
| AUDIO_SEND_BITRATE_TOO_LOW(_RESUME) | Audio sending bit rate is too low (resumed) |
| VIDEO_DECODE_FRAMERATE_TOO_LOW(_RESUME) | Video decoding frame rate too low (resumed) |
| VIDEO_RECEIVE_BITRATE_TOO_LOW(_RESUME) | Video receiving bit rate is too low (resumed) |
| VIDEO_RECEIVE_FRAMERATE_TOO_LOW(_RESUME) | Video receiving frame rate is too low (resumed) |
| VIDEO_ENCODE_FRAMERATE_TOO_LOW(_RESUME) | Video encoding frame rate is too low (resumed) |
| VIDEO_SEND_BITRATE_TOO_LOW(_RESUME) | Video sending bit rate is too low (resumed) |
| VIDEO_SEND_FRAMERATE_TOO_LOW(_RESUME) | Video sending frame rate is too low (resumed) |
on(event: "push_stream_status", callback: (event: string, data: { url: string, status: string, reason: string }) => void);
Push-stream status callabck.
| Parameter | Description |
|---|---|
| event | 'push_stream_status' |
| data.url | Push-stream URL |
| data.status | Push-stream status PUSH_STREAM_ONGOING: pushing PUSH_STREAM_FAILED: failed INTERNEL_ERROR: internal error PUSH_STREAM_FINISHED: pushed |
| data.reason | Reserved |
on(event: "mute_play", callback: (event: string, data: {uid : string }) => void);
Mute.
| Parameter | Description |
|---|---|
| event | 'mute_play' |
| data.uid | ID of the user to whom the audio stream belongs |
on(event: "mute_play_resume", callback: (event: string, data: {uid : string }) => void);
Umute.
| Parameter | Description |
|---|---|
| event | 'mute_play_resume' |
| data.uid | ID of the user to whom the audio stream belongs |
Helpful
Not helpful
Submitted! Your feedback would help us improve the website.
Feedback
Top