Configure the CDN Live Streaming
DEPRECATED
Agora recommends using the following methods instead:
This method configures the CDN live streaming before joining a channel.
Note:
Width of the output data stream set for CDN Live, 360 is the default value.
Height of the output data stream set for CDN Live, 640 is the default value.
Frame rate of the output data stream set for CDN Live, 15 fps is the default value.
Bitrate of the output data stream set for CDN Live, 500 kbps is the default value.
The push-stream address for the picture-in-picture layouts, null
is the default value.
Disable Dual Streams
This method disables dual streams.
The callback when the method succeeds.
The callback when the method fails.
Enable Volume Indicator
This method enables the SDK to report the active speakers and their volume regularly.
If this method is enabled, the SDK will return the volumes every two seconds, regardless of whether there are active speakers.
Note:
Enable Dual Stream
This method enables the dual-stream mode on the publisher side.
Dual streams are a hybrid of a high-video stream and a low-video stream:
The callback when the method succeeds.
The callback when the method fails.
Initialize a Client Object
This method initializes the client object.
Pass in the App ID for your project. To get your App ID, see Get an App ID.
The callback when the method succeeds.
The callback when the method fails.
Join an AgoraRTC Channel
This method joins an AgoraRTC channel.
null
as the parameter value.A string that provides a unique channel name for the Agora session. The length must be within 64 bytes. The supported characters: a-z,A-Z,0-9,space,! #$%&,()+, -,:;<=.#$%&,()+,-,:;<=.,>?@[],^_,{|},~
The user ID. Ensure that this integer is unique. If you set the uid to null
, the server assigns one and returns it in the onSuccess
callback.
The callback when the method succeeds. The server returns the uid which represents the identity of the user.
The callback when the method fails.
Leave an AgoraRTC Channel
This method enables a user to leave a channel.
The callback when the method succeeds.
The callback when the method fails.
This callback notifies the application that the local stream has been published.
This callback notifies the application that the remote stream has been added.
This callback notifies the application that the remote stream has been removed; for example, a peer user has called Client.unpublish.
This callback notifies the application that a user has subscribed to a remote stream.
This callback notifies the application that the peer user has left the channel; for example, the peer user has called Client.leave.
This callback notifies the application that the peer user has muted the audio.
This callback notifies the application that the peer user has unmuted the audio.
This callback notifies the application that the peer user has turned off the video.
This callback notifies the application that the peer user has turned on the video.
This callback notifies the peer user that he/she has been banned from the channel. Only the banned users receive this callback.
This callback notifies the application who is the active speaker in the channel.
This callback notifies the application of all the speaking 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.
This callback notifies the application that the live streaming has started.
This callback notifies the application that the live streaming has failed.
This callback notifies the application that the live streaming has stopped.
This callback notifies the application that the live transcoding setting has been updated.
This callback notifies the application that the Token will expire in 30 seconds.
You should request a new Token from your server and call Client.renewToken.
This callback notifies the application that the Token has expired.
You should request a new Token from your server and call Client.renewToken.
This callback notifies the application that an error message is reported and requires error handling.
Publish a Local Stream
This method publishes a local stream to the SD-RTN.
Note:
In a live broadcast, whoever calls this API is the host.
Stream object, which represents the local stream.
The callback when the method fails.
Renew 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.
Renew 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.
Set the Encryption Mode
This method sets the encryption mode.
Note:
Ensure that you call this API before Client.join.
The encryption mode:
Enable Built-in Encryption
This method enables the built-in encryption.
Note:
Ensure that you call this API before Client.join.
The encryption password.
Set Live Transcoding
This method sets the video layout and audio for CDN live.
Transcoding settings, see LiveTranscoding for details.
Set the Low-video Stream Parameter
If you enabled the dual-stream mode by calling Client.enableDualStream, use this method to set the low-video stream profile.
If you do not set the low-video stream profile, the SDK will assign default values based on your stream video profile.
Note:
Sets the video profile of the low-video stream.
Bitrate of the low-video stream frame in Kbps.
Frame rate of the low-video stream frame in fps.
Height of the low-video stream frame. The width and height parameters are bound together, and take effect only when both are set. Otherwise, the SDK will assign default values.
Width of the low-video stream frame. The width and height parameters are bound together, and take effect only when both are set. Otherwise, the SDK will assign default values.
Deploy the Nginx Server
Use this method to deploy the Nginx server.
Note:
Your Nginx server domain name.
Set the Remote Video-stream Type
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-video stream.
The remote video stream object.
Sets the remote video stream type. The following lists the video-stream types:
Set 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-video stream or only the audio stream.
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:
Deploy the TURN Server
Use this method to deploy the TURN server.
Note:
Ensure that you call this API before Client.join.
The TURN server settings.
Sets whether to force data transfer by TURN Server:
Your TURN Server password.
The TCP port(s) you want add to TURN Server.
Your TURN Server URL address.
The UDP port(s) you want to add to TURN Server.
Your TURN Server username.
Start a Live Stream
This method starts a live stream.
URL address for the live stream.
Marks whether to enable live transcoding. If set as true
, setLiveTranscoding must be called before this method.
Stop Live Streaming
This method stops and deletes the live streaming.
URL address of the live streaming.
Subscribe to a Remote Stream
This method enables a user to subscribe to a remote stream.
Stream object, which represents the remote stream.
The callback when the method fails.
Unpublish the Local Stream
This method unpublishes the local stream.
Stream object, which represents the local stream.
The callback when the method fails.
Unsubscribe 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 Client object returned by the createClient method provides access to much of the core AgoraRTC functionality.