TRTCCallback

TRTCCallback

Tencent Cloud TRTC Event Notification Interface.

Example

// Create TRTCCloud object
import TRTCCloud from 'trtc-electron-sdk';
const rtcCloud = new TRTCCloud();

// Set event callbacks
subscribeEvents = () => {
 rtcCloud.on('onError', (errcode, errmsg) => {
     console.info('trtc_demo: onError :' + errcode + " msg" + errmsg);
 });
};

Events

onError

1.1 Error event

Error event, which indicates that the SDK threw an irrecoverable error such as room entry failure or failure to start device. It is better to show a notice to user when irrecoverable error occurred.

For more information, see Error Codes.

Parameters:
Name Type Description
errCode Number

Error code

errMsg String

Error message

onWarning

1.2 Warning event

Warning event, which indicates that the SDK threw an error requiring attention, such as video lag or high CPU usage.

For more information, see Error Codes.

Parameters:
Name Type Description
warningCode Number

Warning code

warningMsg String

Warning message

onEnterRoom

2.1 Whether room entry succeed event

After calling the enterRoom() API in TRTCCloud to enter a room, you will receive the onEnterRoom(result) event from TRTCCloudDelegate.

  • If room entry succeeded, result will be a positive number (result > 0), indicating the time in milliseconds (ms) the room entry takes.
  • If room entry failed, result will be a negative number (result < 0), indicating the error code for the failure. For more information on the error codes for room entry failure, see Error Codes.

Notice

  1. In TRTC SDK versions earlier than 6.6, the onEnterRoom(result) event is emitted only if room entry succeeds, and the onError() event is emitted if room entry fails.
  2. In TRTC SDK 6.6 and later, the onEnterRoom(result) event is emitted regardless of whether room entry succeeds or fails, and the onError() event is also emitted if room entry fails.
Parameters:
Name Type Description
result Number

If result is greater than 0, it indicates the time (in ms) the room entry takes; if result is less than 0, it represents the error code for room entry.

onExitRoom

2.2 Room exit event

Calling the exitRoom() API in TRTCCloud will trigger the execution of room exit-related logic, such as releasing resources of audio/video devices and codecs. After all resources occupied by the SDK are released, the SDK will emit the onExitRoom() event.

If you need to call enterRoom() again or switch to another audio/video SDK, please wait until you receive the onExitRoom() event. Otherwise, you may encounter problems such as the camera or mic being occupied.

Parameters:
Name Type Description
reason Number

Reason for room exit. 0: the user called exitRoom to exit the room; 1: the user was removed from the room by the server; 2: the room was dismissed.

onSwitchRoom

2.3 Room switching event

You can call the switchRole() API in TRTCCloud to switch between the anchor and audience roles. This is accompanied by a line switching process. After the switching, the SDK will emit the onSwitchRole() event.

Parameters:
Name Type Description
errCode Number

Error code. ERR_NULL indicates a successful switch. For more information, please see Error Codes.

errMsg String

Error message

onSwitchRole

2.4 Role switching event

You can call the switchRole() API in TRTCCloud to switch between the anchor and audience roles. This is accompanied by a line switching process. After the switching, the SDK will emit the onSwitchRole() event.

Parameters:
Name Type Description
errCode Number

Error code. ERR_NULL indicates a successful switch. For more information, please see Error Codes.

errMsg String

Error message

onConnectOtherRoom

2.5 Result of requesting cross-room call event

You can call the connectOtherRoom() API in TRTCCloud to establish a video call with the anchor of another room. This is the “anchor competition” feature. The caller will receive the onConnectOtherRoom() event, which can be used to determine whether the cross-room call is successful. If it is successful, all users in either room will receive the onUserVideoAvailable() event from the anchor of the other room.

Parameters:
Name Type Description
userId String

The user ID of the anchor (in another room) to be called

errCode Number

Error code. ERR_NULL indicates a successful switch. For more information, please see Error Codes.

errMsg String

Error message

onDisconnectOtherRoom

2.6 Result of ending cross-room call event

Parameters:
Name Type Description
errCode Number

Error code. ERR_NULL indicates a successful switch. For more information, please see Error Codes.

errMsg String

Error message

onRemoteUserEnterRoom

3.1 A user entered the room event

Due to performance concerns, this event works differently in different scenarios (i.e., AppScene, which you can specify by setting the second parameter when calling enterRoom).

  • Live streaming scenarios (TRTCAppSceneLIVE or TRTCAppSceneVoiceChatRoom): in live streaming scenarios, a user is either in the role of an anchor or audience. The event is emitted only when an anchor enters the room.
  • Call scenarios (TRTCAppSceneVideoCall or TRTCAppSceneAudioCall): in call scenarios, the concept of roles does not apply (all users can be considered as anchors), and the event is emitted when any user enters the room.

Notice:

  1. The onRemoteUserEnterRoom event indicates that a user entered the room, but it does not necessarily mean that the user enabled audio or video.
  2. If you want to know whether a user enabled video, we recommend you use the onUserVideoAvailable() and onUserAudioAvailable event.
Parameters:
Name Type Description
userId String

User ID of the remote user

onRemoteUserLeaveRoom

3.2 A user exited the room event

As with onRemoteUserEnterRoom, this event works differently in different scenarios (i.e., AppScene, which you can specify by setting the second parameter when calling enterRoom).

  • Live streaming scenarios (TRTCAppSceneLIVE or TRTCAppSceneVoiceChatRoom): the event is emitted only when an anchor exits the room.
  • Call scenarios (TRTCAppSceneVideoCall or TRTCAppSceneAudioCall): in call scenarios, the concept of roles does not apply, and the event is emitted when any user exits the room.
Parameters:
Name Type Description
userId String

User ID of the remote user

reason Number

Reason for room exit. 0: the user exited the room voluntarily; 1: the user exited the room due to timeout; 2: the user was removed from the room.

onUserVideoAvailable

3.3 A remote user published/unpublished primary stream video

The primary stream is usually used for camera images. If you receive the onUserVideoAvailable(userId, 1) event, it indicates that the user has available primary stream video. You can then call startRemoteView to subscribe to the remote user’s video. If the subscription is successful, you will receive the onFirstVideoFrame(userId) event, which indicates that the first video frame of the user is rendered.

If you receive the onUserVideoAvailable(userId, 0) event, it indicates that the video of the remote user is disabled, which may be because the user called muteLocalVideo or stopLocalPreview.

Parameters:
Name Type Description
userId String

User ID of the remote user

available Number

Whether the user published (or unpublished) primary stream video. 1: published; 0: unpublished

onUserSubStreamAvailable

3.4 A remote user published/unpublished substream video

The substream is usually used for screen sharing images. If you receive the onUserSubStreamAvailable(userId, 1) event, it indicates that the user has available substream video. You can then call startRemoteView to subscribe to the remote user’s video. If the subscription is successful, you will receive the onFirstVideoFrame(userId) event, which indicates that the first frame of the user is rendered.

Notice: From SDK version 8.0 and above, you should not use startRemoteSubStreamView, which has been deprecated.

Parameters:
Name Type Description
userId String

User ID of the remote user

available Number

Whether the user published (or unpublished) substream video. 1: published; 0: unpublished

onUserAudioAvailable

3.5 A remote user published/unpublished audio event

If you receive the onUserAudioAvailable(userId, 1) event, it indicates that the user published audio.

  • In auto-subscription mode, the SDK will play the user’s audio automatically.
  • In manual subscription mode, you can call muteRemoteAudio(userId, 0) to play the user’s audio.
Parameters:
Name Type Description
userId String

User ID of the remote user

available Number

Whether the user published (or unpublished) audio. 1: published; 0: unpublished

onFirstVideoFrame

3.6 The SDK started rendering the first video frame of the local or a remote user evnet

The SDK emits this event when it starts rendering your first video frame or that of a remote user. The userId in the event arguments can help you determine whether the frame is yours or a remote user’s.

  • If userId is empty string, it indicates that the SDK has started rendering your first video frame. The precondition is that you have called startLocalPreview or startScreenCapture.
  • If userId is not empty, it indicates that the SDK has started rendering the first video frame of a remote user. The precondition is that you have called startRemoteView to subscribe to the user’s video.

Notice

  1. The event of the first local video frame being rendered is triggered only after you call startLocalPreview or startScreenCapture.
  2. The event of the first video frame of a remote user being rendered is triggered only after you call startRemoteView.
Parameters:
Name Type Description
userId String

The user ID of the local or a remote user. If it is empty string, it indicates that the first local video frame is available; if it is not empty, it indicates that the first video frame of a remote user is available.

streamType Number

Video stream type. TRTCVideoStreamTypeBig: the primary stream (Main) is usually used for camera images; TRTCVideoStreamTypeSub:the substream (Sub) for screen sharing images.

width Number

Video width

height Number

Video height

onFirstAudioFrame

3.7 The SDK started playing the first audio frame of a remote user event (local user not supported)

The SDK emits this event when it plays the first audio frame of a remote user. The event is not emitted for the playing of the first audio frame of the local user.

Parameters:
Name Type Description
userId String

User ID of the remote user

onSendFirstLocalVideoFrame

3.8 The first local video frame was published event

After you enter a room and call startLocalPreview or startScreenCapture to enable local video capturing (whichever happens first), the SDK will start video encoding and publish the local video data via its network module to the cloud. It emits the onSendFirstLocalVideoFrame event after publishing the first local video frame.

Parameters:
Name Type Description
streamType Number

Video stream type. TRTCVideoStreamTypeBig: the primary stream (Main) is usually used for camera images; TRTCVideoStreamTypeSub:the substream (Sub) for screen sharing images.

onSendFirstLocalAudioFrame

3.9 The first local audio frame was published event

After you enter a room and call startLocalAudio to enable audio capturing (whichever happens first), the SDK will start audio encoding and publish the local audio data via its network module to the cloud. The SDK emits the onSendFirstLocalAudioFrame event after sending the first local audio frame.

onUserEnter

3.10 An anchor entered the room event (deprecated)

This event is not recommended in the new version. Please use onRemoteUserEnterRoom instead.

Deprecated:
  • This API has been deprecated since TRTC SDK 6.8.
Parameters:
Name Type Description
userId String

User ID of a remote user

onUserExit

3.11 An anchor left the room event (deprecated)

This event is not recommended in the new version. Please use onRemoteUserLeaveRoom instead.

Deprecated:
  • This API has been deprecated since TRTC SDK 6.8.
Parameters:
Name Type Description
userId String

User ID of a remote user

reason Number

Reason for room exit. 0: the user exited the room voluntarily; 1: the user exited the room due to timeout; 2: the user was removed from the room.

onNetworkQuality

4.1 Real-time network quality statistics event

This event is emitted every 2 seconds and notifies you of the upstream and downstream network quality detected by the SDK. The SDK uses a built-in proprietary algorithm to assess the current latency, bandwidth, and stability of the network and returns a result. If the result is 1 (excellent), it means that the current network conditions are excellent; if it is 6 (down), it means that the current network conditions are too bad to support TRTC calls.

Notice: In the returned parameters localQuality and remoteQuality, if userId is empty string, it indicates that the network quality statistics of the local user are returned. Otherwise, the network quality statistics of a remote user are returned.

Parameters:
Name Type Description
localQuality TRTCQualityInfo

Upstream network quality

remoteQuality Array.<TRTCQualityInfo>

Downstream network quality

onStatistics

4.2 Real-time statistics on technical metrics event

This event is emitted every 2 seconds and notifies you of the statistics on technical metrics related to video, audio, and network. The metrics are listed in TRTCStatistics:

  • Video statistics: video resolution (resolution), frame rate (FPS), bitrate (bitrate), etc.
  • Audio statistics: audio sample rate (samplerate), number of audio channels (channel), bitrate (bitrate), etc.
  • Network statistics: the round trip time (rtt) between the SDK and the cloud (SDK -> Cloud -> SDK), package loss rate (loss), upstream traffic (sentBytes), downstream traffic (receivedBytes), etc.

Notice: If you want to learn about only the current network quality and do not want to spend much time analyzing the statistics returned by this event notification, we recommend you use onNetworkQuality.

Parameters:
Name Type Description
statis TRTCStatistics

Statistics, including local statistics and the statistics of remote users. For details, please see TRTCStatistics.

onConnectionLost

5.1 SDK was disconnected from the cloud event

SDK emits this event when it is disconnected from the cloud, which may be caused by network unavailability or change of network, for example, when the user walks into an elevator. After emitting this event, SDK will attempt to reconnect to the cloud, and will emit the onTryToReconnect event. When it is reconnected, it will emit the onConnectionRecovery event. In other words, the SDK proceeds from one event to the next in the following order:

         =====>  =====> 
              /|\                                                     |
               |------------------------------------------------------|

onTryToReconnect

5.2 SDK is reconnecting to the cloud event

When the SDK is disconnected from the cloud, it emits the onConnectionLost event. It then attempts to reconnect and emits this event(onTryToReconnect). After it is reconnected, it emits the onConnectionRecovery event.

onConnectionRecovery

5.3 SDK is reconnected to the cloud event

When the SDK is disconnected from the cloud, it emits the [onConnectionLost]onConnectionLost event. It then attempts to reconnect and emits the [onTryToReconnect]onTryToReconnect event. After it is reconnected, it emits this event([onConnectionRecovery]onConnectionRecovery).

onSpeedTest

5.4 Result of server speed testing event (deprecated)

Deprecated:
  • This API has been deprecated since TRTC SDK 9.3. Please use onSpeedTestResult instead. After you call startSpeedTest to start server speed testing, the SDK will return the testing results multiple times with multiple server. The SDK tests the speed of multiple servers and returns the result for each IP via this event.
Parameters:
Name Type Description
currentResult TRTCSpeedTestResult

Result of the current test

finishedCount Number

Number of servers that have been tested

totalCount Number

Total number of servers to test

onSpeedTestResult

5.5 Result of server speed testing event

After you call startSpeedTest() to start server speed testing, the SDK will return the testing results multiple times with multiple server. The SDK tests the speed of multiple servers and returns the result for each IP via this event.

Parameters:
Name Type Description
result TRTCSpeedTestResult

Result of the current test. Include upstream packet loss rate, round-trip time(RTT), upload and download bandwidth and so on.

onCameraDidReady

6.1 The camera is ready event

After you call startLocalPreivew, the SDK will try to start the camera and emit this event if the camera is started. If it fails to start the camera, it’s probably because the application does not have access to the camera or the camera is being used. You can listen the onError event to learn about the exception and let users know via UI notification.

onMicDidReady

6.2 The microphone is ready event

After you call startLocalAudio, the SDK will try to start the microphone and emit this event if the mic is started. If it fails to start the mic, it’s probably because the application does not have access to the mic or the mic is being used. You can listen the onError event to learn about the exception and let users know via UI notification.

onUserVoiceVolume

6.3 User volume statistics notification event

The SDK can assess the volume of each channel and emit this event on a regular basis. You can display, for example, a waveform or volume bar on the UI based on the statistics returned. You need to call enableAudioVolumeEvaluation to enable this feature and set the interval for the event notification. Note that the SDK emits this event at the specified interval regardless of whether someone is speaking in the room. When no one is speaking in the room, userVolumes is empty, and totalVolume is 0.

Parameters:
Name Type Description
userVolumes TRTCVolumeInfo

An array that represents the volume of all users who are speaking in the room. Value range: 0-100

userVolumesCount Number

Count of element in userVolumes array

totalVolume Number

The total volume of all remote users. Value range: 0-100

onDeviceChange

6.4 The status of a local device changed event

The SDK emits this event when a local device (camera, microphone, or speaker) is connected or disconnected.

Parameters:
Name Type Description
deviceId String

Device ID. It is device name on Windows, well device ID on Mac OS.

type TRTCDeviceType

Device type

state TRTCDeviceState

Device status. 0: connected; 1: disconnected; 2: started

onTestMicVolume

6.5 Volume notification event during microphone test

When you call startMicDeviceTest to test the microphone, the SDK will keep emitting this event. The volume parameter represents the volume of the audio captured by the microphone. If the value of the volume parameter fluctuates, the microphone works properly. If it is 0 throughout the test, it indicates that there is a problem with the microphone, and users should be prompted to switch to a different microphone.

Parameters:
Name Type Description
volume Number

The volume of audio sent by the SDK to the speaker for playback. Value range: 0-100

onTestSpeakerVolume

6.6 Volume notification event during speaker test

When you call startSpeakerDeviceTest to test the speaker, the SDK will keep emitting this event. The volume parameter in the event arguments represents the volume of audio sent by the SDK to the speaker for playback. If its value fluctuates but users cannot hear any sound, the speaker is not working properly.

Parameters:
Name Type Description
volume Number

The volume of audio sent by the SDK to the speaker for playback. Value range: 0-100

onAudioDeviceCaptureVolumeChanged

6.7 Capturing volume of the mic changed event

On desktop OS such as macOS and Windows, users can set the capturing volume of the microphone in the audio control panel. The higher volume a user sets, the higher the volume of raw audio captured by the microphone. On some keyboards and laptops, users can also mute the mic by pressing a key (whose icon is a crossed out microphone).

When users set the microphone capturing volume via the UI or a keyboard shortcut, the SDK will emit this event.

You need to call enableAudioVolumeEvaluation and set the interval (interval > 0) to enable the event notification. To disable the event notification, set interval to 0.

Parameters:
Name Type Description
volume Number

System audio capturing volume, which users can set in the audio control panel. Value range: 0-100

muted Boolean

Whether the mic is muted. true: muted; false: unmuted

onAudioDevicePlayoutVolumeChanged

6.8 Playback volume changed event

On desktop OS such as macOS and Windows, users can set the system’s playback volume in the audio control panel. On some keyboards and laptops, users can also mute the speaker by pressing a key (whose icon is a crossed out speaker).

When users set the system’s playback volume via the UI or a keyboard shortcut, the SDK will emit this event.

You need to call enableAudioVolumeEvaluation and set the interval (interval > 0) to enable the event notification. To disable the event notification, set interval to 0.

Parameters:
Name Type Description
volume Number

The system playback volume, which users can set in the audio control panel. Value range: 0-100

muted Boolean

Whether the speaker is muted. true: muted; false: unmuted

onRecvCustomCmdMsg

7.1 Receipt of custom message event

When a user in a room uses sendCustomCmdMsg to send a custom message, other users in the room can receive the message through the onRecvCustomCmdMsg event.

Parameters:
Name Type Description
userId String

User ID

cmdId Number

Command ID

seq Number

Message serial number

msg String

Message data

onMissCustomCmdMsg

7.2 Loss of custom message event

When you use sendCustomCmdMsg to send a custom UDP message, even if you enable reliable transfer (by setting reliable to true), there is still a chance of message loss. Reliable transfer only helps maintain a low probability of message loss, which meets the reliability requirements in most cases. If the sender sets reliable to true, the SDK will emit this event to notify the recipient of the number of custom messages lost during a specified time period (usually 5s) in the past.

Notice: The recipient receives this event only if the sender sets reliable to true.

Parameters:
Name Type Description
userId String

User ID

cmdId Number

Command ID

errCode Number

Error code

missed Number

Number of lost messages

onRecvSEIMsg

7.3 Receipt of SEI message event

If a user in the room uses sendSEIMsg to send an SEI message via video frames, other users in the room can receive the message through the onRecvSEIMsg event.

Parameters:
Name Type Description
userId String

User ID

message String

Data

onStartPublishCDNStream

8.3 Started publishing to non-Tencent Cloud’s live streaming CDN event

When you call startPublishCDNStream to start publishing streams to a non-Tencent Cloud’s live streaming CDN, the SDK will sync the command to the CVM immediately. The SDK will then receive the execution result from the CVM and return the result to you via this event.

Notice: If you receive a event that the command is executed successfully, it only means that your command was sent to Tencent Cloud’s backend server. If the CDN vendor does not accept your streams, the publishing will still fail.

Parameters:
Name Type Description
errCode Number

0: successful; other values: failed

errMsg String

Error message

onStopPublishCDNStream

8.4 Stopped publishing to non-Tencent Cloud’s live streaming CDN event

When you call stopPublishCDNStream to stop publishing to a non-Tencent Cloud’s live streaming CDN, the SDK will sync the command to the CVM immediately. The SDK will then receive the execution result from the CVM and return the result to you via this event.

Parameters:
Name Type Description
errCode Number

0: successful; other values: failed

errMsg String

Error message

onSetMixTranscodingConfig

8.5 Set the layout and transcoding parameters for On-Cloud MixTranscoding event

When you call setMixTranscodingConfig to modify the layout and transcoding parameters for On-Cloud MixTranscoding, the SDK will sync the command to the CVM immediately. The SDK will then receive the execution result from the CVM and return the result to you via this event.

Parameters:
Name Type Description
errCode Number

0: successful; other values: failed

errMsg String

Error message

onAudioEffectFinished

9.1 Audio effects ended event (deprecated)

Deprecated:
  • This API has been deprecated since TRTC SDK 8.0. Audio effects and background music can be started using the same API startPlayMusic instead of separate ones.
Parameters:
Name Type Description
effectId Number

Effect ID

code Number

0: ended successful; other values: failed

onScreenCaptureCovered

10.1 Shared window was covered event

The SDK emits this event when the shared window is covered and cannot be captured. Upon receiving this event, you can prompt users via the UI to move and expose the window.

onScreenCaptureStarted

10.2 Screen sharing started event

The SDK emits this event when you call startScreenCapture and other APIs to start screen sharing.

onScreenCapturePaused

10.3 Screen sharing paused event

The SDK emits this event when you call pauseScreenCapture to pause screen sharing.

Parameters:
Name Type Description
reason Number

Pause reason

  • 0: the user paused screen sharing.
  • 1: screen sharing was paused because the shared window became invisible(Mac). screen sharing was paused because setting parameters(Windows).
  • 2: screen sharing was paused because the shared window became minimum(only for Windows).
  • 3: screen sharing was paused because the shared window became invisible(only for Windows).

onScreenCaptureResumed

10.4 Screen sharing resumed event

The SDK emits this event when you call resumeScreenCapture to resume screen sharing.

Parameters:
Name Type Description
reason Number

Resume reason

  • 0: the user resumed screen sharing.
  • 1: screen sharing was resumed automatically after the shared window became visible again(Mac). screen sharing was resumed automatically after setting parameters(Windows).
  • 2: screen sharing was resumed automatically after the shared window became minimize recovery(only for Windows).
  • 3: screen sharing was resumed automatically after the shared window became visible again(only for Windows).

onScreenCaptureStopped

10.5 Screen sharing stopped event

The SDK emits this event when you call stopScreenCapture to stop screen sharing.

Parameters:
Name Type Description
reason Number

Reason. 0: the user stopped screen sharing; 1: screen sharing stopped because the shared window was closed.

onSnapshotComplete

11.1 Finished taking a local screenshot event

Parameters:
Name Type Description
userId String

User ID. If it is empty, the screenshot is a local image.

type TRTCVideoStreamType

Video stream type

data String

Base64 string of screenshot data.

width Number

Screenshot width

height Number

Screenshot height

onPlayBGMBegin

12.1 Started playing background music event (deprecated)

Deprecated:
  • This API has been deprecated since TRTC SDK 8.0. Audio effects and background music can be started using the same API startPlayMusic instead of separate ones.
Parameters:
Name Type Description
errCode Number

Error code.

onPlayBGMProgress

12.2 Playback progress of background music (deprecated)

Deprecated:
  • This API has been deprecated since TRTC SDK 8.0. Audio effects and background music can be started using the same API startPlayMusic instead of separate ones.
Parameters:
Name Type Description
progressMS Number

Current progress in ms

durationMS Number

Total duration in ms

onPlayBGMComplete

12.3 Background music stopped event (deprecated)

Deprecated:
  • This API has been deprecated since TRTC SDK 8.0. Audio effects and background music can be started using the same API startPlayMusic instead of separate ones.
Parameters:
Name Type Description
errCode Number

Error code

onLocalRecordBegin

12.4 Local recording started

When you call startLocalRecording to start local recording, the SDK will emit this event to notify you whether recording is started successfully.

Parameters:
Name Type Description
errCode number

Error code. 0: recording started successfully; -1: failed to start recording; -2: incorrect file extension

storagePath string

Storage path of recording file

onLocalRecording

12.5 Local media is being recording

The SDK will emit this event regularly after local recording is started successfully via the calling of startLocalRecording. You can listen to this event to stay up to date with the status of the recording task. You can set the event notification interval when calling startLocalRecording.

Parameters:
Name Type Description
duration number

Cumulative duration of recording, in milliseconds

storagePath string

Storage path of recording file

onLocalRecordComplete

12.6 Local recording completed

When you call stopLocalRecording to stop local recording, the SDK will emit event to notify you of the recording result.

Parameters:
Name Type Description
errCode number

Error code. 0: recording succeeded; -1: recording failed; -2: recording was ended due to change of resolution or switch between the landscape and portrait mode.

storagePath string

Storage path of recording file

onSystemAudioLoopbackError

13.1 Whether system audio capturing is enabled successfully event

You can call startSystemAudioLoopback to have the SDK capture the audio played back by the system. In cases such as video teaching and music live streaming, the teacher can use this feature to let the SDK capture the sound of the video played by his or her computer, so that students in the room can hear the sound too. The SDK emits this event after trying to enable system audio capturing. To determine whether it is actually enabled, pay attention to the error parameter in the event.

Parameters:
Name Type Description
errCode Number

Error code

  • 0: system audio capturing is enabled successfully. Otherwise, it is not.
  • ERR_AUDIO_PLUGIN_START_FAIL(-1330): Start recording system audio failed, eg: audio plugin not available
  • ERR_AUDIO_PLUGIN_INSTALL_NOT_AUTHORIZED (-1331): No authorization to install audio plugin
  • ERR_AUDIO_PLUGIN_INSTALL_FAILED (-1332): Install audio plugin failed