Agora Java API Reference for Android
|
Public Member Functions | |
void | setRtcChannelEventHandler (IRtcChannelEventHandler eventHandler) |
IRtcChannelEventHandler | getEventHandler () |
abstract int | destroy () |
abstract String | channelId () |
abstract String | getCallId () |
abstract int | getConnectionState () |
abstract int | enableRemoteSuperResolution (int uid, boolean enable) |
abstract int | enableRemoteSuperResolution (boolean enable, int mode, int uid) |
abstract int | joinChannel (String token, String optionalInfo, int optionalUid, ChannelMediaOptions options) |
abstract int | joinChannelWithUserAccount (String token, String userAccount, ChannelMediaOptions options) |
abstract int | leaveChannel () |
abstract int | muteLocalAudioStream (boolean muted) |
abstract int | muteLocalVideoStream (boolean muted) |
abstract int | publish () |
abstract int | unpublish () |
abstract int | renewToken (String token) |
abstract int | setEncryptionSecret (String secret) |
abstract int | setEncryptionMode (String encryptionMode) |
abstract int | enableEncryption (boolean enabled, EncryptionConfig config) |
abstract int | registerMediaMetadataObserver (IMetadataObserver observer, int type) |
abstract int | setClientRole (int role) |
abstract int | setClientRole (int role, ClientRoleOptions options) |
abstract int | setRemoteUserPriority (int uid, int userPriority) |
abstract int | setRemoteVoicePosition (int uid, double pan, double gain) |
abstract int | setRemoteRenderMode (int uid, int renderMode, int mirrorMode) |
abstract int | setDefaultMuteAllRemoteAudioStreams (boolean muted) |
abstract int | setDefaultMuteAllRemoteVideoStreams (boolean muted) |
abstract int | muteAllRemoteAudioStreams (boolean muted) |
abstract int | adjustUserPlaybackSignalVolume (int uid, int volume) |
abstract int | muteRemoteAudioStream (int uid, boolean muted) |
abstract int | muteAllRemoteVideoStreams (boolean muted) |
abstract int | muteRemoteVideoStream (int uid, boolean muted) |
abstract int | setRemoteVideoStreamType (int uid, int streamType) |
abstract int | setRemoteDefaultVideoStreamType (int streamType) |
abstract int | createDataStream (boolean reliable, boolean ordered) |
abstract int | createDataStream (DataStreamConfig config) |
abstract int | sendStreamMessage (int streamId, byte[] message) |
abstract int | addPublishStreamUrl (String url, boolean transcodingEnabled) |
abstract int | removePublishStreamUrl (String url) |
abstract int | setLiveTranscoding (LiveTranscoding transcoding) |
abstract int | startRtmpStreamWithoutTranscoding (String url) |
abstract int | startRtmpStreamWithTranscoding (String url, LiveTranscoding transcoding) |
abstract int | updateRtmpTranscoding (LiveTranscoding transcoding) |
abstract int | stopRtmpStream (String url) |
abstract int | startChannelMediaRelay (ChannelMediaRelayConfiguration channelMediaRelayConfiguration) |
abstract int | stopChannelMediaRelay () |
abstract int | updateChannelMediaRelay (ChannelMediaRelayConfiguration channelMediaRelayConfiguration) |
abstract int | pauseAllChannelMediaRelay () |
abstract int | resumeAllChannelMediaRelay () |
abstract int | setRemoteVideoRenderer (int uid, IVideoSink render) |
The RtcChannel class.
void io.agora.rtc.RtcChannel.setRtcChannelEventHandler | ( | IRtcChannelEventHandler | eventHandler | ) |
Sets the channel event handler.
After setting the channel event handler, you can listen for channel events and receive the statistics of the corresponding RtcChannel instance.
eventHandler | The event handler of the RtcChannel instance: IRtcChannelEventHandler. |
IRtcChannelEventHandler io.agora.rtc.RtcChannel.getEventHandler | ( | ) |
Gets the channel event handler.
|
abstract |
Destroys the RtcChannel instance.
|
abstract |
Gets the channel ID of the current RtcChannel instance.
|
abstract |
Gets the current call ID. Ensure that you call this method after joining a channel.
|
abstract |
Gets the connection state of the SDK.
CONNECTION_STATE_DISCONNECTED(1)
: The SDK is disconnected from Agora edge server.CONNECTION_STATE_CONNECTING(2)
: The SDK is connecting to Agora edge server.CONNECTION_STATE_CONNECTED(3)
: The SDK joined a channel and is connected to Agora edge server. You can now publish or subscribe to a media stream in the channel.CONNECTION_STATE_RECONNECTING(4)
: The SDK keeps rejoining the channel after being disconnected from a joined channel because of network issues.CONNECTION_STATE_FAILED(5)
: The SDK fails to join the channel.
|
abstract |
Enables/Disables the super-resolution algorithm for a remote user's video stream.
enableRemoteSuperResolution
[2/2] instead.This feature effectively boosts the resolution of a remote user's video seen by the local user. If the original resolution of a remote user's video is a × b, the local user's device can render the remote video at a resolution of 2a × 2b after you enable this feature.
After calling this method, the SDK triggers the onUserSuperResolutionEnabled
callback to report whether you have successfully enabled super resolution.
libagora_super_resolution_extension.so
dynamic library into your project.uid | The user ID of the remote user. |
enable | Determines whether to enable super resolution for the remote user's video:
|
ERR_MODULE_NOT_FOUND
): The dynamic library for super resolution is not integrated.
|
abstract |
Enables/Disables the super-resolution algorithm for a remote user's video stream. This is a beta feature.
This feature effectively boosts the resolution of a remote user's video seen by the local user. If the original resolution of a remote user's video is a × b, the local user's device can render the remote video at a resolution of 2a × 2b after you enable this feature.
After calling this method, the SDK triggers the onUserSuperResolutionEnabled
callback to report whether you have successfully enabled super resolution.
libagora_super_resolution_extension.so
dynamic libraries into your project.enable | Determines whether to enable super resolution for the remote user's video:
|
mode | The mode of super resolution:
|
uid | The user ID of the remote user. This parameter only applies when mode is set as SR_MODE_MANUAL(0) . |
ERR_MODULE_NOT_FOUND
): The dynamic library for super resolution is not integrated.
|
abstract |
Joins the channel with a user ID.
Compared with the joinChannel
method in the RtcEngine
class, this method supports joining multiple channels at a time by creating multiple RtcChannel
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 by default. Subscribing incurs all associated usage costs. To unsubscribe, set the options
parameter or call the mute
methods accordingly.
token | The token generated at your server. For details, see Authenticate Your Users with Tokens. |
optionalInfo | Additional information about the channel. This parameter can be set as null. Other users in the channel do not receive this information. |
optionalUid | 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 onJoinChannelSuccess callback. The app must maintain this user ID. |
options | The channel media options: ChannelMediaOptions . |
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.
|
abstract |
Joins a channel with the user account.
Compared with the joinChannelWithUserAccount
[2/2] 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 by default. Subscribing incurs all associated usage costs. To unsubscribe, set the options
parameter or call the mute
methods accordingly.
token | The token generated at your server. For details, see Authenticate Your Users with Tokens. |
userAccount | 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.
|
options | The channel media options: ChannelMediaOptions . |
ERR_INVALID_ARGUMENT(-2)
ERR_NOT_READY(-3)
ERR_REFUSED(-5)
ERR_JOIN_CHANNEL_REJECTED(-17)
: The request to join the channel is rejected. The SDK does not support joining the same 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.
|
abstract |
Leaves the current channel.
A successful leaveChannel method call triggers the following callbacks:
onLeaveChannel
.onUserOffline
, if the user leaving the channel is in a Communication channel, or is a host in a LIVE_BROADCASTING
channel.
|
abstract |
Stops or resumes publishing the local audio stream.
This method only sets the publishing status of the audio stream in the channel of RtcChannel
.
A successful method call triggers the onRemoteAudioStateChanged
callback on the remote client.
You can only publish the local stream in one channel at a time. If you create multiple channels, ensure that you only call muteLocalAudioStream(false)
in one channel; otherwise, the method call fails, and the SDK returns -5 (ERR_REFUSED)
.
joinChannel
and setClientRole
methods. For details, see Set the Publishing Status.muted | Sets whether to stop publishing the local audio stream.
|
-5 (ERR_REFUSED)
: The request is rejected.
|
abstract |
Stops or resumes publishing the local video stream.
This method only sets the publishing status of the video stream in the channel of RtcChannel
.
A successful method call triggers the onRemoteVideoStateChanged
callback on the remote client.
You can only publish the local stream in one channel at a time. If you create multiple channels, ensure that you only call muteLocalVideoStream(false)
in one channel; otherwise, the method call fails, and the SDK returns -5 (ERR_REFUSED)
.
joinChannel
and setClientRole
methods. For details, see Set the Publishing Status.muted | Sets whether to stop publishing the local video stream.
|
-5 (ERR_REFUSED)
: The request is rejected.
|
abstract |
Publishes the local stream to the channel.
muteLocalAudioStream(false)
or muteLocalVideoStream(false)
instead.You must keep the following restrictions in mind when calling this method. Otherwise, the SDK returns the ERR_REFUSED(-5):
|
abstract |
Stops publishing a stream to the channel.
muteLocalAudioStream(true)
or muteLocalVideoStream(true)
instead.If you call this method in a channel where you are not publishing streams, the SDK returns ERR_REFUSED(-5).
muteLocalAudioStream(true)
and muteLocalVideoStream(true)
.
|
abstract |
Renews the token when the current token expires.
In the following situations, the SDK decides that the current token has expired:
onTokenPrivilegeWillExpire
callback, oronConnectionStateChanged
callback reports the CONNECTION_CHANGED_TOKEN_EXPIRED(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.
token | The new token. |
|
abstract |
Enables built-in encryption with an encryption password before joining a channel.
enableEncryption
instead.All users in a channel must set the same encryption password. The encryption password is automatically cleared once a user leaves the channel. If the encryption password is not specified or set to empty, the encryption functionality is disabled.
secret | The encryption password. |
|
abstract |
Sets the built-in encryption mode.
enableEncryption
instead.The Agora SDK supports built-in encryption, which is set to aes-128-xts mode by default. Call this method to set the encryption mode to use other encryption modes. All users in the same channel must use the same encryption mode and password.
Refer to the information related to the AES encryption algorithm on the differences between the encryption modes.
setEncryptionSecret
to enable encryption.encryptionMode | Sets the encryption mode:
|
|
abstract |
Enables/Disables the built-in encryption.
In scenarios requiring high security, Agora recommends calling enableEncryption
to enable the built-in encryption before joining a channel.
After a user leaves the channel, the SDK automatically disables the built-in encryption. To re-enable the built-in encryption, call this method before the user joins the channel again.
As of v3.4.5, Agora recommends using either the AES_128_GCM2
or AES_256_GCM2
encryption mode, both of which support adding a salt and are more secure. For details, see Media Stream Encryption.
enabled | Whether to enable the built-in encryption.
|
config | Configurations of built-in encryption schemas. See EncryptionConfig . |
|
abstract |
Registers the metadata observer.
You need to implement the IMetadataObserver class and specify the metadata type in this method. A successful call of this method triggers the getMaxMetadataSize
callback.
This method enables you to add synchronized metadata in the video stream for more diversified live broadcast interactions, such as sending shopping links, digital coupons, and online quizzes.
joinChannel
method.observer | The IMetadataObserver class. |
type | The metadata type. Currently, the SDK supports VIDEO_METADATA(0) only.
|
|
abstract |
Sets the role of the user in interactive live streaming.
After calling setChannelProfile(CHANNEL_PROFILE_LIVE_BROADCASTING)
, 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.onClientRoleChanged
or onClientRoleChangeFailed
on the local client.onUserJoined
or onUserOffline
(USER_OFFLINE_BECOME_AUDIENCE) on the remote client.LIVE_BROADCASTING
profile only (when the profile parameter in setChannelProfile
is set as CHANNEL_PROFILE_LIVE_BROADCASTING
).role | The role of a user in interactive live streaming:
|
ERR_OK
): Success.ERR_FAILED
): A general error occurs (no specified reason).ERR_INVALID_ARGUMENT
): The parameter is invalid.ERR_REFUSED
): The request is rejected. In multichannel scenarios, if you have set any of the following in one channel, the SDK returns this error code when the user switches the user role to host in another channel: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)
.ERR_NOT_INITIALIZED
): The SDK is not initialized.
|
abstract |
Sets the role of a user in a live interactive streaming.
After calling setChannelProfile(CHANNEL_PROFILE_LIVE_BROADCASTING)
, 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.onClientRoleChanged
or onClientRoleChangeFailed
on the local client.onUserJoined
or onUserOffline
(USER_OFFLINE_BECOME_AUDIENCE) on the remote client.LIVE_BROADCASTING
profile only (when the profile parameter in setChannelProfile
is set as CHANNEL_PROFILE_LIVE_BROADCASTING
).setClientRole1
is that this method can set the user level in addition to the user role.Sample code
role | The role of a user in a live interactive streaming:
|
options | The detailed options of a user, including user level. See ClientRoleOptions . |
ERR_OK
): Success.ERR_FAILED
): A general error occurs (no specified reason).ERR_INVALID_ARGUMENT
): The parameter is invalid.ERR_REFUSED
): The request is rejected. In multichannel scenarios, if you have set any of the following in one channel, the SDK returns this error code when the user switches the user role to host in another channel: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)
.ERR_NOT_INITIALIZED
): The SDK is not initialized.
|
abstract |
Sets the priority of a remote user's media stream.
The SDK ensures the high-priority user gets the best possible stream quality.
Ensure that you call this method before joining a channel.
uid | The ID of the remote user. |
userPriority | The priority of the remote user:
|
|
abstract |
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.
enableSoundPositionIndication
method before joining a channel.uid | The ID of the remote user. |
pan | The sound position of the remote user. The value ranges from -1.0 to 1.0:
|
gain | 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. |
|
abstract |
Updates the remote video display mode.
This method can be called multiple times during a call to change the display mode.
uid | ID of the remote user. |
renderMode | The remote video render mode:
|
mirrorMode | The remote video render mode:
|
|
abstract |
Sets whether to receive all remote audio streams by default.
Stops or resumes subscribing to the audio streams of all remote users by default.
Call this method after joining a channel. After successfully calling this method, the local user stops or resumes subscribing to the audio streams of all subsequent users.
setDefaultMuteAllRemoteAudioStreams(true)
, do the following:muteRemoteAudioStream(false)
, and specify the user ID.muteRemoteAudioStream(false)
multiple times.muted | Sets whether to stop subscribing to the audio streams of all remote users by default.
|
|
abstract |
Sets whether to receive all remote video streams by default.
Stops or resumes subscribing to the video streams of all remote users by default.
Call this method after joining a channel. After successfully calling this method, the local user stops or resumes subscribing to the video streams of all subsequent users.
setDefaultMuteAllRemoteVideoStreams(true)
, do the following:muteRemoteVideoStream(false)
, and specify the user ID.muteRemoteVideoStream(false)
multiple times.muted | Sets whether to stop subscribing to the video streams of all remote users by default.
|
|
abstract |
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.
setDefaultMuteAllRemoteAudioStreams
. Agora recommend not calling muteAllRemoteAudioStreams
and setDefaultMuteAllRemoteAudioStreams
together; otherwise, the settings may not take effect. See Set the Subscribing State.muted | Sets whether to stop subscribing to the audio streams of all remote users.
|
|
abstract |
Adjusts the playback signal 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.
uid | ID of the remote user. |
volume | The playback volume of the specified remote user. The value ranges from 0 to 100:
|
|
abstract |
Stops or resumes subscribing to the audio stream of a specified user.
uid | The user ID of the specified remote user. |
muted | Sets whether to stop subscribing to the audio stream of a specified user.
|
|
abstract |
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.
setDefaultMuteAllRemoteVideoStreams
. Agora recommend not calling muteAllRemoteVideoStreams
and setDefaultMuteAllRemoteVideoStreams
together; otherwise, the settings may not take effect. See Set the Subscribing State.muted | Sets whether to stop subscribing to the video streams of all remote users.
|
|
abstract |
Stops or resumes subscribing to the video stream of a specified user.
uid | The user ID of the specified remote user. |
muted | Sets whether to stop subscribing to the video stream of a specified user.
|
|
abstract |
Sets the stream type of the remote video.
Under limited network conditions, if the publisher has not disabled the dual-stream mode using enableDualStreamMode(false)
, the receiver can choose to receive either the high-quality video stream (the high resolution, and high bitrate video stream) or the low-quality video stream (the low resolution, and low bitrate video stream).
By default, users receive the high-quality video stream. Call this method if you want to switch the remote stream type to reduce the bandwidth and resources.
The aspect ratio of the low-quality video stream is the same as the high-quality video stream. Once the resolution of the high-quality video stream is set, the system automatically sets the resolution, frame rate, and bitrate of the low-quality video stream.
The SDK reports the result of calling this method in the onApiCallExecuted
callback.
You can call this method either before or after joining a channel. If you call both setRemoteVideoStreamType
and setRemoteDefaultVideoStreamType
, the SDK applies the settings in the setRemoteVideoStreamType
method.
uid | ID of the remote user sending the video stream. |
streamType | Sets the video stream type:
|
|
abstract |
Sets the default video-stream type of the remote video stream when the remote user sends dual streams.
setRemoteVideoStreamType
, the SDK applies the settings in the setRemoteVideoStreamType
method.streamType | Sets the video stream type:
|
|
abstract |
Creates a data stream.
createDataStream[2/2]
method instead.Each user can create up to five data streams during the life cycle of the RtcChannel instance.
Ensure that you call this method after joining a channel.
reliable
as true
while setting ordered
as false
.reliable | Sets whether or not the recipients are guaranteed to receive the data stream from the sender within five seconds:
|
ordered | Determines whether or not the recipients receive the data stream in the sent order:
|
reliable
and ordered
parameters to true
or false
. Do not set one as true
and the other as false
.
|
abstract |
Creates a data stream.
The createDataStream[2/2]
method does not support data reliability. If the receiver receives a data packet five seconds or more after it was sent, the SDK directly discards the data.
config | The configurations for the data stream: DataStreamConfig . |
Error Codes
. For example, if it returns -2, then it indicates ERR_INVALID_ARGUMENT(-2)
in Error Codes
.
|
abstract |
Sends the data stream message.
The SDK has the following restrictions on this method:
A successful sendStreamMessage
method call triggers the onStreamMessage
callback on the remote client, from which the remote user gets the stream message.
A failed sendStreamMessage
method call triggers the onStreamMessageError
callback on the remote client.
streamId | ID of the sent data stream returned by the createDataStream method. |
message | The message data in byte[]. |
|
abstract |
Publishes the local stream to a specified CDN streaming URL.
After calling this method, you can push media streams in RTMP or RTMPS protocol to the CDN. The SDK triggers the onRtmpStreamingStateChanged
callback on the local client to report the state of adding a local stream to the CDN.
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. |
transcodingEnabled | Sets whether transcoding is enabled/disabled. If you set this parameter as true , ensure that you call the setLiveTranscoding method before this method.
|
LIVE_BROADCASTING
channel.
|
abstract |
Removes an RTMP or RTMPS stream from the CDN.
This method removes the CDN streaming URL (added by addPublishStreamUrl
) from a CDN live stream. The SDK reports the result of this method call in the onRtmpStreamingStateChanged
callback.
LIVE_BROADCASTING
channel.url | 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. |
|
abstract |
Sets the video layout and audio settings for CDN live.
The SDK triggers the onTranscodingUpdated
callback when you call this method to update the LiveTranscoding
class. If you call this method to set the LiveTranscoding
class for the first time, the SDK does not trigger the onTranscodingUpdated
callback.
LIVE_BROADCASTING
channel.addPublishStreamUrl
method.transcoding | Sets the CDN live audio/video transcoding settings: LiveTranscoding . |
|
abstract |
Starts pushing media streams to a CDN without transcoding.
You can call this method to push a live audio-and-video stream to the specified CDN address. This method can push media streams to only one CDN address at a time, so if you need to push streams to multiple addresses, call this method multiple times.
After you call this method, the SDK triggers the onRtmpStreamingStateChanged
callback on the local client to report the state of the streaming.
LIVE_BROADCASTING
profile can call this method.stopRtmpStream
first, then call this method to retry pushing streams; otherwise, the SDK returns the same error code as the last failed push.url | 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. |
ERR_INVALID_ARGUMENT(2)
: url
is null or the string length is 0.ERR_NOT_INITIALIZED(7)
: The SDK is not initialized before calling this method.
|
abstract |
Starts pushing media streams to a CDN and sets the transcoding configuration.
You can call this method to push a live audio-and-video stream to the specified CDN address and set the transcoding configuration. This method can push media streams to only one CDN address at a time, so if you need to push streams to multiple addresses, call this method multiple times.
After you call this method, the SDK triggers the onRtmpStreamingStateChanged
callback on the local client to report the state of the streaming.
LIVE_BROADCASTING
profile can call this method.stopRtmpStream
first, then call this method to retry pushing streams; otherwise, the SDK returns the same error code as the last failed push.url | 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. |
transcoding | The transcoding configuration for CDN live streaming. LiveTranscoding . |
ERR_INVALID_ARGUMENT(2)
: url
is null or the string length is 0.ERR_NOT_INITIALIZED(7)
: The SDK is not initialized before calling this method.
|
abstract |
Updates the transcoding configuration.
After you start pushing media streams to CDN with transcoding, you can dynamically update the transcoding configuration according to the scenario. The SDK triggers the onTranscodingUpdated
callback after the transcoding configuration is updated.
transcoding | The transcoding configuration for CDN live streaming. LiveTranscoding . |
|
abstract |
Stops pushing media streams to a CDN.
You can call this method to stop the live stream on the specified CDN address. This method can stop pushing media streams to only one CDN address at a time, so if you need to stop pushing streams to multiple addresses, call this method multiple times.
After you call this method, the SDK triggers the onRtmpStreamingStateChanged
callback on the local client to report the state of the streaming.
url | 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. |
|
abstract |
Starts to relay media streams across channels.
After a successful method call, the SDK triggers the onChannelMediaRelayStateChanged
and onChannelMediaRelayEvent
callbacks, and these callbacks report the state and events of the media stream relay.
onChannelMediaRelayStateChanged
callback reports RELAY_STATE_RUNNING(2) and RELAY_OK(0), and the onChannelMediaRelayEvent
callback reports RELAY_EVENT_PACKET_SENT_TO_DEST_CHANNEL(4), the SDK starts relaying media streams between the original and the destination channel.onChannelMediaRelayStateChanged
callback returns RELAY_STATE_FAILURE(3), an exception occurs during the media stream relay.LIVE_BROADCASTING
channel.stopChannelMediaRelay
method to quit the current relay.channelMediaRelayConfiguration | The configuration of the media stream relay: ChannelMediaRelayConfiguration . |
|
abstract |
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 onChannelMediaRelayStateChanged
callback. If the callback reports RELAY_STATE_IDLE(0) and RELAY_OK(0), the host successfully stops the relay.
onChannelMediaRelayStateChanged
callback with the RELAY_ERROR_SERVER_NO_RESPONSE(2) or RELAY_ERROR_SERVER_CONNECTION_LOST(8) state code. You can leave the channel using leaveChannel
, and the media stream relay automatically stops.
|
abstract |
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 the updateChannelMediaRelay
method.
After a successful method, the SDK triggers the onChannelMediaRelayEvent
callback with the RELAY_EVENT_PACKET_UPDATE_DEST_CHANNEL(7) state code.
startChannelMediaRelay
method and receiving the onChannelMediaRelayStateChanged(RELAY_STATE_RUNNING, RELAY_OK)
callback; otherwise, this method call fails.removeDestChannelInfo
method in ChannelMediaRelayConfiguration
before calling this method. channelMediaRelayConfiguration | The media stream relay configuration: ChannelMediaRelayConfiguration . |
|
abstract |
Pauses the media stream relay to all destination channels.
After the cross-channel media stream relay starts, you can call this method to pause relaying media streams to all destination channels; after the pause, if you want to resume the relay, call resumeAllChannelMediaRelay
After a successful method call, the SDK triggers the onChannelMediaRelayEvent
callback to report whether the media stream relay is successfully paused.
startChannelMediaRelay
method.
|
abstract |
Resumes the media stream relay to all destination channels.
After calling the pauseAllChannelMediaRelay
method, you can call this method to resume relaying media streams to all destination channels.
After a successful method call, the SDK triggers the onChannelMediaRelayEvent
callback to report whether the media stream relay is successfully resumed.
pauseAllChannelMediaRelay
method.
|
abstract |
Customizes the remote video renderer for the RtcChannel
object.
During real-time engagements, the Agora SDK enables the default video sink to render the video. In the multi-channel scenario, if you want to customize the video renderer, you can create a customized video sink using the IVideoSink
class, and call setRemoteVideoRenderer
to add the customized sink into the RtcChannel
object.
uid | The ID of the remote user. |
render | The customized remote video renderer: IVideoSink . |