The ID of RtcChannel
Adds the RtcChannelEvents
handler.
After setting the RtcChannelEvents
handler, you can listen for channel events and receive the statistics of the corresponding RtcChannel
instance.
The event type.
The RtcChannelEvents
handler.
Publishes the local stream to a specified CDN streaming URL.
The CDN streaming URL in the RTMP or RTMPS format. The maximum length of this parameter is 1024 bytes. The URL address must not contain special characters, such as Chinese language characters.
Whether to enable transcoding. If you set this parameter as true,
ensure that you call the setLiveTranscoding
method before this method.
true
: Enable transcoding. To transcode the audio or video streams when publishing them to CDN live, often used for combining the audio and video streams of multiple hosts in CDN live.false
: Disable transcoding.RtcEngine
when publishing the stream.Adjusts the playback volume of a specified remote user.
You can call this method as many times as necessary to adjust the playback volume of different remote users, or to repeatedly adjust the playback volume of the same remote user.
Note
ID of the remote user.
The playback volume of the specified remote user. The value ranges from 0 to 100:
Creates a data stream.
Sets whether the recipients are guaranteed to receive the data stream from the sender within five seconds.
true
: The recipients receive the data from the sender within five seconds. If the recipient does
not receive the data within five seconds, the SDK triggers the StreamMessageError
callback and returns an error code.false
: There is no guarantee that the recipients receive the data stream within five seconds and no error message is reported for any delay or missing data stream.Determines whether the recipients receive the data stream in the sent order.
true
: The recipients receive the data in the sent order.false
: The recipients do not receive the data in the sent order.Creates a data stream.
The configurations for the data stream. See DataStreamConfig
。
Destroys the RtcChannel
instance.
RtcChannel
instance is not initialized before calling this method.Enables/Disables the built-in encryption.
Whether to enable the built-in encryption.
true
: Enable the built-in encryption.false
: Disable the built-in encryption.Configurations of built-in encryption schemas. See EncryptionConfig
.
RtcEngine
instance before calling this method.Enables/Disables the super-resolution algorithm for a remote user's video stream.
The user ID of the remote user.
Determines whether to enable super resolution for the remote user's video:
true
: Enable super resolution.false
: Do not enable super resolution.Gets the current call ID.
Gets the network connection state of the SDK.
Joins the channel with a user ID.
Note
RtcEngine
instance.Compared with the joinChannel
method in the RtcEngine
class, this method supports joining multiple channels at a time by creating multiple IChannel objects
and then calling joinChannel
in each RtcChannel object.
Once the user joins the channel, the user publishes the local audio and video streams and automatically subscribes to the audio and video streams of all the other users in the channel. Subscribing incurs all associated usage costs. To unsubscribe, set the options parameter or call the mute methods accordingly.
The token generated at your server. See Authenticate Your Users with Tokens.
Additional information about the channel. This parameter can be set as null. Other users in the channel do not receive this information.
The user ID. A 32-bit unsigned integer with a value ranging from 1 to (232-1). This parameter must be unique. If uid is not assigned (or set as 0), the SDK assigns a uid and reports it in the JoinChannelSuccess
callback. The app must maintain this user ID.
The channel media options.
RtcChannel
object with the same channel name.RtcChannel
object.RtcChannel
channel repeatedly.
Therefore, the SDK returns this error code when a user who has already joined an RtcChannel
channel calls the joining channel method of this RtcChannel
object.Joins a channel with the user account.
Note
RtcEngine
instance.Compared with the [joinChannelWithUserAccount
]{@link RtcEngine..joinChannelWithUserAccount} method in the RtcEngine
class, this method supports
joining multiple channels at a time by creating multiple RtcChannel objects and then calling joinChannelWithUserAccount
in each RtcChannel object.
Once the user joins the channel, the user publishes the local audio and video streams and automatically subscribes to the audio and video streams of all the other users in the channel. Subscribing incurs all associated usage costs. To unsubscribe, set the options parameter or call the mute methods accordingly.
The token generated at your server. See Authenticate Your Users with Tokens.
The user account. The maximum length of this parameter is 255 bytes. Ensure that you set this parameter and do not set it as null.
The channel media options.
RtcChannel
channel repeatedly.
Therefore, the SDK returns this error code when a user who has already joined an RtcChannel
channel calls the joining channel method of this RtcChannel
object.Leaves the current channel.
A successful call of this method triggers the following callbacks:
LeaveChannel
.UserOffline
, if the user leaving the channel is in a Communication
channel, or is a host in a LiveBroadcasting
channel.Stops or resumes subscribing to the audio streams of all remote users.
After successfully calling this method, the local user stops or resumes subscribing to the audio streams of all remote users, including all subsequent users.
Note
setDefaultMuteAllRemoteAudioStreams
.
Agora recommend not calling muteAllRemoteAudioStreams
and setDefaultMuteAllRemoteAudioStreams
together;
otherwise, the settings may not take effect. See Set the Subscribing State.Sets whether to stop subscribing to the audio streams of all remote users.
true
: Stop subscribing to the audio streams of all remote users.false
: (Default) Resume subscribing to the audio streams of all remote users.Stops or resumes subscribing to the video streams of all remote users.
After successfully calling this method, the local user stops or resumes subscribing to the video streams of all remote users, including all subsequent users.
Note
setDefaultMuteAllRemoteVideoStreams
.
Agora recommend not calling muteAllRemoteVideoStreams
and setDefaultMuteAllRemoteVideoStreams
together;
otherwise, the settings may not take effect. See Set the Subscribing State.Sets whether to stop subscribing to the video streams of all remote users.
true
: Stop subscribing to the video streams of all remote users.false
: (Default) Resume subscribing to the video streams of all remote users.Stops or resumes publishing the local audio stream.
Sets whether to stop publishing the local audio stream:
-5 (ERR_REFUSED)
: The request is rejected.Stops or resumes publishing the local video stream.
Sets whether to stop publishing the local video stream:
-5 (ERR_REFUSED)
: The request is rejected.Stops/Resumes receiving the audio stream of the specified user.
ID of the remote user whose audio stream you want to mute.
Determines whether to receive/stop receiving the audio stream of the specified user:
true
: Stop receiving the audio stream of the user.false
: (Default) Receive the audio stream of the user.Stops/Resumes receiving the video stream of the specified user.
ID of the remote user whose video stream you want to mute.
Determines whether to receive/stop receiving the video stream of the specified user:
true
: Stop receiving the video stream of the user.false
: (Default) Receive the video stream of the user.Pauses the media stream relay to all destination channels.
Publishes the local stream to the channel.
Registers the metadata observer.
A successful call of this method triggers the setMaxMetadataSize
method.
This method enables you to add synchronized metadata in the video stream for more diversified live streaming interactions, such as sending shopping links, digital coupons, and online quizzes.
Note
joinChannel
method.LiveBroadcasting
profile only.Removes all the RtcChannelEvents
handlers.
The event type.
Removes the RtcChannelEvents
handler.
For callback events that you only want to listen for once, call this method to remove the specific RtcEngineEvents
objects after you have received them.
The event type.
The RtcChannelEvents
handler.
Removes an RTMP or RTMPS stream from the CDN.
The CDN streaming URL to be removed. The maximum length of this parameter is 1024 bytes. The URL address must not contain special characters, such as Chinese language characters.
Renews the token when the current token expires.
In the following situations, the SDK decides that the current token has expired:
TokenPrivilegeWillExpire
callback, orConnectionStateChanged
callback reports the TokenExpired(9)
error.You should get a new token from your server and call this method to renew it. Failure to do so results in the SDK disconnecting from the Agora server.
The new token.
Resumes the media stream relay to all destination channels.
Sends the metadata.
The metadata to be sent.
Sends the data stream message.
The SDK has the following restrictions on this method:
A successful call of this method triggers the StreamMessage
callback on the remote client, from which the remote user gets the stream message.
A failed call of this method triggers the StreamMessageError
callback on the remote client.
ID of the sent data stream returned by the createDataStream
method.
The message data.
Sets the role of a user in live interactive streaming.
In the LiveBroadcasting
profile, the SDK sets the user role as audience by default. You can call setClientRole
to set the user role as host.
You can call this method either before or after joining a channel. If you call this method to switch the user role after joining a channel, the SDK automatically does the following:
muteLocalAudioStream
and muteLocalVideoStream
to change the publishing state.ClientRoleChanged
or ClientRoleChangeFailed
on the local client.UserJoined
or UserOffline
(BecomeAudience
) on the remote client.Note
LiveBroadcasting
profile only (when the profile
parameter in setChannelProfile
is set as LiveBroadcasting
).The role of a user in interactive live streaming. See ClientRole.
The detailed options of a user, including user level. See ClientRoleOptions.
joinChannel
with the options
parameter and use the default settings publishLocalAudio = true
or publishLocalVideo = true
.setClientRole
to set the user role as host.muteLocalAudioStream(false)
or muteLocalVideoStream(false)
.Sets whether to receive all remote audio streams by default.
Sets whether to stop subscribing to the audio streams of all remote users by default.
- true
: Stop subscribing to the audio streams of all remote users by default.
- false
: (Default) Resume subscribing to the audio streams of all remote users by default.
Sets whether to receive all remote video streams by default.
Sets whether to stop subscribing to the video streams of all remote users by default.
- true
: Stop subscribing to the video streams of all remote users by default.
- false
: (Default) Resume subscribing to the video streams of all remote users by default.
Sets the built-in encryption mode.
Sets the encryption mode.
Enables built-in encryption with an encryption password before joining a channel.
The encryption password.
Sets the video layout and audio settings for CDN live.
Sets the CDN live audio/video transcoding settings.
Sets the maximum size of the metadata.
Buffer size of the sent or received metadata.
Sets the default video-stream type of the remotely subscribed video stream when the remote user sends dual streams.
Note
setRemoteVideoStreamType
, the SDK applies the settings in the setRemoteVideoStreamType
method.Sets the default video-stream type.
Sets the priority of a remote user's media stream.
Use this method with the setRemoteSubscribeFallbackOption
method.
If a remote video stream experiences the fallback, the SDK ensures the high-priority user gets the best possible stream quality.
Note The Agora SDK supports setting userPriority as high for one user only.
The ID of the remote user.
The priority of the remote user.
Sets the video stream type of the remote video stream when the remote user sends dual streams. This method allows the app to adjust the corresponding video-stream type based on the size of the video window to reduce the bandwidth and resources.
enableDualStreamMode
method,
the SDK receives the high-video stream by default. You can use this method to switch to the low-video stream.ID of the remote user sending the video stream.
Sets the video-stream type.
Sets the sound position of a remote user.
When the local user calls this method to set the sound position of a remote user, the sound difference between the left and right channels allows the local user to track the real-time position of the remote user, creating a real sense of space. This method applies to massively multiplayer online games, such as Battle Royale games.
Note
enableSoundPositionIndication
method before joining a channel.The ID of the remote user.
The sound position of the remote user. The value ranges from -1.0 to 1.0:
Gain of the remote user. The value ranges from 0.0 to 100.0. The default value is 100.0 (the original gain of the remote user). The smaller the value, the less the gain.
Starts to relay media streams across channels.
After a successful method call, the SDK triggers the ChannelMediaRelayStateChanged
and ChannelMediaRelayEvent
callbacks,
and these callbacks report the state and events of the media stream relay.
If the ChannelMediaRelayStateChanged
callback reports Running(2)
and None(0)
, and
the ChannelMediaRelayEvent
callback
reports SentToDestinationChannel(4)
, the SDK starts relaying media streams between the original and the destination channel.
If the ChannelMediaRelayStateChanged
callback returns Failure(3)
, an exception occurs during the media stream relay.
Note
LiveBroadcasting
channel.stopChannelMediaRelay
method to quit the current relay.The configuration of the media stream relay.
Starts pushing media streams to a CDN and sets the transcoding configuration.
The address of the CDN live streaming. The format is RTMP or RTMPS. The character length cannot exceed 1024 bytes. Special characters such as Chinese characters are not supported.
The transcoding configuration for CDN live streaming. See LiveTranscoding
.
url
is null or the string length is 0.Starts pushing media streams to a CDN without transcoding.
The address of the CDN live streaming. The format is RTMP or RTMPS. The character length cannot exceed 1024 bytes. Special characters such as Chinese characters are not supported.
url
is null or the string length is 0.Stops the media stream relay.
Once the relay stops, the host quits all the destination channels.
After a successful method call, the SDK triggers the ChannelMediaRelayStateChanged
callback. If the callback reports Idle(0)
and
None(0)
, the host successfully stops the relay.
Note
ChannelMediaRelayStateChanged
callback with
the ServerNoResponse(2)
or ServerConnectionLost(8)
state code.
You can leave the channel using leaveChannel
, and the media stream relay automatically stops.Stops pushing media streams to a CDN.
The address of the CDN live streaming. The format is RTMP or RTMPS. The character length cannot exceed 1024 bytes. Special characters such as Chinese characters are not supported.
Stops publishing a stream to the channel.
Unregisters the metadata observer.
Updates the channels for media relay.
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 a successful method call, the SDK triggers the ChannelMediaRelayEvent
callback with
the UpdateDestinationChannel(7)
state code.
Note
startChannelMediaRelay
method to update the destination channel.The media stream relay configuration.
Updates the transcoding configuration.
The transcoding configuration for CDN live streaming. See LiveTranscoding
.
Creates and gets an RtcChannel
instance.
To join more than one channel, call this method multiple times to create as many RtcChannel
instances as needed,
and call the joinChannel
method of each created RtcChannel
object.
After joining multiple channels, you can simultaneously subscribe to streams of all the channels, but publish a stream in only one channel at one time.
The unique channel name for the Agora RTC session in the string format. The string length must be less than 64 bytes. Supported character scopes are:
Note
Refused(-5)
.RtcChannel
instance, if the method call succeeds.Refused(-5)
, if you set channelId as the empty string "".Destroys all RtcChannel
instances.
Generated using TypeDoc
The RtcChannel class.