This topic describes the methods of the AliRtcEngine class provided by ApsaraVideo Real-time Communication (ARTC) SDK for HarmonyOS.
Contents
Basic APIs
|
API |
Description |
|
Returns an AliRtcEngine instance. |
|
|
Destroys the AliRtcEngine instance. |
|
|
Returns the current SDK version. |
|
|
Sets the H5 compatible mode. |
|
|
Returns the H5 compatible mode. |
|
|
Sets the listener for engine event callbacks. |
|
|
Returns the instance handle from the native layer. |
Channel APIs
|
API |
Description |
|
Sets the channel mode. |
|
|
Sets the user role in a live streaming scenario. |
|
|
Gets the current user role. |
|
|
Joins a channel. Users in the same channel can make calls with each other. |
|
|
Joins a channel. |
|
|
Joins a channel. |
|
|
Joins an AI channel. |
|
|
Leaves the channel and ends the call. |
|
|
Gets the current network connection status. |
|
|
Checks if the user is in a channel. |
|
|
Refreshes the authentication information. |
|
|
Refreshes the authentication information. |
|
|
Checks if the call is in audio-only mode. |
Publish and subscribe APIs
|
API |
Description |
|
Publishes or unpublishes the local camera stream. |
|
|
Checks if the local video stream is published. |
|
|
Publishes or unpublishes the secondary video stream. |
|
|
Checks if the secondary video stream is published. |
|
|
Publishes or unpublishes the local audio stream. |
|
|
Checks if the local audio stream is published. |
|
|
Publishes or unpublishes the secondary audio stream. |
|
|
Checks if the secondary audio stream is published. |
|
|
Sets whether to subscribe to all remote audio streams by default. |
|
|
Sets whether to subscribe to all remote video streams by default. |
|
|
Sets the subscribed camera stream type: high-quality stream or low-quality stream. |
|
|
Sets the default subscribed camera stream type: high-quality stream or low-quality stream. |
|
|
Stops or resumes subscribing to all remote audio streams. |
|
|
Stops or resumes subscribing to all remote secondary audio streams. |
|
|
Stops or resumes subscribing to all remote video streams. |
|
|
Stops or resumes subscribing to a remote user's microphone audio stream. |
|
|
Stops or resumes subscribing to a specific remote user's audio stream. |
|
|
Stops or resumes subscribing to a remote video stream. |
|
|
Stops or resumes subscribing to a remote media stream. |
|
|
Stops or resumes subscribing to a specific user's stream in a destination channel. |
Audio device management APIs
|
API |
Description |
|
Sets the audio profile. |
|
|
Sets the audio capability. |
|
|
Starts audio capture. |
|
|
Stops audio capture. |
|
|
Starts the audio player. |
|
|
Stops the audio player. |
|
|
Mutes or unmutes the local audio stream. |
|
|
Sets the recording volume. |
|
|
Sets the playback volume. |
|
|
Sets whether the speakerphone is the default audio output route. This behavior is enabled by default. |
|
|
Enables or disables the speakerphone for audio output. When disabled, audio is routed to the earpiece. |
|
|
Checks whether the speakerphone is enabled. |
|
|
Adjusts the local playback volume of a specified remote user. |
|
|
Mutes or unmutes the audio stream of a specified remote user. |
|
|
Mutes or unmutes all remote audio streams. |
|
|
Sets the frequency and smoothing factor for audio volume indication. |
|
|
Enables in-ear monitoring. |
|
|
Sets the in-ear monitoring volume. |
|
|
Starts an audio capture device test before a call. |
|
|
Stops the audio capture device test. |
|
|
Starts an audio file playback test. |
|
|
Stops the audio file playback test. |
Video device management APIs
|
API |
Description |
|
Sets the display view for the local preview. |
|
|
Starts the local video preview. |
|
|
Stops the local video preview. |
|
|
Sets the camera capture preferences. |
|
|
Enables or disables local video capture. |
|
|
Stops or resumes local camera capture. |
|
|
Stops or resumes sending the local video stream. |
|
|
Checks if the camera is on. |
|
|
Mutes or unmutes the rendering of all remote video tracks. |
|
|
Sets the video encoding properties for the camera stream. |
|
|
Sets the video decoding properties for the camera stream. |
|
|
Sets the mirroring mode for the local preview and published stream. |
|
|
Sets when video scaling occurs in the capture pipeline: either immediately after capture or during encoding. |
|
|
Sets the display view for a remote video stream. |
|
|
Switches between the front and rear cameras. |
|
|
Gets the current camera direction (front or rear). |
|
|
Sets the camera zoom factor. |
|
|
Gets the maximum camera zoom factor. |
|
|
Gets the current camera zoom factor. |
|
|
Sets the camera exposure. |
|
|
Gets the current camera exposure. |
|
|
Gets the minimum camera exposure. |
|
|
Gets the maximum camera exposure. |
|
|
Turns the camera flash on or off. |
|
|
Checks if the camera supports manual focus. |
|
|
Checks if the camera supports setting a custom exposure point. |
|
|
Sets the manual focus point for the camera. |
|
|
Sets the camera exposure point. |
|
|
Gets the video codec type. |
|
|
Gets the manufacturer of the currently used encoder. If stream publishing has not started, this method returns an invalid type. |
|
|
Takes a video snapshot. |
Screen sharing
|
API |
Description |
|
Configures the video encoding properties for the screen-sharing stream. |
|
|
Starts screen sharing. |
|
|
Stops screen sharing. |
|
|
Checks whether the screen-sharing stream is published. |
Configure audio data callback
|
API |
Description |
|
Registers an audio data callback. |
|
|
Enables the audio data callback. |
Custom audio input
|
API |
Description |
|
Adds an external audio stream. |
|
|
Pushes external audio data. |
|
|
Sets the playout volume for an external audio stream. |
|
|
Gets the playout volume for an external audio stream. |
|
|
Sets the publish volume for an external audio stream. |
|
|
Gets the publish volume for an external audio stream. |
|
|
Removes an external audio stream. |
Custom video input
|
API |
Description |
|
Enables the external video source. |
|
|
Pushes a video frame. |
|
|
Inputs image data to use as a video frame. |
Voice changer and reverb
|
API |
Description |
|
Sets the pitch value. |
|
|
Sets the voice changer mode. |
|
|
Sets the reverb mode. |
|
|
Sets the voice beautification mode. |
|
|
Sets the reverb effect type. |
|
|
Sets the equalizer parameters. |
Audio accompaniment
|
API |
Description |
|
Starts the audio accompaniment. |
|
|
Stops the audio accompaniment. |
|
|
Sets the volume of the audio accompaniment. |
|
|
Sets the publishing volume of the audio accompaniment. |
|
|
Gets the publishing volume of the audio accompaniment. |
|
|
Sets the local playback volume of the audio accompaniment. |
|
|
Gets the local playback volume of the audio accompaniment. |
|
|
Pauses the audio accompaniment. |
|
|
Resumes the audio accompaniment. |
|
|
Gets the duration of the audio accompaniment file in milliseconds. |
|
|
Gets the current playback position of the audio accompaniment file in milliseconds. |
|
|
Sets the playback position of the audio accompaniment file. |
Play audio effects
|
API |
Description |
|
Preloads an audio effect file. |
|
|
Unloads a preloaded audio effect file. |
|
|
Plays an audio effect. |
|
|
Pauses an audio effect. |
|
|
Pauses all audio effects. |
|
|
Resumes a specified audio effect. |
|
|
Resumes all audio effects. |
|
|
Stops an audio effect. |
|
|
Stops all audio effects. |
|
|
Sets the publishing volume of an audio effect. |
|
|
Gets the publishing volume of an audio effect. |
|
|
Sets the local playout volume of an audio effect. |
|
|
Gets the local playout volume of an audio effect. |
|
|
Sets the publishing volume for all audio effects. |
|
|
Sets the local playout volume for all audio effects. |
SEI
|
API |
Description |
|
Enables or disables the SEI video stream. When enabled, the SDK sends a 16x16 black frame at 20 fps. |
|
|
Sends a media extension message. |
|
|
Sends a media extension message. |
Data channel
|
API |
Description |
|
Sends a data message. |
File recording
|
API |
Description |
|
Starts file recording. |
|
|
Stops file recording. |
Server-side live streaming
|
API |
Description |
|
Starts server-side live streaming. |
|
|
Updates server-side live streaming parameters. |
|
|
Stops server-side live streaming. |
|
|
Gets the state of server-side live streaming. |
|
|
Updates server-side live streaming parameters by task ID. |
|
|
Stops server-side live streaming by task ID. |
|
|
Gets the state of server-side live streaming by task ID. |
Push and pull RTS raw streams
|
API |
Description |
|
Pushes a stream via an RTS URL. Currently, only one stream can be pushed at a time. |
|
|
Stops pushing the stream for the specified RTS URL. |
|
|
Subscribes to a stream from an RTS URL. Currently, only one stream can be subscribed to at a time. |
|
|
Stops the stream subscription for the specified RTS user ID. |
|
|
Pauses the subscription to an RTS stream for the specified RTS user ID. |
|
|
Resumes the subscription to an RTS stream for the specified RTS user ID. |
Last-mile network quality detection
|
API |
Description |
|
Starts last-mile network quality detection. |
|
|
Stops last-mile network quality detection. |
Other APIs
|
API |
Description |
|
Sets the storage path for SDK log files. |
|
|
Sets the log level. |
|
|
Toggles log file uploads. Enabled by default. |
|
|
Updates external input parameters with a JSON string. |
|
|
Sets a custom attribute with a JSON string. |
|
|
Gets a custom attribute. |
|
|
Toggles telemetry data uploads. Enabled by default. |
|
|
Gets the network time. |
Callbacks
|
API |
Description |
|
Occurs when a remote user in communication mode or a host in interactive mode joins the channel. |
|
|
Occurs when a remote user in communication mode or a host in interactive mode leaves the channel. |
|
|
Occurs when the local user successfully joins a channel. |
|
|
Occurs when the local user leaves the channel. |
|
|
Occurs when the network connection state changes. |
|
|
Occurs when the server removes the local user from the channel, or when the meeting ends. |
|
|
Occurs when the audio publishing state changes. |
|
|
Occurs when the video publishing state changes. |
|
|
Occurs when the screen sharing publishing state changes. |
|
|
Occurs when the publishing state of the secondary video stream changes. |
|
|
Occurs when the audio subscription state changes. |
|
|
Occurs when the camera stream subscription state changes. |
|
|
Occurs when the subscribed stream type of a dual stream changes. |
|
|
Occurs when the audio or video stream of a remote user becomes available or unavailable. |
|
|
Occurs when the first video frame from a remote user is rendered. |
|
|
Occurs when the first local video frame is rendered in the preview. |
|
|
Occurs when the first video packet is sent. |
|
|
Occurs when the first video packet from a remote user is received. |
|
|
Occurs when the first video frame from a remote user is received. |
|
|
Occurs when the video resolution changes. |
|
|
Occurs when the first audio packet is sent. |
|
|
Occurs when the first audio packet from a remote user is received. |
|
|
Occurs when the first audio frame from a remote user is decoded. |
|
|
Reports the volume of subscribed audio streams. |
|
|
Reports the volume during a pre-call audio capture device test. |
|
|
Reports the active speaker in the channel. |
|
|
Occurs when the local audio mixing state changes. |
|
|
Occurs when a local audio effect finishes playing. |
|
|
Reports changes in network quality. |
|
|
Reports the result of the last-mile network quality probe. |
|
|
Reports the bandwidth result of the last-mile network quality probe. |
|
|
Reports the statistics of the current session. |
|
|
Reports the statistics of the local video stream. |
|
|
Reports the statistics of a remote video stream. |
|
|
Reports the statistics of the local audio stream. |
|
|
Reports the statistics of a remote audio stream. |
|
|
Occurs when the state of CDN live streaming changes. |
|
|
Occurs when the state of a CDN live streaming task changes, identified by a task ID. |
|
|
Occurs when the status of a CDN live streaming task changes. |
|
|
Occurs when the status of a CDN live streaming task changes, identified by a task ID. |
|
|
Occurs when a remote user mutes or unmutes their audio. |
|
|
Occurs when a remote user starts or stops sending black frames. |
|
|
Occurs when a remote user enables or disables camera capture. |
|
|
Occurs when a user's role changes. |
|
|
Occurs when a remote user starts audio mixing. |
|
|
Occurs when a remote user finishes audio mixing. |
|
|
Occurs when a media extension message is received. |
|
|
Occurs when an exception is detected in a local device. |
|
|
Occurs when a message is received through the data channel. |
|
|
Occurs when a remote video stream changes. |
|
|
Occurs when the user's authentication information is about to expire. |
|
|
Occurs when an API call fails because the user's authentication has expired. |
|
|
Reports the processing result from an AI agent. |
|
|
Indicates that you can start sending data channel messages. |
|
|
Reports audio delay information. |
|
|
Occurs when the state of the local audio capture device changes. |
|
|
Occurs when the state of the local video capture device changes. |
|
|
Reports events related to file recording. |
|
|
Reports a warning. |
|
|
Reports an error. |
|
|
Reports the result of publishing a stream using an RTS URL. |
|
|
Reports the result of stopping publishing a stream using an RTS URL. |
|
|
Reports the result of subscribing to a stream using an RTS URL. |
|
|
Reports the result of unsubscribing from a stream using an RTS URL. |
|
|
Occurs when the number of pre-established RTS URL connections exceeds the limit. |
|
|
Reports the result of pausing a subscription to an RTS stream using the RTS user ID. |
|
|
Reports the result of resuming a subscription to an RTS stream using the RTS user ID. |
|
|
Provides the captured raw audio data. |
|
|
Provides the audio data after 3A processing. |
|
|
Provides the audio data for publishing. |
|
|
Provides the audio data for playback. |
|
|
Provides the mixed audio data from both publishing and playback. |
|
|
Provides the raw audio data from a subscribed remote user. |