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.
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.
Disables Dual Streams
This method disables dual streams.
The callback when the method succeeds.
The callback when the method fails.
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 will return the volumes every two seconds, regardless of whether there are active speakers.
Note:
Enables 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.
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.
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:
Some of the statistics are calculated after the stream-published
event, which may take at most 3 seconds.
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:
Some of the statistics are calculated after the stream-published
event, which may take at most 3 seconds.
The callback contains the statistics of the local video stream.
Gets the Statistics of the System Network
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.
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:
The statistics are calculated after the stream-subscribed
event, which may take at most 3 seconds.
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:
The statistics are calculated after the stream-subscribed
event, which may take at most 3 seconds.
The callback contains the statistics of the remote video stream.
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 statistics are calculated after the stream-published
event, which may take at most 3 seconds.
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. To get your App ID, see Get an App ID.
The callback when the method succeeds.
The callback when the method fails.
Joins 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. Supported character scopes are:
The user ID, a number or a string. Ensure this ID is unique. If you set the uid to null
, the server assigns one and returns it in the onSuccess
callback.
Note:
uid
.The callback when the method succeeds. The server returns the uid which represents the identity of the user.
The callback when the method fails.
Leaves 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 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.
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.
This callback notifies the application that the network type has changed.
This callback notifies the application that an audio input device has been added or removed.
This callback notifies the application that an audio output device has been added or removed.
This callback notifies the application that a camera has been added or removed.
This callback notifies the application that the type of a video stream has changed.
It happens when a high-video stream changes to a low-video stream, or vice versa.
The stream type (streamType):
Publishes 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.
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.
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 Encryption Mode
This method sets the encryption mode.
Note:
Ensure that you call this API before Client.join.
The encryption mode:
Enables Built-in Encryption
This method enables the built-in encryption.
Note:
Ensure that you call this API before Client.join.
The encryption password.
Sets Live Transcoding
This method sets the video layout and audio for CDN live.
Note:
Call setLiveTranscoding after createStream. For details, see Push Streams to the CDN.
Transcoding settings, see LiveTranscoding for details.
Sets 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.
Deploys the Nginx Server
Use this method to deploy the Nginx server.
Note:
Your Nginx server domain name.
Sets 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:
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-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:
Deploys 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.
Starts 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.
Stops Live Streaming
This method stops and deletes the live streaming.
URL address of the live streaming.
Subscribes 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.
Unpublishes the Local Stream
This method unpublishes the local stream.
Stream object, which represents the local stream.
The callback when the method fails.
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 Client object returned by the createClient method provides access to much of the core AgoraRTC functionality.