Note: Agora will soon stop the service for injecting online media streams on the client. If you have not implemented this service, Agora recommends that you do not use it.
Injects an online media stream to a live interactive streaming channel.
If this method is called successfully, the server pulls the voice or video stream and injects it into a live channel. This is applicable to scenarios where all of the audience members in the channel can watch a live show and interact with each other. See Inject an Online Media Stream for details.
This method call triggers the following callbacks:
Client.on("streamInjectedStatus")
, with the state of injecting the online stream.Client.on("stream-added")
and Client.on("peer-online")
(uid: 666), if the online media stream is injected into the channel.Client.on("stream-added")
and Client.on("peer-online")
(uid: 666), if the online media stream is injected into the channel.Note
URL address of the live streaming. ASCII characters only, and the string length must be greater than 0 and less than 256 bytes. Valid protocols are RTMP, HLS, and HTTP-FLV.
Configuration of the inject stream, see InjectStreamConfig for details.
Configures the CDN Live Streaming
DEPRECATED
Agora recommends using the following methods instead:
This method configures the CDN live streaming before joining a channel.
Note
Call configPublisher before Client.join.
Width of the output data stream set for CDN Live, 360 is the default value. A positive integer, and the value range is [1,10000].
Height of the output data stream set for CDN Live, 640 is the default value. A positive integer, and the value range is [1,10000].
Frame rate of the output data stream set for CDN Live, 15 fps is the default value. A positive integer, and the value range is [1,10000].
Bitrate of the output data stream set for CDN Live, 500 kbps is the default value. A positive integer, and the value range is [1,10000000].
The push-stream address for the picture-in-picture layouts, null
is the default value.
ASCII characters only, and the string length must be greater than 0 and less than 256 bytes.
Disables Dual Streams
This method disables dual streams.
The callback when the method succeeds.
The callback when the method fails. The following are common errors:
Enables Volume Indicator
This method enables the SDK to report the active remote users who are speaking and their volume regularly.
If this method is enabled, the SDK triggers the "volume-indicator"
callback to report the volumes every two seconds, regardless of whether there are active speakers.
Note
If you have multiple tabs running the Web SDK on one device, this function might not work.
Enables Dual Stream
This method enables dual-stream mode on the publisher side. We recommend calling this method after joining a channel(Client.join).
Dual streams are a hybrid of a high-quality video stream and a low-quality video stream:
We do not recommend using the track methods (addTrack/removeTrack/replaceTrack) on dual streams, which may cause different performance in the high-quality and low-quality video streams.
Note
This method does not apply to the following scenarios:
The callback when the method succeeds.
The callback when the method fails. The following are common errors:
Enumerates Video Input Devices
This method enumerates the available video input devices, such as cameras.
If this method succeeds, the SDK returns a list of video input devices in an array of MediaDeviceInfo objects.
Gets the Connection State
This method returns the state of the connection between the SDK and Agora's edge server.
The connection state:
DISCONNECTED
: The SDK is disconnected from Agora's edge server.CONNECTING
: The SDK is connecting to Agora's edge server.
The SDK enters this state when calling Client.join or reconnecting to Agora's edge server automatically after the connection is lost.CONNECTED
: The SDK is connected to Agora's edge server and joins a channel. You can now publish or subscribe to a stream in the channel.DISCONNECTING
: The SDK is disconnecting from Agora's edge server. The SDK enters this state when calling Client.leave.Retrieves the Audio Statistics of the Local Stream
This method retrieves the audio statistics of the published stream, including audio codec type, sampling rate, bitrate, and so on.
Note
stream-published
event, which may take at most 3 seconds. You can call this method periodically.The callback contains the statistics of the local audio stream.
Retrieves the Video Statistics of the Local Stream
This method retrieves the video statistics of the published stream, including video resolution, bitrate, frame rate, and so on.
Note
stream-published
event, which may take at most 3 seconds. You can call this method periodically.The callback contains the statistics of the local video stream.
Gets the Statistics of the System Network
DEPRECATED from v2.5.1, use getTransportStats instead.
This method gets the statistics of the browser's local network.
Currently only the network type information is provided, see NetworkType.
Note
Chrome 61+ is required for this function, and the compatibility is not guaranteed. See Network Information API for details.
The callback contains the statistics of the system network.
Enumerates Audio Output Devices
This method enumerates the available audio output devices, such as speakers.
If this method succeeds, the SDK returns a list of audio output devices in an array of MediaDeviceInfo objects.
Note
Only Chrome 49 or later supports this function.
Enumerates Audio Input Devices
This method enumerates the available audio input devices, such as microphones.
If this method succeeds, the SDK returns a list of audio input devices in an array of MediaDeviceInfo objects.
Retrieves the Audio Statistics of the Remote Stream
This method retrieves the audio statistics of the remote stream, including audio codec type, packet loss rate, bitrate, and so on.
Note
stream-subscribed
event, which may take at most 3 seconds. You can call this method periodically.The callback contains the statistics of the remote audio stream.
Retrieves the Video Statistics of the Remote Stream
This method retrieves the video statistics of the remote stream, including packet loss rate, video bitrate, frame rate, and so on.
Note
stream-subscribed
event, which may take at most 3 seconds. You can call this method periodically.The callback contains the statistics of the remote video stream.
Gets the Statistics of the Session
This method gets the statistics of the session connection.
Note
The callback contains the statistics of the session connection.
Gets the Statistics of the System
This method gets the statistics of the system.
Currently only the battery level information is provided, see BatteryLevel.
Note
This feature is experimental, see Battery Status API for browser compatibility.
The callback contains the statistics of the system.
Gets the Statistics of the Transmission
This method gets the statistics of the transmission quality to Agora service.
Note
The callback contains the statistics of the transmission quality.
Initializes a Client Object
This method initializes the client object.
Pass in the App ID for your project. ASCII characters only, and the string length must be greater than 0 and less than 256 bytes.
The callback when the method succeeds.
The callback when the method fails. The following are the common errors:
"BAD_ENVIRONMENT"
: Unsupported web browser.Joins an AgoraRTC Channel
This method joins an AgoraRTC channel.
When joining the channel, the Client.on("connected")
and Client.on("connection-state-change")
callbacks are triggered on the local client.
After joining the channel, if the user joining the channel is in the Communication profile, or is a host in the Live Broadcast profile, the Client.on("peer-online")
callback is triggered on the remote client.
null
as the parameter value.A string that provides a unique channel name for the Agora session. The length must be within 64 bytes. Supported character scopes:
The user ID, an integer or a string, ASCII characters only. Ensure this ID is unique.
If you set the uid to null
or 0
, the server assigns one and returns it in the onSuccess
callback.
Note
uid
.(Optional) Additional information that you want to pass in. You can leave this parameter as empty or pass in channel-related information. Other users in the channel do not receive this information.
The callback when the method succeeds. The server returns the uid (number) which represents the identity of the user.
The callback when the method fails. The following are common errors:
"INVALID_OPERATION"
: Unable to join the channel. Usually due to calling Client.join
repeatedly."UID_CONFLICT"
: The uid
of the local client conflicts with other users in the channel."ERR_REPEAT_JOIN"
: The local client has already joined the channel."SOCKET_ERROR"
: The SDK disconnects with the Agora server when joining the channel."CANNOT_MEET_AREA_DEMAND"
: The connection fails because the user is outside the chosen region for connection. For example, if you set ClientConfig.areaCode as [AgoraRTC.AREAS.EUROPE]
, and a user tries to join the channel in North America, this error occurs. If ClientConfig.areaCode
is not explicitly set, then by default the SDK requests servers across multiple regions and chooses an optimal connection, so the console log may print this error when a user joins the channel. In this case, you can ignore the error.Leaves an AgoraRTC Channel
This method enables a user to leave a channel.
When leaving the channel, the Client.on("connection-state-change")
callback is triggered on the local client.
After leaving the channel, if the user joining the channel is in the Communication profile, or is a host in the Live Broadcast profile, the Client.on("peer-leave") callback
is triggered on the remote client.
The callback when the method succeeds.
The callback when the method fails. The following are common errors:
Unbinds Events
This method removes the events attached by the Client.on()
method.
The event to be removed.
The function to be removed.
Occurs when the first remote audio frame is decoded.
The SDK triggers this callback when the local client successfully subscribes to a remote stream and decodes the first audio frame.
Note This callback supports only the Google Chrome browser.
Occurs when the first remote video frame is decoded.
The SDK triggers this callback when the local client successfully subscribes to a remote stream and decodes the first video frame.
Occurs when the local stream is published.
Occurs when the local stream is unpublished.
Occurs when the remote stream is added.
Note
When the local user joins the channel, if other users are already in the channel, the SDK also reports to the app on the existing remote streams.
Occurs when the remote stream is removed; for example, a peer user calls Client.unpublish.
Occurs when a user subscribes to a remote stream.
Occurs when a remote user or host joins the channel.
The SDK triggers this callback under one of the following circumstances:
ID of the user or host who joins the channel.
Occurs when a remote user becomes offline.
The SDK triggers this callback in the following situations:
Note In live-broadcast channels, the SDK triggers this callback only when a host goes offline.
Reason why the user goes offline.
"host"
to "audience"
.ID of the remote user.
Occurs when the peer user mutes the audio.
Occurs when the peer user unmutes the audio.
Occurs when the peer user turns off the video.
Occurs when the peer user turns on the video.
Occurs when encryption or decryption fails during publishing or subscribing to a stream.
Since
3.0.0
The failure is usually due to a wrong encryption password (setEncryptionSecret) or an incorrect encryption mode (setEncryptionMode).
This callback notifies the peer user that he/she is banned from the channel. Only the banned users receive this callback.
Usually the reason is that the UID is banned (K_UID_BANNED
(14)).
DEPRECATED from 3.0.2. Use Client.on("volume-indicator")
instead.
This callback notifies the application who is the active speaker in the channel.
This callback notifies the application of all the speaking remote users and their volumes.
It is disabled by default. You can enable this event by calling enableAudioVolumeIndicator. If enabled, it reports the volumes every two seconds regardless of whether there are users speaking.
The volume is an integer ranging from 0 to 100. Usually a user with volume above five will be counted as a speaking user.
Occurs when the live streaming starts.
The CDN streaming URL.
Occurs when the live streaming fails.
Note: The following reasons only apply to the Web SDK 3.2.0 or later:
The reasons:
LIVE_STREAMING_INVALID_ARGUMENT
: Invalid argument.LIVE_STREAMING_INTERNAL_SERVER_ERROR
: An error occurs in Agora's streaming server.LIVE_STREAMING_PUBLISH_STREAM_NOT_AUTHORIZED
: The URL is occupied.LIVE_STREAMING_TRANSCODING_NOT_SUPPORTED
: Sets the transcoding parameters when the transcoding is not enabled.LIVE_STREAMING_CDN_ERROR
: An error occurs in the CDN.LIVE_STREAMING_TASK_CONFLICT
: A CDN streaming task with the same URL is running.INVALID_OPERATION
: Invalid operation. If, for example, you do not call {@link Client.setLiveTransoding} to configure the live transcoding parameters before calling Client.startLiveStreaming, the SDK returns this error.WS_ABORT
: The CDN live streaming task is aborted due to WebSocket disconnection.The CDN streaming URL.
Occurs when the live streaming stops.
The CDN streaming URL.
Occurs when the live transcoding setting is updated.
The SDK triggers this callback when the live transcoding setting is updated by calling the setLiveTranscoding method.
Note: Agora will soon stop the service for injecting online media streams on the client. If you have not implemented this service, Agora recommends that you do not use it.
Occurs when the injected online media stream's status is updated.
Occurs when the Token expires in 30 seconds.
You should request a new Token from your server and call Client.renewToken.
Occurs when the Token expires.
You should request a new Token from your server and call Client.renewToken.
Occurs when an error message is reported and requires error handling.
Possible errors:
reason
is "SOCKET_DISCONNECTED"
, the SDK disconnects from the Agora server due to network conditions and will automatically try reconnecting.Occurs when the network type changes.
Occurs when an audio input device is added or removed.
Occurs when an audio output device is added or removed.
Occurs when a camera is added or removed.
Occurs when the type of a video stream changes.
It happens when a high-quality video stream changes to a low-quality video stream, or vice versa.
The stream type (streamType):
Occurs when the network connection state changes.
The connection between the SDK and Agora's edge server has the following states:
DISCONNECTED
: The SDK is disconnected from Agora's edge server.CONNECTING
: The SDK is connecting to Agora's edge server.
The SDK enters this state when calling Client.join or reconnecting to Agora's edge server automatically after the connection is lost.CONNECTED
: The SDK is connected to Agora's edge server and joins a channel. You can now publish or subscribe to a stream in the channel.
If the connection is lost because, for example, the network is down or switched, the SDK triggers this callback and notifies the app that the state changes from CONNECTED
to CONNECTING
.DISCONNECTING
: The SDK is disconnecting from Agora's edge server. The SDK enters this state when calling Client.leave.The current connection state.
The previous connection state.
Occurs when the SDK starts republishing or re-subscribing to a stream.
The corresponding uid of the stream being republished or re-subscribed to.
Occurs when the SDK finishes republishing or resubscribing to a stream.
success
is true
.success
is false
. Possible reasons:REQUEST_ABORT
: The republishing or resubscribing is interrupted by server reconnection. After the SDK reconnects to the server, the republishing or resubscribing resumes. You can ignore this error.The result of republishing or resubscribing to the stream.
true
: Success.false
: Failure.The corresponding uid of the stream being republished or resubscribed to.
Occurs when the user role switches in a live interactive streaming scenario. For example, from a host to an audience or vice versa.
Role that the user switches to.
Occurs when the SDK starts reconnecting to the server automatically after the connection is lost.
Occurs when the local user rejoins the channel successfully.
Occurs when the SDK is connected to the server.
Reports the network quality of the local user once every two seconds.
This callback reports on the uplink and downlink network conditions of the local user.
Note
This is an experimental feature and the network quality rating is for reference only.
The local user's network quality, including the uplink and downlink quality, see NetworkQualityStats for details.
Occurs when the remote video stream falls back to an audio-only stream due to unreliable network conditions or switches back to the video after the network conditions improve.
If you set fallbackType
as 2 in setStreamFallbackOption,
the SDK triggers this callback when the remote media stream falls back to audio only due to unreliable network conditions or switches back to the video after the network condition improves.
Note
Once the remote media stream is switched to the low stream due to unreliable network conditions,
you can monitor the stream switch between a high stream and low stream in the stream-type-changed
callback.
Whether the remote media stream falls back to audio-only or switches back to the video:
ID of the remote user sending the stream.
Occurs when a remote stream adds or removes a track.
When a remote stream calls the addTrack or removeTrack method, the SDK triggers this callback.
The stream that adds or removes a track:
video
: boolean, marks whether the stream contains a video track.audio
: boolean, marks whether the stream contains an audio track.Reports exception events in the channel.
Exceptions are not errors, but usually mean quality issues.
This callback also reports recovery from an exception.
Each exception event has a corresponding recovery event, see the table below for details:
Note
This callback supports only the Chrome browser.
Event code.
Event message.
The uid of the user who experiences the exception or recovery event.
Occurs when a remote user of the Native SDK calls enableLocalVideo(true)
to enable video capture.
Since
3.0.0
The ID of the remote user.
Occurs when a remote user of the Native SDK calls enableLocalVideo(false)
to disable video capture.
Since
3.0.0
The ID of the remote user.
Reports events during the media stream relay.
Since
3.0.0
The event code for media stream relay.
Occurs when the state of the media stream relay changes.
Since
3.0.0
The SDK reports the state and error code of the current media relay in this callback.
The error code.
The state code.
code
for the error code. In case of an error, the SDK resets the media stream relay state, and you need to call startChannelMediaRelay to restart the relay.Publishes a Local Stream
This method publishes a local stream to the SD-RTN.
When the stream is published, the following callbacks are triggered:
Client.on("stream-published")
Client.on("stream-added")
Note
In a live interactive streaming channel, whoever calls this API is the host.
Stream object, which represents the local stream.
The callback when the method fails. The following are common errors:
rejoin
event, and call publish
again.Note: Agora will soon stop the service for injecting online media streams on the client. If you have not implemented this service, Agora recommends that you do not use it.
Removes the Injected Stream
This method removes the HTTP/HTTPS URL address (added by addInjectStreamUrl) from the live interactive streaming.
URL address of the injected stream. ASCII characters only, and the string length must be greater that 0 and less than 256 bytes.
Renews the Channel Key
This method renews your channel key.
Once the Channel Key schema is enabled, the key expires after a certain period of time.
When the onFailure callback reports the error DYNAMIC_KEY_TIMEOUT
, the application should renew the Channel Key by calling this method.
Not doing so will result in SDK disconnecting with the server.
Specifies the renewed Channel Key.
The callback when the method succeeds.
The callback when the method fails. The following are common errors:
Renews the Token
This method renews your token.
Once the Token schema is enabled, the token expires after a certain period of time.
In case of the onTokenPrivilegeWillExpire
or onTokenPrivilegeDidExpire
callback events, the application should renew the Token by calling this method.
Not doing so will result in SDK disconnecting with the server.
Specifies the renewed Token.
Sets the role of the user.
This method is applicable only to the live mode.
Sets the role of the user such as a host or an audience (default), before joining a channel.
This method can be used to switch the user role after the user joins a channel. When a user switches the user role after joining a channel, the following callbacks are triggered:
Client.on("client-role-changed")
.Client.on("peer-online")
or Client.on("peer-leave")
.In live mode (mode is set as live
):
Note
In communication mode (mode set as rtc
), this method does not take effect. All users are host
by default.
User role:
"audience"
: Audience, the default role. An audience can only receive streams."host"
: Host. A host can both send and receive streams.Sets the Encryption Mode
Use this method with setEncryptionSecret method to enable the built-in encryption before joining a channel.
All users in a channel must use the same encryption mode, secret, and salt.
Note
Client.on("crypt-error")
callback when publishing or subscribing to a stream.The encryption mode:
"aes-128-xts"
: 128-bit AES encryption, XTS mode."aes-256-xts"
: 256-bit AES encryption, XTS mode."aes-128-ecb"
: 128-bit AES encryption, ECB mode."aes-128-gcm"
: 128-bit AES encryption, GCM mode."aes-256-gcm"
: 256-bit AES encryption, GCM mode."aes-128-gcm2"
: 128-bit AES encryption, GCM mode, with salt."aes-256-gcm2"
: 256-bit AES encryption, GCM mode, with salt."sm4-128-ecb"
: 128-bit SM4 encryption, ECB mode."none"
: No encryption.The salt. Only valid when you set the encryption mode as "aes-128-gcm2"
or "aes-256-gcm2"
. Agora recommends you use OpenSSL to generate the salt on your server. For details, see Media Stream Encryption.
Enables Built-in Encryption
Use this method with setEncryptionMode method to enable the built-in encryption before joining a channel.
All users in a channel must set the same encryption secret.
Note
Client.on("crypt-error")
callback when publishing or subscribing to a stream.The encryption secret. ASCII characters only, and the string length must be greater than 0 and less than 256 bytes. When a user uses a weak secret, the SDK outputs a warning message to the Web Console and reminds the users to use a strong password. A strong secret must contain at least eight characters and be a combination of uppercase and lowercase letters, numbers and special characters. Agora recommends you use OpenSSL to generate the secret on your server. For details, see Channel Encryption.
Sets Live Transcoding
This method sets the video layout and audio for CDN live.
A successful call of this method to update the transcoding settings triggers the Client.on("liveTranscodingUpdated")
callback.
Note
Transcoding settings, see LiveTranscoding for details.
Sets the video profile of the low-quality video stream
If you have enabled the dual-stream mode by calling Client.enableDualStream, use this method to set the video profile of the low-quality stream.
The default video profile of the low-quality video stream:
Note
The video profile of the low-quality video stream.
The bitrate of the low-quality video stream frame in Kbps.
A positive integer, and the value range is [1,10000000]. The default value is 50.
The frame rate of the low-quality video stream frame in fps.
A positive integer, and the value range is [1,10000]. The default value is 15.
The height of the low-quality video stream frame.
A positive integer, and the value range is [1,10000]. The default value is 120.
The width and height parameters are bound together, and take effect only when both are set. Otherwise, the SDK assigns the default values.
The width of the low-quality video stream frame.
A positive integer, and the value range is [1,10000]. The default value is 160.
The width and height parameters are bound together, and take effect only when both are set. Otherwise, the SDK assigns the default values.
Deploys a Proxy Server
Use this method to deploy an HTTP proxy server.
You can also use cloud proxy by startProxyServer. See Use Cloud Proxy for details.
Note
Your proxy server domain name. ASCII characters only, and the string length must be greater than 0 and less than 256 bytes. See ClientConfig.proxyServer for details.
Sets the stream type of a remote stream
When a remote user sends dual streams, this method decides on which stream to receive on the subscriber side. If this method is not used, the subscriber receives the high-quality video stream.
The remote video stream object.
Sets the remote video stream type. The following lists the video-stream types:
Sets Stream Fallback Option
Use this method to set stream fallback option on the receiver.
Under poor network conditions, the SDK can choose to subscribe to the low-quality video stream or only the audio stream.
If the auto-fallback option is enabled, the SDK triggers the Client.on("stream-type-changed")
callback when the remote stream changes from a high-quality video stream to a low-quality video stream or vice versa, and triggers the Client.on("stream-fallback")
callback when the remote stream changes from a video stream to an audio-only stream or vice versa.
Note
This method can only be used when the publisher has enabled the dual-stream mode by enableDualStream.
The remote stream object.
The fallback option:
Deploys the TURN Server
Use this method to deploy the TURN server.
You can also use cloud proxy by startProxyServer. See Use Cloud Proxy for details.
Note
Ensure that you call this API before Client.join.
An array of the TurnServer objects. You can pass configurations of multiple TURN servers to this parameter.
Starts relaying media streams across channels.
Since
3.0.0
After this method call, the SDK triggers the following callbacks:
Client.on("channel-media-relay-state")
, which reports the state and error code of the media stream relay.state
2 and code
0.state
3. Refer to code
for the error code and call this method again.Client.on("channel-media-relay-event")
, which reports the events of the media stream relay.code
4, reporting that the SDK starts relaying the media stream to the destination channel.Note
Configurations of the media stream relay: ChannelMediaRelayConfiguration.
The result of starting the media stream relay.
Starts a Live Stream
This method starts a live stream. For details, see Push Streams to the CDN.
When the live stream starts, the SDK triggers the Client.on("liveStreamingStarted")
callback.
If this method call fails, the SDK triggers the Client.on("liveStreamingFailed")
callback.
Note
"host"
in setClientRole.URL address for the live stream. ASCII characters only, and the string length must be greater than 0 and less than 256 bytes.
Marks whether to enable live transcoding. If set as true
, setLiveTranscoding must be called before this method.
Enables Cloud Proxy
This method must be called before joining the channel or after leaving the channel.
For the extra settings required for using the cloud proxy service, see Use Cloud Proxy.
Stops the media stream relay.
Since
3.0.0
Once the relay stops, the user leaves all the destination channels.
After this method call, the SDK triggers the Client.on("channel-media-relay-state")
callback.
state
0.state
3 and code
2 or 8. The failure is usually due to poor network conditions. You can call Client.leave to leave the channel and stop the relay.The result of stopping the media stream relay.
null
: Success.Stops Live Streaming
This method stops and deletes the live streaming.
When the live stream stops, the SDK triggers the Client.on("liveStreamingStopped")
callback.
URL address of the live streaming. ASCII characters only, and the string length must be greater than 0 and less than 256 bytes.
Disables Cloud Proxy
This method must be called before joining the channel or after leaving the channel.
This method disables all proxy settings, including those set by setProxyServer and setTurnServer.
Subscribes to a Remote Stream
This method enables a user to subscribe to a remote stream.
After the user subscribes to a remote stream, the SDK triggers the Client.on("stream-subscribed")
callback.
If the remote stream contains an audio track, the SDK also triggers the Client.on("first-audio-frame-decode")
callback;
if the remote stream contains a video track, the SDK also triggers the Client.on("first-video-frame-decode")
callback.
Stream object, which represents the remote stream.
Sets whether to receive the video or audio data independently by the video
and audio
parameters.
Note
video
and audio
cannot be set as false
at the same time. If you need to stop subscribing to the stream, call Client.unsubscribe instead.options
as null
for Safari, otherwise theSAFARI_NOT_SUPPORTED_FOR_TRACK_SUBSCRIPTION
error occurs.Marks whether to receive the audio data.
true
: (Default) Receives the audio data.false
: Not receives the audio data.Marks whether to receive the video data.
true
: (Default) Receives the video data.false
: Not receives the video data.The callback when the method fails. The following are common errors:
Unpublishes the Local Stream
This method unpublishes the local stream.
When the stream is unpublished, the Client.on("stream-unpublished")
callback is triggered on the local client, and the Client.on("stream-removed")
callback is triggered on the remote client.
Note
In a live interactive streaming scenario, the user role of a host switches to audience after unpublishing, and the Client.on("peer-leave")
callback is triggered on the remote client.
Stream object, which represents the local stream.
The callback when the method fails. The following are common errors:
Unsubscribes from the Remote Stream
This method enables the user to unsubscribe from the remote stream.
Stream object, which represents the remote stream.
The callback when the method fails. The following are common errors:
Updates the channels for media stream relay.
Since
3.0.0
After the channel media relay starts, if you want to relay the media stream to more channels, or leave the current relay channel, you can call this method.
After this method call, the SDK triggers the Client.on("channel-media-relay-event")
callback.
code
7.code
8, and the SDK also triggers the Client.on("channel-media-relay-state")
callback with state
3. In this case, the media relay state is reset, and you need to call startChannelMediaRelay again to restart the relay.Note
Configurations of the media stream relay: ChannelMediaRelayConfiguration.
The result of updating the destination channels.
null
: Success.
The Client interface provides major functions for a voice/video call, such as joining a channel and publishing a stream.
The Client object is created by the createClient method and represents the local client.