IRtcEngine
The basic interface of the Agora SDK that implements the core functions of real-time communication.
IRtcEngine provides the main methods that your app can call.
Before calling other APIs, you must call GetAgoraRtcEngine to create an IRtcEngine object.
AddVideoWatermark
Adds a watermark image to the local video.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int AddVideoWatermark(const FString& watermarkUrl, const FWatermarkOptions& options);
Details
This method adds a PNG watermark image to the local video in the live streaming. Once the watermark image is added, all the audience in the channel (CDN audience included), and the capturing device can see and capture it. The Agora SDK supports adding only one watermark image onto a local video or CDN live stream. The newly added watermark image replaces the previous one.
- If the orientation mode of the encoding video (EORIENTATION_MODE) is fixed landscape mode or the adaptive landscape mode, the watermark uses the landscape orientation.
- If the orientation mode of the encoding video (EORIENTATION_MODE) is fixed portrait mode or the adaptive portrait mode, the watermark uses the portrait orientation.
- When setting the watermark position, the region must be less than the dimensions set in the SetVideoEncoderConfiguration method; otherwise, the watermark image will be cropped.
- Ensure that calling this method after EnableVideo.
- If you only want to add a watermark to the media push, you can call this method or the StartRtmpStreamWithTranscoding method.
- This method supports adding a watermark image in the PNG file format only. Supported pixel formats of the PNG image are RGBA, RGB, Palette, Gray, and Alpha_gray.
- If the dimensions of the PNG image differ from your settings in this method, the image will be cropped or zoomed to conform to your settings.
- If you have enabled the mirror mode for the local video, the watermark on the local video is also mirrored. To avoid mirroring the watermark, Agora recommends that you do not use the mirror and watermark functions for the local video at the same time. You can implement the watermark function in your application layer.
Parameters
- watermarkUrl
- The local file path of the watermark image to be added. This method supports adding a watermark image from the local absolute or relative file path.
- options
- The options of the watermark image to be added. See FWatermarkOptions.
Returns
- 0: Success.
- < 0: Failure.
AdjustAudioMixingPlayoutVolume
Adjusts the volume of audio mixing for local playback.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int AdjustAudioMixingPlayoutVolume(int volume);
Call timing
You need to call this method after calling StartAudioMixing and receiving the OnAudioMixingStateChanged(AUDIO_MIXING_STATE_PLAYING)
callback.
Restrictions
None.
Parameters
- volume
- The volume of audio mixing for local playback. The value ranges between 0 and 100 (default). 100 represents the original volume.
Returns
- 0: Success.
- < 0: Failure.
AdjustAudioMixingPublishVolume
Adjusts the volume of audio mixing for publishing.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int AdjustAudioMixingPublishVolume(int volume);
This method adjusts the volume of audio mixing for publishing (sending to other users).
Call timing
Call this method after calling StartAudioMixing and receiving the OnAudioMixingStateChanged(AUDIO_MIXING_STATE_PLAYING)
callback.
Restrictions
None.
Parameters
- volume
- The volume of audio mixing for local playback. The value ranges between 0 and 100 (default). 100 represents the original volume.
Returns
- 0: Success.
- < 0: Failure.
AdjustAudioMixingVolume
Adjusts the volume during audio mixing.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int AdjustAudioMixingVolume(int volume);
This method adjusts the audio mixing volume on both the local client and remote clients.
Call timing
Call this method after StartAudioMixing.
Restrictions
None.
Parameters
- volume
- Audio mixing volume. The value ranges between 0 and 100. The default value is 100, which means the original volume.
Returns
- 0: Success.
- < 0: Failure.
AdjustLoopbackSignalVolume
Adjusts the volume of the signal captured by the sound card.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int AdjustLoopbackSignalVolume(int volume);
Details
After calling EnableLoopbackRecording to enable loopback audio capturing, you can call this method to adjust the volume of the signal captured by the sound card.
Parameters
- volume
- Audio mixing volume. The value ranges between 0 and 100. The default value is 100, which means the original volume.
Returns
- 0: Success.
- < 0: Failure.
AdjustPlaybackSignalVolume
Adjusts the playback signal volume of all remote users.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int AdjustPlaybackSignalVolume(int volume);
This method is used to adjust the signal volume of all remote users mixed and played locally. If you need to adjust the signal volume of a specified remote user played locally, it is recommended that you call AdjustUserPlaybackSignalVolume instead.
Call timing
This method can be called either before or after joining the channel.
Restrictions
None.
Parameters
- volume
-
The volume of the user. The value range is [0,400].
- 0: Mute.
- 100: (Default) The original volume.
- 400: Four times the original volume (amplifying the audio signals by four times).
Returns
- 0: Success.
- < 0: Failure.
AdjustRecordingSignalVolume
Adjusts the capturing signal volume.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int AdjustRecordingSignalVolume(int volume);
If you only need to mute the audio signal, Agora recommends that you use MuteRecordingSignal instead.
Call timing
This method can be called either before or after joining the channel.
Restrictions
None.
Parameters
- volume
-
The volume of the user. The value range is [0,400].
- 0: Mute.
- 100: (Default) The original volume.
- 400: Four times the original volume (amplifying the audio signals by four times).
Returns
- 0: Success.
- < 0: Failure.
AdjustUserPlaybackSignalVolume
Adjusts the playback signal volume of a specified remote user.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int AdjustUserPlaybackSignalVolume(int64 uid, int volume);
You can call this method to adjust the playback volume of a specified remote user. To adjust the playback volume of different remote users, call the method as many times, once for each remote user.
Call timing
Call this method after joining a channel.
Restrictions
None.
Parameters
- uid
- The user ID of the remote user.
- volume
-
The volume of the user. The value range is [0,400].
- 0: Mute.
- 100: (Default) The original volume.
- 400: Four times the original volume (amplifying the audio signals by four times).
Returns
- 0: Success.
- < 0: Failure.
ClearVideoWatermarks
Removes the watermark image from the video stream.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int ClearVideoWatermarks();
Returns
- 0: Success.
- < 0: Failure.
Complain
Allows a user to complain about the call quality after a call ends.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int Complain(const FString& callId, const FString& description);
Details
This method allows users to complain about the quality of the call. Call this method after the user leaves the channel.
Parameters
- callId
- The current call ID. You can get the call ID by calling GetCallId.
- description
- (Optional) A description of the call. The string length should be less than 800 bytes.
Returns
- 0: Success.
- < 0: Failure.
- -1: A general error occurs (no specified reason).
- -2: The parameter is invalid.
- -7: The method is called before IRtcEngine is initialized.
ConfigRhythmPlayer
Configures the virtual metronome.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int ConfigRhythmPlayer(const FAgoraRhythmPlayerConfig& config);
- After calling StartRhythmPlayer, you can call this method to reconfigure the virtual metronome.
- After enabling the virtual metronome, the SDK plays the specified audio effect file from the beginning, and controls the playback duration of each file according to beatsPerMinute you set in FAgoraRhythmPlayerConfig. For example, if you set beatsPerMinute as
60
, the SDK plays one beat every second. If the file duration exceeds the beat duration, the SDK only plays the audio within the beat duration. - By default, the sound of the virtual metronome is published in the channel. If you want the sound to be heard by the remote users, you can set publishRhythmPlayerTrack in FChannelMediaOptions as
true
.
Call timing
This method can be called either before or after joining the channel.
Restrictions
None.
Parameters
- config
- The metronome configuration. See FAgoraRhythmPlayerConfig.
Returns
- 0: Success.
- < 0: Failure.
GetAgoraRtcEngine
Creates one IRtcEngine object.
UFUNCTION(BlueprintPure, Category = "Agora|IRtcEngine")
static UAgoraBPuRtcEngine* GetAgoraRtcEngine();
Details
Currently, the Agora RTC SDK v4.x supports creating only one IRtcEngine object for each app.
Returns
Pointer to the IRtcEngine object.
Initialize
Initializes IRtcEngine.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int Initialize(const FRtcEngineContext& context);
Call timing
Before calling other APIs, you must call GetAgoraRtcEngine and Initialize to create and initialize the IRtcEngine object.
Restrictions
The SDK supports creating only one IRtcEngine instance for an app.
Parameters
- context
-
Configurations for the IRtcEngine instance. See FRtcEngineContext.
Returns
- 0: Success.
- < 0: Failure.
- -1: A general error occurs (no specified reason).
- -2: The parameter is invalid.
- -7: The SDK is not initialized.
- -22: The resource request failed. The SDK fails to allocate resources because your app consumes too much system resource or the system resources are insufficient.
- -101: The App ID is invalid.
CreateDataStream
Creates a data stream.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int CreateDataStream(int& streamId, const FDataStreamConfig& config);
Call timing
You can call this method either before or after joining a channel.
Restrictions
Each user can create up to five data streams during the lifecycle of IRtcEngine. The data stream will be destroyed when leaving the channel, and the data stream needs to be recreated if needed.
Parameters
- streamId
- An output parameter; the ID of the data stream created.
- config
- The configurations for the data stream. See FDataStreamConfig.
Returns
- 0: The data stream is successfully created.
- < 0: Failure.
GetAgoraMediaPlayer
Creates a media player object.
UFUNCTION(BlueprintPure, Category = "Agora|IAgoraMediaPlayer")
static UAgoraBPuMediaPlayer* GetAgoraMediaPlayer();
Before calling any APIs in the IMediaPlayer class, you need to call this method to create an instance of the media player. If you need to create multiple instances, you can call this method multiple times.
Call timing
You can call this method either before or after joining a channel.
Restrictions
None.
Returns
- An IMediaPlayer object, if the method call succeeds.
- An empty pointer, if the method call fails.
Release
Destroys the media player instance.
UFUNCTION(BlueprintCallable, Category = "Agora|IAgoraMediaPlayer")
void Release();
DisableAudio
Disables the audio module.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int DisableAudio();
The audio module is enabled by default, and you can call this method to disable the audio module.
Call timing
This method can be called either before or after joining the channel. It is still valid after one leaves channel.
Restrictions
- EnableLocalAudio: Whether to enable the microphone to create the local audio stream.
- EnableLoopbackRecording: Whether to enable loopback audio capturing.
- MuteLocalAudioStream: Whether to publish the local audio stream.
- MuteRemoteAudioStream: Whether to subscribe and play the remote audio stream.
- MuteAllRemoteAudioStreams: Whether to subscribe to and play all remote audio streams.
Returns
- 0: Success.
- < 0: Failure.
DisableVideo
Disables the video module.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int DisableVideo();
This method is used to disable the video module.
Call timing
- If it is called before joining the channel, the audio-only mode is enabled.
- If it is called after joining the channel, it switches from video mode to audio-only mode. Then, calling EnableVideo can swithch to video mode again.
Restrictions
- This method affects the internal engine and can be called after leaving the channel.
- Calling this method will reset the entire engine, resulting in a slow response time. You can use the following methods to independently control a specific function of the video module based on your actual needs:
- EnableLocalVideo: Whether to enable the camera to create the local video stream.
- MuteLocalVideoStream: Whether to publish the local video stream.
- MuteRemoteVideoStream: Whether to subscribe to and play the remote video stream.
- MuteAllRemoteVideoStreams: Whether to subscribe to and play all remote video streams.
Returns
- 0: Success.
- < 0: Failure.
EnableAudio
Enables the audio module.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int EnableAudio();
The audio module is enabled by default After calling DisableAudio to disable the audio module, you can call this method to re-enable it.
Call timing
This method can be called either before or after joining the channel. It is still valid after one leaves channel.
Restrictions
- Calling this method will reset the entire engine, resulting in a slow response time. You can use the following methods to independently control a specific function of the audio module based on your actual needs:
- EnableLocalAudio: Whether to enable the microphone to create the local audio stream.
- MuteLocalAudioStream: Whether to publish the local audio stream.
- MuteRemoteAudioStream: Whether to subscribe and play the remote audio stream.
- MuteAllRemoteAudioStreams: Whether to subscribe to and play all remote audio streams.
- A successful call of this method resets EnableLocalAudio, MuteRemoteAudioStream, and MuteAllRemoteAudioStreams. Proceed it with caution.
Returns
- 0: Success.
- < 0: Failure.
EnableAudioVolumeIndication
Enables the reporting of users' volume indication.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int EnableAudioVolumeIndication(int interval, int smooth, bool reportVad);
This method enables the SDK to regularly report the volume information to the app of the local user who sends a stream and remote users (three users at most) whose instantaneous volumes are the highest.
Call timing
This method can be called either before or after joining the channel.
Restrictions
None.
Parameters
- interval
- Sets the time interval between two consecutive volume indications:
- ≤ 0: Disables the volume indication.
- > 0: Time interval (ms) between two consecutive volume indications. Ensure this parameter is set to a value greater than 10, otherwise you will not receive the OnAudioVolumeIndication callback. Agora recommends that this value is set as greater than 100.
- smooth
- The smoothing factor that sets the sensitivity of the audio volume indicator. The value ranges between 0 and 10. The recommended value is 3. The greater the value, the more sensitive the indicator.
- reportVad
-
true
: Enables the voice activity detection of the local user. Once it is enabled, the vad parameter of the OnAudioVolumeIndication callback reports the voice activity status of the local user.false
: (Default) Disables the voice activity detection of the local user. Once it is disabled, the vad parameter of the OnAudioVolumeIndication callback does not report the voice activity status of the local user, except for the scenario where the engine automatically detects the voice activity of the local user.
Returns
- 0: Success.
- < 0: Failure.
EnableCameraCenterStage
Enables or disables portrait center stage.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int EnableCameraCenterStage(bool enabled);
The portrait center stage feature is off by default. You need to call this method to turn it on. If you need to disable this feature, you need to call this method again and set enabled to false
.
Applicable scenarios
The portrait center stage feature can be widely used in scenarios such as online meetings, shows, online education, etc. The host can use this feature to ensure that they are always in the center of the screen, whether they move or not, in order to achieve a good display effect.
Call timing
This method must be called after the camera is successfully enabled, that is, after the SDK triggers the OnLocalVideoStateChanged callback and returns the local video state as LOCAL_VIDEO_STREAM_STATE_CAPTURING (1).
Restrictions
- iPad:
- 12.9-inch iPad Pro (5th generation)
- 11-inch iPad Pro (3rd generation)
- iPad (9th generation)
- iPad mini (6th generation)
- iPad Air (5th generation)
- 2020 M1 MacBook Pro 13-inch + iPhone 11 (using iPhone as external camera for the MacBook)
Agora recommends that you call IsCameraCenterStageSupported to check whether the current device supports portrait center stage before enabling this feature.
Parameters
- enabled
- Whether to enable the portrait center stage:
true
: Enable portrait center stage.false
: Disable portrait center stage.
Returns
- 0: Success.
- < 0: Failure.
EnableContentInspect
Enables or disables video screenshot and upload.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int EnableContentInspect(bool enabled, const FContentInspectConfig& config);
When video screenshot and upload function is enabled, the SDK takes screenshots and uploads videos sent by local users based on the type and frequency of the module you set in FContentInspectConfig. After video screenshot and upload, the Agora server sends the callback notification to your app server in HTTPS requests and sends all screenshots to the third-party cloud storage service.
Call timing
This method can be called either before or after joining the channel.
Restrictions
Before calling this method, ensure that you have contacted technical support to activate the video screenshot upload service.
Parameters
- enabled
- Whether to enalbe video screenshot and upload:
true
: Enables video screenshot and upload.false
: Disables video screenshot and upload.
- config
- Screenshot and upload configuration. See FContentInspectConfig.Note: When the video moderation module is set to video moderation via Agora self-developed extension(CONTENT_INSPECT_SUPERVISION), the video screenshot and upload dynamic library
libagora_content_inspect_extension.dll
is required. Deleting this library disables the screenshot and upload feature.
Returns
- 0: Success.
- < 0: Failure.
EnableDualStreamMode
Sets the dual-stream mode on the sender side and the low-quality video stream.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int EnableDualStreamMode(bool enabled, const FSimulcastStreamConfig& streamConfig);
Details
- Deprecated:
- This method is deprecated as of v4.2.0. Use SetDualStreamMode instead.
- High-quality video stream: High bitrate, high resolution.
- Low-quality video stream: Low bitrate, low resolution.
After you enable dual-stream mode, you can call SetRemoteVideoStreamType to choose to receive either the high-quality video stream or the low-quality video stream on the subscriber side.
- This method is applicable to all types of streams from the sender, including but not limited to video streams collected from cameras, screen sharing streams, and custom-collected video streams.
- If you need to enable dual video streams in a multi-channel scenario, you can call the EnableDualStreamModeEx method.
- You can call this method either before or after joining a channel.
Parameters
- enabled
-
Whether to enable dual-stream mode:
true
: Enable dual-stream mode.false
: (Default) Disable dual-stream mode.
- streamConfig
-
The configuration of the low-quality video stream. See FSimulcastStreamConfig.Note: When setting mode to DISABLE_SIMULCAST_STREAM, setting streamConfig will not take effect.
Returns
- 0: Success.
- < 0: Failure.
EnableEncryption
Enables or disables the built-in encryption.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int EnableEncryption(bool enabled, const FEncryptionConfig& config);
After the user leaves the channel, the SDK automatically disables the built-in encryption. To enable the built-in encryption, call this method before the user joins the channel again.
Applicable scenarios
Scenarios with higher security requirements.
Call timing
Call this method before joining a channel.
Restrictions
- All users within the same channel must set the same encryption configurations when calling this method.
- If you enable the built-in encryption, you cannot use the Media Push function.
Parameters
- enabled
-
Whether to enable built-in encryption:
- true: Enable the built-in encryption.
- false: (Default) Disable the built-in encryption.
- config
- Built-in encryption configurations. See FEncryptionConfig.
Returns
- 0: Success.
- < 0: Failure.
- -2: An invalid parameter is used. Set the parameter with a valid value.
- -4: The built-in encryption mode is incorrect or the SDK fails to load the external encryption library. Check the enumeration or reload the external encryption library.
- -7: The SDK is not initialized. Initialize the IRtcEngine instance before calling this method.
EnableExtension
Enables or disables extensions.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int EnableExtension(const FString& provider, const FString& extension, bool enable = true, EMEDIA_SOURCE_TYPE type = EMEDIA_SOURCE_TYPE::UNKNOWN_MEDIA_SOURCE);
Call timing
Agora recommends that you call this method after joining a channel.
Restrictions
- If you want to enable multiple extensions, you need to call this method multiple times.
- After a successful call of this method, you cannot load other extensions.
Parameters
- provider
- The name of the extension provider.
- extension
- The name of the extension.
- enable
-
Whether to enable the extension:
true
: Enable the extension.false
: Disable the extension.
- type
- Source type of the extension. See EMEDIA_SOURCE_TYPE.
Returns
- 0: Success.
- < 0: Failure.
- -3: The extension library is not loaded. Agora recommends that you check the storage location or the name of the dynamic library.
EnableFaceDetection
Enables or disables face detection for the local user.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int EnableFaceDetection(bool enabled);
Call timing
This method needs to be called after the camera is started (for example, by calling StartPreview or EnableVideo).
Restrictions
None.
Parameters
- enabled
- Whether to enable face detection for the local user:
true
: Enable face detection.false
: (Default) Disable face detection.
Returns
- 0: Success.
- < 0: Failure.
EnableInEarMonitoring
Enables in-ear monitoring.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int EnableInEarMonitoring(bool enabled, int includeAudioFilters);
This method enables or disables in-ear monitoring.
Call timing
This method can be called either before or after joining the channel.
Restrictions
Users must use earphones (wired or Bluetooth) to hear the in-ear monitoring effect.
Parameters
- enabled
- Enables or disables in-ear monitoring.
true
: Enables in-ear monitoring.false
: (Default) Disables in-ear monitoring.
- includeAudioFilters
- The audio filter types of in-ear monitoring:
- EAR_MONITORING_FILTER_NONE(1 << 0): No audio filter added to in-ear monitoring.
- EAR_MONITORING_FILTER_BUILT_IN_AUDIO_FILTERS(1 << 1): Add vocal effects audio filter to in-ear monitoring. If you implement functions such as voice beautifier and audio effect, users can hear the voice after adding these effects. This enumerator supports combination using the bitwise OR operator (|).
- EAR_MONITORING_FILTER_NOISE_SUPPRESSION(1 << 2): Add noise suppression audio filter to in-ear monitoring. This enumerator supports combination using the bitwise OR operator (|).
- EAR_MONITORING_FILTER_REUSE_POST_PROCESSING_FILTER(1 <<15): Reuse the audio filter that has been processed on the sending end for in-ear monitoring. This enumerator reduces CPU usage while increasing in-ear monitoring latency, which is suitable for latency-tolerant scenarios requiring low CPU consumption. This enumerator is only supported for standalone use. Once selected, other audio filter configurations will be automatically disabled.
Attention: This parameter only takes effect when enabled is set astrue
.
Returns
- 0: Success.
- < 0: Failure.
- - 8: Make sure the current audio routing is Bluetooth or headset.
EnableInstantMediaRendering
Enables audio and video frame instant rendering.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int EnableInstantMediaRendering();
After successfully calling this method, the SDK enables the instant frame rendering mode, which can speed up the first frame rendering after the user joins the channel.
Applicable scenarios
Agora recommends that you enable this mode for the audience in a live streaming scenario.
Call timing
Agora recommends that you call this method before joining a channel.
Restrictions
Once the method is successfully called, you can only cancel instant rendering by calling Release to destroy the IRtcEngine object.
Returns
- 0: Success.
- < 0: Failure.
- -7: The method is called before IRtcEngine is initialized.
EnableLocalAudio
Enables or disables the local audio capture.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int EnableLocalAudio(bool enabled);
The audio function is enabled by default when users joining a channel. This method disables or re-enables the local audio function to stop or restart local audio capturing.
- EnableLocalAudio: Disables or re-enables the local audio capturing and processing. If you disable or re-enable local audio capturing using the EnableLocalAudio method, the local user might hear a pause in the remote audio playback.
- MuteLocalAudioStream: Sends or stops sending the local audio streams without affecting the audio capture status.
Applicable scenarios
This method does not affect receiving the remote audio streams, and EnableLocalAudio(false)
is applicable to scenarios where the user wants to receive remote audio streams without sending any audio stream to other users in the channel.
Call timing
You can call this method either before or after joining a channel. Calling it before joining a channel only sets the device state, and it takes effect immediately after you join the channel.
Restrictions
None.
Parameters
- enabled
-
true
: (Default) Re-enable the local audio function, that is, to start the local audio capturing device (for example, the microphone).false
: Disable the local audio function, that is, to stop local audio capturing.
Returns
- 0: Success.
- < 0: Failure.
EnableLocalVideo
Enables/Disables the local video capture.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int EnableLocalVideo(bool enabled);
Details
This method disables or re-enables the local video capture, and does not affect receiving the remote video stream.
After calling EnableVideo, the local video capture is enabled by default.
If you call EnableLocalVideo(false
) to disable local video capture within the channel, it also simultaneously stops publishing the video stream within the channel. If you want to restart video catpure, you can call EnableLocalVideo(true
) and then call UpdateChannelMediaOptions to set the options parameter to publish the locally captured video stream in the channel.
After the local video capturer is successfully disabled or re-enabled, the SDK triggers the OnRemoteVideoStateChanged callback on the remote client.
- You can call this method either before or after joining a channel.
- This method enables the internal engine and is valid after leaving the channel.
Parameters
- enabled
-
Whether to enable the local video capture.
true
: (Default) Enable the local video capture.false
: Disable the local video capture. Once the local video is disabled, the remote users cannot receive the video stream of the local user, while the local user can still receive the video streams of remote users. When set tofalse
, this method does not require a local camera.
Returns
- 0: Success.
- < 0: Failure.
EnableLoopbackRecording
Enables loopback audio capturing.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int EnableLoopbackRecording(bool enabled, const FString & deviceName);
Details
If you enable loopback audio capturing, the output of the sound card is mixed into the audio stream sent to the other end.
- This method applies to the macOS and Windows only.
- macOS does not support loopback audio capture of the default sound card. If you need to use this function, use a virtual sound card and pass its name to the deviceName parameter. Agora recommends using AgoraALD as the virtual sound card for audio capturing.
- You can call this method either before or after joining a channel.
- If you call the DisableAudio method to disable the audio module, audio capturing will be disabled as well. If you need to enable audio capturing, call the EnableAudio method to enable the audio module and then call the EnableLoopbackRecording method.
Parameters
- enabled
- Sets whether to enable loopback audio capturing.
true
: Enable loopback audio capturing.false
: (Default) Disable loopback audio capturing.
- deviceName
-
- macOS: The device name of the virtual sound card. The default value is set to NULL, which means using AgoraALD for loopback audio capturing.
- Windows: The device name of the sound card. The default is set to NULL, which means the SDK uses the sound card of your device for loopback audio capturing.
Returns
- 0: Success.
- < 0: Failure.
EnableMultiCamera
Enables or disables multi-camera capture.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int EnableMultiCamera(bool enabled, const FCameraCapturerConfiguration& config);
Details
- Call this method to enable multi-channel camera capture.
- Call StartPreview to start the local video preview.
- Call StartCameraCapture, and set sourceType to start video capture with the second camera.
- Call JoinChannelEx, and set publishSecondaryCameraTrack to
true
to publish the video stream captured by the second camera in the channel.
- Call StopCameraCapture.
- Call this method with enabled set to
false
.
- If it is enabled before StartPreview, the local video preview shows the image captured by the two cameras at the same time.
- If it is enabled after StartPreview, the SDK stops the current camera capture first, and then enables the primary camera and the second camera. The local video preview appears black for a short time, and then automatically returns to normal.
This method applies to iOS only.
When using this function, ensure that the system version is 13.0 or later.
- iPhone XR
- iPhone XS
- iPhone XS Max
- iPad Pro 3rd generation and later
Parameters
- enabled
- Whether to enable multi-camera video capture mode:
true
: Enable multi-camera capture mode; the SDK uses multiple cameras to capture video.false
: Disable multi-camera capture mode; the SDK uses a single camera to capture video.
- config
- Capture configuration for the second camera. See FCameraCapturerConfiguration.
Returns
- 0: Success.
- < 0: Failure.
EnableSoundPositionIndication
Enables or disables stereo panning for remote users.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int EnableSoundPositionIndication(bool enabled);
Details
Ensure that you call this method before joining a channel to enable stereo panning for remote users so that the local user can track the position of a remote user by calling SetRemoteVoicePosition.
Parameters
- enabled
- Whether to enable stereo panning for remote users:
true
: Enable stereo panning.false
: Disable stereo panning.
Returns
- 0: Success.
- < 0: Failure.
EnableVideo
Enables the video module.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int EnableVideo();
The video module is disabled by default, call this method to enable it. If you need to disable the video module later, you need to call DisableVideo.
Call timing
- If called before joining a channel, it enables the video module.
- If called during an audio-only call, the audio call automatically switches to a video call.
Restrictions
- This method enables the internal engine and is valid after leaving the channel.
- Calling this method will reset the entire engine, resulting in a slow response time. You can use the following methods to independently control a specific function of the video module based on your actual needs:
- EnableLocalVideo: Whether to enable the camera to create the local video stream.
- MuteLocalVideoStream: Whether to publish the local video stream.
- MuteRemoteVideoStream: Whether to subscribe to and play the remote video stream.
- MuteAllRemoteVideoStreams: Whether to subscribe to and play all remote video streams.
- A successful call of this method resets EnableLocalVideo, MuteRemoteVideoStream, and MuteAllRemoteVideoStreams. Proceed it with caution.
Returns
- 0: Success.
- < 0: Failure.
EnableVideoImageSource
Sets whether to replace the current video feeds with images when publishing video streams.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int EnableVideoImageSource(bool enable, const FImageTrackOptions& options);
When publishing video streams, you can call this method to replace the current video feeds with custom images.
Once you enable this function, you can select images to replace the video feeds through the FImageTrackOptions parameter. If you disable this function, the remote users see the video feeds that you publish.
Call timing
Call this method after joining a channel.
Restrictions
None.
Parameters
- enable
- Whether to replace the current video feeds with custom images:
true
: Replace the current video feeds with custom images.false
: (Default) Do not replace the current video feeds with custom images.
- options
- Image configurations. See FImageTrackOptions.
Returns
- 0: Success.
- < 0: Failure.
EnableVirtualBackground
Enables/Disables the virtual background.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int EnableVirtualBackground(bool enabled, FVirtualBackgroundSource backgroundSource, FSegmentationProperty segproperty, EMEDIA_SOURCE_TYPE type);
Details
The virtual background feature enables the local user to replace their original background with a static image, dynamic video, blurred background, or portrait-background segmentation to achieve picture-in-picture effect. Once the virtual background feature is enabled, all users in the channel can see the custom background.
Call this method after calling EnableVideo or StartPreview.
- This feature has high requirements on device performance. When calling this method, the SDK automatically checks the capabilities of the current device. Agora recommends you use virtual background on devices with the following processors:
- Snapdragon 700 series 750G and later
- Snapdragon 800 series 835 and later
- Dimensity 700 series 720 and later
- Kirin 800 series 810 and later
- Kirin 900 series 980 and later
- Devices with an i5 CPU and better
- Devices with an A9 chip and better, as follows:
- iPhone 6S and later
- iPad Air 3rd generation and later
- iPad 5th generation and later
- iPad Pro 1st generation and later
- iPad mini 5th generation and later
- Agora recommends that you use this feature in scenarios that meet the following conditions:
- A high-definition camera device is used, and the environment is uniformly lit.
- There are few objects in the captured video. Portraits are half-length and unobstructed. Ensure that the background is a solid color that is different from the color of the user's clothing.
- This method relies on the virtual background dynamic library
libagora_segmentation_extension.dll
. If the dynamic library is deleted, the function cannot be enabled normally.
Parameters
- enabled
- Whether to enable virtual background:
true
: Enable virtual background.false
: Disable virtual background.
- backgroundSource
- The custom background. See FVirtualBackgroundSource. To adapt the resolution of the custom background image to that of the video captured by the SDK, the SDK scales and crops the custom background image while ensuring that the content of the custom background image is not distorted.
- segproperty
- Processing properties for background images. See FSegmentationProperty.
- type
- The type of the video source. See EMEDIA_SOURCE_TYPE.Attention: In this method, this parameter supports only the following two settings:
- The default value is PRIMARY_CAMERA_SOURCE.
- If you want to use the second camera to capture video, set this parameter to SECONDARY_CAMERA_SOURCE.
Returns
- 0: Success.
- < 0: Failure.
- -4: The device capabilities do not meet the requirements for the virtual background feature. Agora recommends you try it on devices with higher performance.
EnableVoiceAITuner
Enables or disables the voice AI tuner.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int EnableVoiceAITuner(bool enabled, EVOICE_AI_TUNER_TYPE type);
The voice AI tuner supports enhancing sound quality and adjusting tone style.
Applicable scenarios
Social entertainment scenes including online KTV, online podcast and live streaming in showrooms, where high sound quality is required.
Call timing
This method can be called either before or after joining the channel.
Restrictions
None.
Parameters
- enabled
- Whether to enable the voice AI tuner:
true
: Enables the voice AI tuner.false
: (Default) Disable the voice AI tuner.
- type
- Voice AI tuner sound types, see EVOICE_AI_TUNER_TYPE.
Returns
- 0: Success.
- < 0: Failure.
EnableWebSdkInteroperability
Enables interoperability with the Agora Web SDK (applicable only in the live streaming scenarios).
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int EnableWebSdkInteroperability(bool enabled);
Details
- Deprecated:
- The SDK automatically enables interoperability with the Web SDK, so you no longer need to call this method.
You can call this method to enable or disable interoperability with the Agora Web SDK. If a channel has Web SDK users, ensure that you call this method, or the video of the Native user will be a black screen for the Web user.
This method is only applicable in live streaming scenarios, and interoperability is enabled by default in communication scenarios.
Parameters
- enabled
- Whether to enable interoperability:
true
: Enable interoperability.false
: (Default) Disable interoperability.
Returns
- 0: Success.
- < 0: Failure.
GetAudioDeviceInfo
Gets the audio device information.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int GetAudioDeviceInfo(FDeviceInfo& deviceInfo);
Details
After calling this method, you can get whether the audio device supports ultra-low-latency capture and playback.
- This method is for Android only.
- You can call this method either before or after joining a channel.
Parameters
- deviceInfo
- Input and output parameter. A FDeviceInfo object that identifies the audio device information.
- Input value: A FDeviceInfo object.
- Output value: A FDeviceInfo object containing audio device information.
Returns
- 0: Success.
- < 0: Failure.
GetAgoraAudioDeviceManager
Gets the IAudioDeviceManager object to manage audio devices.
UFUNCTION(BlueprintPure, Category = "Agora|IAudioDeviceManager")
static UAgoraBPuAudioDeviceManager* GetAgoraAudioDeviceManager();
Returns
One IAudioDeviceManager object.
GetAudioMixingCurrentPosition
Retrieves the playback position (ms) of the music file.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int GetAudioMixingCurrentPosition();
Details
Retrieves the playback position (ms) of the audio.
- You need to call this method after calling StartAudioMixing and receiving the OnAudioMixingStateChanged
(AUDIO_MIXING_STATE_PLAYING)
callback. - If you need to call GetAudioMixingCurrentPosition multiple times, ensure that the time interval between calling this method is more than 500 ms.
Returns
- ≥ 0: The current playback position (ms) of the audio mixing, if this method call succeeds. 0 represents that the current music file does not start playing.
- < 0: Failure.
GetAudioMixingDuration
Retrieves the duration (ms) of the music file.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int GetAudioMixingDuration();
Retrieves the total duration (ms) of the audio.
Call timing
Call this method after StartAudioMixing and receiving the OnAudioMixingStateChanged(AUDIO_MIXING_STATE_PLAYING)
callback.
Restrictions
None.
Returns
- ≥ 0: The audio mixing duration, if this method call succeeds.
- < 0: Failure.
GetAudioMixingPlayoutVolume
Retrieves the audio mixing volume for local playback.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int GetAudioMixingPlayoutVolume();
You can call this method to get the local playback volume of the mixed audio file, which helps in troubleshooting volume‑related issues.
Call timing
Call this method after StartAudioMixing and receiving the OnAudioMixingStateChanged(AUDIO_MIXING_STATE_PLAYING)
callback.
Restrictions
None.
Returns
- ≥ 0: The audio mixing volume, if this method call succeeds. The value range is [0,100].
- < 0: Failure.
GetAudioMixingPublishVolume
Retrieves the audio mixing volume for publishing.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int GetAudioMixingPublishVolume();
Details
This method helps troubleshoot audio volume‑related issues.
(AUDIO_MIXING_STATE_PLAYING)
callback.Returns
- ≥ 0: The audio mixing volume, if this method call succeeds. The value range is [0,100].
- < 0: Failure.
GetAudioTrackCount
Gets the index of audio tracks of the current music file.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int GetAudioTrackCount();
Details
- You need to call this method after calling StartAudioMixing and receiving the OnAudioMixingStateChanged
(AUDIO_MIXING_STATE_PLAYING)
callback.
Returns
- The SDK returns the index of the audio tracks if the method call succeeds.
- < 0: Failure.
GetCallId
Retrieves the call ID.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int GetCallId(FString& callId);
When a user joins a channel on a client, a callId is generated to identify the call from the client. You can call this method to get the callId parameter, and pass it in when calling methods such as Rate and Complain.
Call timing
Call this method after joining a channel.
Restrictions
None.
Parameters
- callId
- Output parameter, the current call ID.
Returns
- 0: Success.
- < 0: Failure.
GetCameraMaxZoomFactor
Gets the maximum zoom ratio supported by the camera.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
float GetCameraMaxZoomFactor();
Details
- This method is for Android and iOS only.
- This method must be called after the SDK triggers the OnLocalVideoStateChanged callback and returns the local video state as LOCAL_VIDEO_STREAM_STATE_ENCODING (2).
Returns
The maximum zoom factor.
GetConnectionState
Gets the current connection state of the SDK.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
ECONNECTION_STATE_TYPE GetConnectionState();
Call timing
This method can be called either before or after joining the channel.
Restrictions
None.
Returns
The current connection state. See ECONNECTION_STATE_TYPE.
GetEffectCurrentPosition
Retrieves the playback position of the audio effect file.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int GetEffectCurrentPosition(int soundId);
Details
Parameters
- soundId
- The audio effect ID. The ID of each audio effect file is unique.
Returns
- The playback position (ms) of the specified audio effect file, if the method call succeeds.
- < 0: Failure.
GetEffectDuration
Retrieves the duration of the audio effect file.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int GetEffectDuration(const FString& filePath);
Details
Parameters
- filePath
- File path:
- Android: The file path, which needs to be accurate to the file name and suffix. Agora supports URL addresses, absolute paths, or file paths that start with
/assets/
. You might encounter permission issues if you use an absolute path to access a local file, so Agora recommends using a URI address instead. For example: content://com.android.providers.media.documents/document/audio%3A14441
- Windows: The absolute path or URL address (including the suffixes of the filename) of the audio effect file. For example
: C:\music\audio.mp4
.
- Android: The file path, which needs to be accurate to the file name and suffix. Agora supports URL addresses, absolute paths, or file paths that start with
Returns
- The total duration (ms) of the specified audio effect file, if the method call succeeds.
- < 0: Failure.
GetEffectsVolume
Retrieves the volume of the audio effects.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int GetEffectsVolume();
Details
The volume is an integer ranging from 0 to 100. The default value is 100, which means the original volume.
Returns
- Volume of the audio effects, if this method call succeeds.
- < 0: Failure.
GetErrorDescription
Gets the warning or error description.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
FString GetErrorDescription(int code);
Parameters
- code
- The error code or warning code reported by the SDK.
Returns
The specific error or warning description.
GetExtensionProperty
Gets detailed information on the extensions.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int GetExtensionProperty(const FString& provider, const FString& extension,const FExtensionInfo & ExtensionInfo, const FString& key, FString& value);
Call timing
This method can be called either before or after joining the channel.
Restrictions
None.
Parameters
- provider
- An output parameter. The name of the extension provider.
- extension
- An output parameter. The name of the extension.
- key
- An output parameter. The key of the extension.
- value
- An output parameter. The value of the extension key.
- type
- Source type of the extension. See EMEDIA_SOURCE_TYPE.
- buf_len
- Maximum length of the JSON string indicating the extension property. The maximum value is 512 bytes.
Returns
- 0: Success.
- < 0: Failure.
GetNetworkType
Gets the type of the local network connection.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int GetNetworkType();
Details
You can use this method to get the type of network in use at any stage.
Returns
- ≥ 0: The method call is successful, and the local network connection type is returned.
- 0: The SDK disconnects from the network.
- 1: The network type is LAN.
- 2: The network type is Wi-Fi (including hotspots).
- 3: The network type is mobile 2G.
- 4: The network type is mobile 3G.
- 5: The network type is mobile 4G.
- 6: The network type is mobile 5G.
- < 0: The method call failed with an error code.
- -1: The network type is unknown.
GetNtpWallTimeInMs
Gets the current NTP (Network Time Protocol) time.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
FString GetNtpWallTimeInMs();
Details
In the real-time chorus scenario, especially when the downlink connections are inconsistent due to network issues among multiple receiving ends, you can call this method to obtain the current NTP time as the reference time, in order to align the lyrics and music of multiple receiving ends and achieve chorus synchronization.
Returns
The Unix timestamp (ms) of the current NTP time.
GetScreenCaptureSources
Gets a list of shareable screens and windows.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
UIScreenCaptureSourceList* GetScreenCaptureSources(const FSIZE & thumbSize, const FSIZE & iconSize, bool includeScreen);
Details
You can call this method before sharing a screen or window to get a list of shareable screens and windows, which enables a user to use thumbnails in the list to easily choose a particular screen or window to share. This list also contains important information such as window ID and screen ID, with which you can call StartScreenCaptureByWindowId or StartScreenCaptureByDisplayId to start the sharing.
Parameters
- thumbSize
- The target size of the screen or window thumbnail (the width and height are in pixels). See SIZE. The SDK scales the original image to make the length of the longest side of the image the same as that of the target size without distorting the original image. For example, if the original image is 400 Ă— 300 and thumbSize is 100 Ă— 100, the actual size of the thumbnail is 100 Ă— 75. If the target size is larger than the original size, the thumbnail is the original image and the SDK does not scale it.
- iconSize
- The target size of the icon corresponding to the application program (the width and height are in pixels). See SIZE. The SDK scales the original image to make the length of the longest side of the image the same as that of the target size without distorting the original image. For example, if the original image is 400 Ă— 300 and iconSize is 100 Ă— 100, the actual size of the icon is 100 Ă— 75. If the target size is larger than the original size, the icon is the original image and the SDK does not scale it.
- includeScreen
- Whether the SDK returns the screen information in addition to the window information:
true
: The SDK returns screen and window information.false
: The SDK returns window information only.
Returns
GetUserInfoByUid
Gets the user information by passing in the user ID.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int GetUserInfoByUid(int64 uid, FUserInfo& userInfo);
After a remote user joins the channel, the SDK gets the UID and user account of the remote user, caches them in a mapping table object, and triggers the OnUserInfoUpdated callback on the local client. After receiving the callback, you can call this method and passi in the UID.to get the user account of the specified user from the FUserInfo object.
Call timing
Call this method after receiving the OnUserInfoUpdated callback.
Restrictions
None.
Parameters
- uid
- The user ID.
- userInfo
- Input and output parameter. The FUserInfo object that identifies the user information.
- Input value: A FUserInfo object.
- Output: A FUserInfo object that contains both the user account and UID.
- channelId
- The channel name. This parameter signifies the channel in which users engage in real-time audio and video interaction. Under the premise of the same App ID, users who fill in the same channel ID enter the same channel for audio and video interaction. The string length must be less than 64 bytes. Supported characters (89 characters in total):
- All lowercase English letters: a to z.
- All uppercase English letters: A to Z.
- All numeric characters: 0 to 9.
- "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", "{", "}", "|", "~", ","
- localUserAccount
- The user account of the local user.
Returns
- 0: Success.
- < 0: Failure.
GetUserInfoByUserAccount
Gets the user information by passing in the user account.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int GetUserInfoByUserAccount(const FString& userAccount, FUserInfo& userInfo);
After a remote user joins the channel, the SDK gets the UID and user account of the remote user, caches them in a mapping table object, and triggers the OnUserInfoUpdated callback on the local client. After receiving the callback, you can call this method and pass in the user account to get the UID of the remote user from the FUserInfo object.
Call timing
Call this method after receiving the OnUserInfoUpdated callback.
Restrictions
None.
Parameters
- userAccount
- The user account.
- userInfo
- Input and output parameter. The FUserInfo object that identifies the user information.
- Input value: A FUserInfo object.
- Output: A FUserInfo object that contains both the user account and UID.
- channelId
- The channel name. This parameter signifies the channel in which users engage in real-time audio and video interaction. Under the premise of the same App ID, users who fill in the same channel ID enter the same channel for audio and video interaction. The string length must be less than 64 bytes. Supported characters (89 characters in total):
- All lowercase English letters: a to z.
- All uppercase English letters: A to Z.
- All numeric characters: 0 to 9.
- "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", "{", "}", "|", "~", ","
- localUserAccount
- The user account of the local user.
Returns
- 0: Success.
- < 0: Failure.
GetVersion
Gets the SDK version.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
FString GetVersion();
Parameters
- build
- The SDK build index.
Returns
The SDK version number. The format is a string.
GetAgoraVideoDeviceManager
Gets the IVideoDeviceManager object to manage video devices.
UFUNCTION(BlueprintPure, Category = "Agora|IVideoDeviceManager")
static UAgoraBPuVideoDeviceManager* GetAgoraVideoDeviceManager();
Returns
One IVideoDeviceManager object.
GetVolumeOfEffect
Gets the volume of a specified audio effect file.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int GetVolumeOfEffect(int soundId);
Parameters
- soundId
- The ID of the audio effect file.
Returns
- ≥ 0: Returns the volume of the specified audio effect, if the method call is successful. The value ranges between 0 and 100. 100 represents the original volume.
- < 0: Failure.
IsCameraAutoExposureFaceModeSupported
Checks whether the device supports auto exposure.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
bool IsCameraAutoExposureFaceModeSupported();
Details
- This method applies to iOS only.
- This method must be called after the SDK triggers the OnLocalVideoStateChanged callback and returns the local video state as LOCAL_VIDEO_STREAM_STATE_ENCODING (2).
Returns
true
: The device supports auto exposure.false
: The device does not support auto exposure.
IsCameraAutoFocusFaceModeSupported
Checks whether the device supports the face auto-focus function.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
bool IsCameraAutoFocusFaceModeSupported();
Details
- This method is for Android and iOS only.
- This method must be called after the SDK triggers the OnLocalVideoStateChanged callback and returns the local video state as LOCAL_VIDEO_STREAM_STATE_ENCODING (2).
Returns
true
: The device supports the face auto-focus function.false
: The device does not support the face auto-focus function.
IsCameraCenterStageSupported
Check if the camera supports portrait center stage.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
bool IsCameraCenterStageSupported();
Before calling EnableCameraCenterStage to enable portrait center stage, it is recommended to call this method to check if the current device supports the feature.
Call timing
This method must be called after the camera is successfully enabled, that is, after the SDK triggers the OnLocalVideoStateChanged callback and returns the local video state as LOCAL_VIDEO_STREAM_STATE_CAPTURING (1).
Restrictions
None.
Returns
true
: The current camera supports the portrait center stage.false
: The current camera supports the portrait center stage.
IsCameraExposurePositionSupported
Checks whether the device supports manual exposure.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
bool IsCameraExposurePositionSupported();
Details
- This method is for Android and iOS only.
- This method must be called after the SDK triggers the OnLocalVideoStateChanged callback and returns the local video state as LOCAL_VIDEO_STREAM_STATE_ENCODING (2).
Returns
true
: The device supports manual exposure.false
: The device does not support manual exposure.
IsCameraExposureSupported
Queries whether the current camera supports adjusting exposure value.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
bool IsCameraExposureSupported();
Details
- This method is for Android and iOS only.
- This method must be called after the SDK triggers the OnLocalVideoStateChanged callback and returns the local video state as LOCAL_VIDEO_STREAM_STATE_ENCODING (2).
- Before calling SetCameraExposureFactor, Agora recoomends that you call this method to query whether the current camera supports adjusting the exposure value.
- By calling this method, you adjust the exposure value of the currently active camera, that is, the camera specified when calling SetCameraCapturerConfiguration.
Returns
true
: Success.false
: Failure.
IsCameraFaceDetectSupported
Checks whether the device camera supports face detection.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
bool IsCameraFaceDetectSupported();
- This method is for Android and iOS only.
- This method must be called after the SDK triggers the OnLocalVideoStateChanged callback and returns the local video state as LOCAL_VIDEO_STREAM_STATE_ENCODING (2).
Returns
true
: The device camera supports face detection.false
: The device camera does not support face detection.
IsCameraFocusSupported
Check whether the device supports the manual focus function.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
bool IsCameraFocusSupported();
Details
- This method is for Android and iOS only.
- This method must be called after the SDK triggers the OnLocalVideoStateChanged callback and returns the local video state as LOCAL_VIDEO_STREAM_STATE_ENCODING (2).
Returns
true
: The device supports the manual focus function.false
: The device does not support the manual focus function.
IsCameraTorchSupported
Checks whether the device supports camera flash.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
bool IsCameraTorchSupported();
Details
- This method is for Android and iOS only.
- This method must be called after the SDK triggers the OnLocalVideoStateChanged callback and returns the local video state as LOCAL_VIDEO_STREAM_STATE_ENCODING (2).
- The app enables the front camera by default. If your front camera does not support flash, this method returns false. If you want to check whether the rear camera supports the flash function, call SwitchCamera before this method.
- On iPads with system version 15, even if IsCameraTorchSupported returns
true
, you might fail to successfully enable the flash by calling SetCameraTorchOn due to system issues.
Returns
true
: The device supports camera flash.false
: The device does not support camera flash.
IsCameraZoomSupported
Checks whether the device supports camera zoom.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
bool IsCameraZoomSupported();
Call timing
This method must be called after the SDK triggers the OnLocalVideoStateChanged callback and returns the local video state as LOCAL_VIDEO_STREAM_STATE_ENCODING (2).
Restrictions
None.
Returns
true
: The device supports camera zoom.false
: The device does not support camera zoom.
IsFeatureAvailableOnDevice
Checks whether the device supports the specified advanced feature.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
bool IsFeatureAvailableOnDevice(EFeatureType type);
Details
Checks whether the capabilities of the current device meet the requirements for advanced features such as virtual background and image enhancement.
Applicable scenarios
Before using advanced features, you can check whether the current device supports these features based on the call result. This helps to avoid performance degradation or unavailable features when enabling advanced features on low-end devices. Based on the return value of this method, you can decide whether to display or enable the corresponding feature button, or notify the user when the device's capabilities are insufficient.
Parameters
- type
- The type of the advanced feature, see EFeatureType.
Returns
true
: The current device supports the specified feature.false
: The current device does not support the specified feature.
IsSpeakerphoneEnabled
Checks whether the speakerphone is enabled.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
bool IsSpeakerphoneEnabled();
Call timing
You can call this method either before or after joining a channel.
Restrictions
None.
Returns
true
: The speakerphone is enabled, and the audio plays from the speakerphone.false
: The speakerphone is not enabled, and the audio plays from devices other than the speakerphone. For example, the headset or earpiece.
JoinChannel
Joins a channel.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int JoinChannel(const FString & token, const FString& channelId, int64 uid);
By default, the user subscribes to the audio and video streams of all the other users in the channel, giving rise to usage and billings. To stop subscribing to a specified stream or all remote streams, call the corresponding mute methods.
Call timing
Call this method after Initialize.
Restrictions
- This method only supports users joining one channel at a time.
- Users with different App IDs cannot call each other.
- Before joining a channel, ensure that the App ID you use to generate a token is the same as that you pass in the Initialize method; otherwise, you may fail to join the channel with the token.
Parameters
- token
- The token generated on your server for authentication. See .Note:
- (Recommended) If your project has enabled the security mode (using APP ID and Token for authentication), this parameter is required.
- If you have only enabled the testing mode (using APP ID for authentication), this parameter is optional. You will automatically exit the channel 24 hours after successfully joining in.
- If you need to join different channels at the same time or switch between channels, Agora recommends using a wildcard token so that you don't need to apply for a new token every time joining a channel. See Secure authentication with tokens.
- channelId
-
The channel name. This parameter signifies the channel in which users engage in real-time audio and video interaction. Under the premise of the same App ID, users who fill in the same channel ID enter the same channel for audio and video interaction. The string length must be less than 64 bytes. Supported characters (89 characters in total):
- All lowercase English letters: a to z.
- All uppercase English letters: A to Z.
- All numeric characters: 0 to 9.
- "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", "{", "}", "|", "~", ","
- info
- (Optional) Reserved for future use.
- uid
- The user ID. This parameter is used to identify the user in the channel for real-time audio and video interaction. You need to set and manage user IDs yourself, and ensure that each user ID in the same channel is unique. This parameter is a 32-bit unsigned integer. The value range is 1 to 232-1. If the user ID is not assigned (or set to 0), the SDK assigns a random user ID and OnJoinChannelSuccess returns it in the callback. Your application must record and maintain the returned user ID, because the SDK does not do so.
Returns
- 0: Success.
- < 0: Failure.
- -2: The parameter is invalid. For example, the token is invalid, the uid parameter is not set to an integer, or the value of a member in FChannelMediaOptions is invalid. You need to pass in a valid parameter and join the channel again.
- -3: Fails to initialize the IRtcEngine object. You need to reinitialize the IRtcEngine object.
- -7: The IRtcEngine object has not been initialized. You need to initialize the IRtcEngine object before calling this method.
- -8: The internal state of the IRtcEngine object is wrong. The typical cause is that after calling StartEchoTest to start a call loop test, you call this method to join the channel without calling StopEchoTest to stop the test. You need to call StopEchoTest before calling this method.
- -17: The request to join the channel is rejected. The typical cause is that the user is already in the channel. Agora recommends that you use the OnConnectionStateChanged callback to see whether the user is in the channel. Do not call this method to join the channel unless you receive the CONNECTION_STATE_DISCONNECTED(1) state.
- -102: The channel name is invalid. You need to pass in a valid channel name in channelId to rejoin the channel.
- -121: The user ID is invalid. You need to pass in a valid user ID in uid to rejoin the channel.
JoinChannelWithOptions
Joins a channel with media options.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int JoinChannelWithOptions(const FString& token, const FString& channelId, int64 uid, const FChannelMediaOptions& options);
This method supports setting the media options when joining a channel, such as whether to publish audio and video streams within the channel. or whether to automatically subscribe to the audio and video streams of all remote users when joining a channel. By default, the user subscribes to the audio and video streams of all the other users in the channel, giving rise to usage and billings. To stop subscribing to other streams, set the options parameter or call the corresponding mute methods.
Call timing
Call this method after Initialize.
Restrictions
- This method only supports users joining one channel at a time.
- Users with different App IDs cannot call each other.
- Before joining a channel, ensure that the App ID you use to generate a token is the same as that you pass in the Initialize method; otherwise, you may fail to join the channel with the token.
Parameters
- token
- The token generated on your server for authentication. See .Note:
- (Recommended) If your project has enabled the security mode (using APP ID and Token for authentication), this parameter is required.
- If you have only enabled the testing mode (using APP ID for authentication), this parameter is optional. You will automatically exit the channel 24 hours after successfully joining in.
- If you need to join different channels at the same time or switch between channels, Agora recommends using a wildcard token so that you don't need to apply for a new token every time joining a channel. See Secure authentication with tokens.
- channelId
-
The channel name. This parameter signifies the channel in which users engage in real-time audio and video interaction. Under the premise of the same App ID, users who fill in the same channel ID enter the same channel for audio and video interaction. The string length must be less than 64 bytes. Supported characters (89 characters in total):
- All lowercase English letters: a to z.
- All uppercase English letters: A to Z.
- All numeric characters: 0 to 9.
- "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", "{", "}", "|", "~", ","
- uid
- The user ID. This parameter is used to identify the user in the channel for real-time audio and video interaction. You need to set and manage user IDs yourself, and ensure that each user ID in the same channel is unique. This parameter is a 32-bit unsigned integer. The value range is 1 to 232-1. If the user ID is not assigned (or set to 0), the SDK assigns a random user ID and OnJoinChannelSuccess returns it in the callback. Your application must record and maintain the returned user ID, because the SDK does not do so.
- options
- The channel media options. See FChannelMediaOptions.
Returns
- 0: Success.
- < 0: Failure.
- -2: The parameter is invalid. For example, the token is invalid, the uid parameter is not set to an integer, or the value of a member in FChannelMediaOptions is invalid. You need to pass in a valid parameter and join the channel again.
- -3: Fails to initialize the IRtcEngine object. You need to reinitialize the IRtcEngine object.
- -7: The IRtcEngine object has not been initialized. You need to initialize the IRtcEngine object before calling this method.
- -8: The internal state of the IRtcEngine object is wrong. The typical cause is that after calling StartEchoTest to start a call loop test, you call this method to join the channel without calling StopEchoTest to stop the test. You need to call StopEchoTest before calling this method.
- -17: The request to join the channel is rejected. The typical cause is that the user is already in the channel. Agora recommends that you use the OnConnectionStateChanged callback to see whether the user is in the channel. Do not call this method to join the channel unless you receive the CONNECTION_STATE_DISCONNECTED(1) state.
- -102: The channel name is invalid. You need to pass in a valid channel name in channelId to rejoin the channel.
- -121: The user ID is invalid. You need to pass in a valid user ID in uid to rejoin the channel.
JoinChannelWithUserAccount
Join a channel using a user account and token, and set the media options.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int JoinChannelWithUserAccount(const FString& token, const FString& channelId, const FString& userAccount, const FChannelMediaOptions& options);
Before calling this method, if you have not called RegisterLocalUserAccount to register a user account, when you call this method to join a channel, the SDK automatically creates a user account for you. Calling the RegisterLocalUserAccount method to register a user account, and then calling this method to join a channel can shorten the time it takes to enter the channel.
Once a user joins the channel, the user subscribes to the audio and video streams of all the other users in the channel by default, giving rise to usage and billings. To stop subscribing to a specified stream or all remote streams, call the corresponding mute methods.
Call timing
Call this method after Initialize.
Restrictions
- This method only supports users joining one channel at a time.
- Users with different App IDs cannot call each other.
- Before joining a channel, ensure that the App ID you use to generate a token is the same as that you pass in the Initialize method; otherwise, you may fail to join the channel with the token.
Parameters
- token
- The token generated on your server for authentication. See .Note:
- (Recommended) If your project has enabled the security mode (using APP ID and Token for authentication), this parameter is required.
- If you have only enabled the testing mode (using APP ID for authentication), this parameter is optional. You will automatically exit the channel 24 hours after successfully joining in.
- If you need to join different channels at the same time or switch between channels, Agora recommends using a wildcard token so that you don't need to apply for a new token every time joining a channel. See Secure authentication with tokens.
- channelId
-
The channel name. This parameter signifies the channel in which users engage in real-time audio and video interaction. Under the premise of the same App ID, users who fill in the same channel ID enter the same channel for audio and video interaction. The string length must be less than 64 bytes. Supported characters (89 characters in total):
- All lowercase English letters: a to z.
- All uppercase English letters: A to Z.
- All numeric characters: 0 to 9.
- "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", "{", "}", "|", "~", ","
- userAccount
-
The user account. This parameter is used to identify the user in the channel for real-time audio and video engagement. You need to set and manage user accounts yourself and ensure that each user account in the same channel is unique. The maximum length of this parameter is 255 bytes. Ensure that you set this parameter and do not set it as NULL. Supported characters are as follows(89 in total):
- The 26 lowercase English letters: a to z.
- The 26 uppercase English letters: A to Z.
- All numeric characters: 0 to 9.
- Space
- "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", "{", "}", "|", "~", ","
- options
- The channel media options. See FChannelMediaOptions.
Returns
- 0: Success.
- < 0: Failure.
- -2: The parameter is invalid. For example, the token is invalid, the uid parameter is not set to an integer, or the value of a member in FChannelMediaOptions is invalid. You need to pass in a valid parameter and join the channel again.
- -3: Fails to initialize the IRtcEngine object. You need to reinitialize the IRtcEngine object.
- -7: The IRtcEngine object has not been initialized. You need to initialize the IRtcEngine object before calling this method.
- -8: The internal state of the IRtcEngine object is wrong. The typical cause is that after calling StartEchoTest to start a call loop test, you call this method to join the channel without calling StopEchoTest to stop the test. You need to call StopEchoTest before calling this method.
- -17: The request to join the channel is rejected. The typical cause is that the user is already in the channel. Agora recommends that you use the OnConnectionStateChanged callback to see whether the user is in the channel. Do not call this method to join the channel unless you receive the CONNECTION_STATE_DISCONNECTED(1) state.
- -102: The channel name is invalid. You need to pass in a valid channel name in channelId to rejoin the channel.
- -121: The user ID is invalid. You need to pass in a valid user ID in uid to rejoin the channel.
LeaveChannel
Leaves a channel.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int LeaveChannel();
After calling this method, the SDK terminates the audio and video interaction, leaves the current channel, and releases all resources related to the session.
After joining the channel, you must call this method to end the call; otherwise, the next call cannot be started.
- This method call is asynchronous. When this method returns, it does not necessarily mean that the user has left the channel.
- If you have called JoinChannelEx to join multiple channels, calling this method will leave all the channels you joined.
Call timing
Call this method after joining a channel.
Restrictions
If you call Release immediately after calling this method, the SDK does not trigger the OnLeaveChannel callback.
Returns
- 0: Success.
- < 0: Failure.
- -1: A general error occurs (no specified reason).
- -2: The parameter is invalid.
- -7: The SDK is not initialized.
LeaveChannelWithOptions
Sets channel options and leaves the channel.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int LeaveChannelWithOptions(const FLeaveChannelOptions& options);
After calling this method, the SDK terminates the audio and video interaction, leaves the current channel, and releases all resources related to the session.
After joining the channel, you must call this method to end the call; otherwise, the next call cannot be started. If you have called JoinChannelEx to join multiple channels, calling this method will leave all the channels you joined.
Call timing
Call this method after joining a channel.
Restrictions
If you call Release immediately after calling this method, the SDK does not trigger the OnLeaveChannel callback.
Parameters
- options
- The options for leaving the channel. See FLeaveChannelOptions.
Returns
- 0: Success.
- < 0: Failure.
LoadExtensionProvider
Loads an extension.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int LoadExtensionProvider(const FString& path, bool unload_after_use);
This method is used to add extensions external to the SDK (such as those from Extensions Marketplace and SDK extensions) to the SDK.
Call timing
Make sure the IRtcEngine is initialized before you call this method.
Restrictions
If you want to load multiple extensions, you need to call this method multiple times.
Parameters
- path
- The extension library path and name. For example:
/library/libagora_segmentation_extension.dll
. - unload_after_use
- Whether to uninstall the current extension when you no longer using it:
true
: Uninstall the extension when the IRtcEngine is destroyed.false
: (Rcommended) Do not uninstall the extension until the process terminates.
Returns
- 0: Success.
- < 0: Failure.
MuteAllRemoteAudioStreams
Stops or resumes subscribing to the audio streams of all remote users.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int MuteAllRemoteAudioStreams(bool mute);
After successfully calling this method, the local user stops or resumes subscribing to the audio streams of all remote users, including all subsequent users.
By default, the SDK subscribes to the audio streams of all remote users when joining a channel. To modify this behavior, you can set autoSubscribeAudio to false
when calling JoinChannelWithOptions to join the channel, which will cancel the subscription to the audio streams of all users upon joining the channel.
Call timing
Call this method after joining a channel.
Restrictions
If you call this method and then call EnableAudio or DisableAudio, the latest call will prevail.
Parameters
- mute
-
Whether to stop subscribing to the audio streams of all remote users:
true
: Stops subscribing to the audio streams of all remote users.false
: (Default) Subscribes to the audio streams of all remote users by default.
Returns
- 0: Success.
- < 0: Failure.
MuteAllRemoteVideoStreams
Stops or resumes subscribing to the video streams of all remote users.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int MuteAllRemoteVideoStreams(bool mute);
After successfully calling this method, the local user stops or resumes subscribing to the video streams of all remote users, including all subsequent users.
By default, the SDK subscribes to the video streams of all remote users when joining a channel. To modify this behavior, you can set autoSubscribeVideo tofalse
when calling JoinChannelWithOptions to join the channel, which will cancel the subscription to the video streams of all users upon joining the channel.
Call timing
Call this method after joining a channel.
Restrictions
If you call this method and then call EnableVideo or DisableVideo, the latest call will prevail.
Parameters
- mute
-
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) Subscribe to the video streams of all remote users by default.
Returns
- 0: Success.
- < 0: Failure.
MuteLocalAudioStream
Stops or resumes publishing the local audio stream.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int MuteLocalAudioStream(bool mute);
This method is used to control whether to publish the locally captured audio stream. If you call this method to stop publishing locally captured audio streams, the audio capturing device will still work and won't be affected.
Call timing
This method can be called either before or after joining the channel.
Restrictions
None.
Parameters
- mute
-
Whether to stop publishing the local audio stream:
true
: Stops publishing the local audio stream.false
: (Default) Resumes publishing the local audio stream.
Returns
- 0: Success.
- < 0: Failure.
MuteLocalVideoStream
Stops or resumes publishing the local video stream.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int MuteLocalVideoStream(bool mute);
This method is used to control whether to publish the locally captured video stream. If you call this method to stop publishing locally captured video streams, the video capturing device will still work and won't be affected.
Compared to EnableLocalVideo(false
), which can also cancel the publishing of local video stream by turning off the local video stream capture, this method responds faster.
Call timing
This method can be called either before or after joining the channel.
Restrictions
None.
Parameters
- mute
-
Whether to stop publishing the local video stream.
true
: Stop publishing the local video stream.false
: (Default) Publish the local video stream.
Returns
- 0: Success.
- < 0: Failure.
MuteRecordingSignal
Whether to mute the recording signal.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int MuteRecordingSignal(bool mute);
true
, the SDK behaves as follows:- Records the adjusted volume.
- Mutes the recording signal.
false
, the recording signal volume will be restored to the volume recorded by the SDK before muting.Call timing
This method can be called either before or after joining the channel.
Restrictions
None.
Parameters
- mute
-
true
: Mute the recording signal.false
: (Default) Do not mute the recording signal.
Returns
- 0: Success.
- < 0: Failure.
MuteRemoteAudioStream
Stops or resumes subscribing to the audio stream of a specified user.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int MuteRemoteAudioStream(int64 uid, bool mute);
Call timing
Call this method after joining a channel.
Restrictions
None.
Parameters
- uid
- The user ID of the specified user.
- mute
-
Whether to subscribe to the specified remote user's audio stream.
true
: Stop subscribing to the audio stream of the specified user.false
: (Default) Subscribe to the audio stream of the specified user.
Returns
- 0: Success.
- < 0: Failure.
MuteRemoteVideoStream
Stops or resumes subscribing to the video stream of a specified user.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int MuteRemoteVideoStream(int64 uid, bool mute);
Call timing
Call this method after joining a channel.
Restrictions
None.
Parameters
- userId
- The user ID of the specified user.
- mute
-
Whether to subscribe to the specified remote user's video stream.
true
: Stop subscribing to the video streams of the specified user.false
: (Default) Subscribe to the video stream of the specified user.
Returns
- 0: Success.
- < 0: Failure.
OnAudioMixingPositionChanged
Reports the playback progress of a music file.
UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event")
void OnAudioMixingPositionChanged(int64 position);
Details
After you called the StartAudioMixing method to play a music file, the SDK triggers this callback every two seconds to report the playback progress.
Parameters
- position
- The playback progress (ms).
Returns
- 0: Success.
- < 0: Failure.
OnChannelMediaRelayStateChanged
Occurs when the state of the media stream relay changes.
UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event")
void OnChannelMediaRelayStateChanged(int state, int code);
The SDK returns the state of the current media relay with any error message.
Parameters
- state
-
The state code:
- RELAY_STATE_IDLE(0): The SDK is initializing.
- RELAY_STATE_CONNECTING(1): The SDK tries to relay the media stream to the destination channel.
- RELAY_STATE_RUNNING(2): The SDK successfully relays the media stream to the destination channel.
- RELAY_STATE_FAILURE(3): An error occurs. See code for the error code.
- code
-
The error code of the channel media relay.
- RELAY_OK(0): Everything is normal.
- RELAY_ERROR_SERVER_ERROR_RESPONSE(1): An error occurs in the server response.
- RELAY_ERROR_SERVER_NO_RESPONSE(2): No server response. This error may be caused by poor network connections. If this error occurs when initiating a channel media relay, you can try again later; if this error occurs during channel media relay, you can call LeaveChannelWithOptions to leave the channel. This error can also occur if the channel media relay service is not enabled in the project. You can contact technical support to enable the service.
- RELAY_ERROR_NO_RESOURCE_AVAILABLE(3): The SDK fails to access the service, probably due to limited resources of the server.
- RELAY_ERROR_FAILED_JOIN_SRC4: The server fails to send the relay request.
- RELAY_ERROR_FAILED_JOIN_DEST5: The server fails to accept the relay request.
- RELAY_ERROR_FAILED_PACKET_RECEIVED_FROM_SRC6: The server fails to receive the media stream.
- RELAY_ERROR_FAILED_PACKET_SENT_TO_DEST7: The server fails to send the media stream.
- RELAY_ERROR_SERVER_CONNECTION_LOST(8): The SDK disconnects from the server due to poor network connections. You can call LeaveChannelWithOptions to leave the channel.
- RELAY_ERROR_INTERNAL_ERROR(9): An internal error occurs in the server.
- RELAY_ERROR_SRC_TOKEN_EXPIRED(10): The token of the source channel has expired.
- RELAY_ERROR_DEST_TOKEN_EXPIRED(11): The token of the destination channel has expired.
OnVideoRenderingTracingResult
Video frame rendering event callback.
UFUNCTION(BlueprintNativeEvent, Category = "Agora|Event")
void OnVideoRenderingTracingResult(int64 uid, EMEDIA_TRACE_EVENT currentEvent, const FVideoRenderingTracingInfo& tracingInfo);
After calling the StartMediaRenderingTracing method or joining the channel, the SDK triggers this callback to report the events of video frame rendering and the indicators during the rendering process. Developers can optimize the indicators to improve the efficiency of the first video frame rendering.
Parameters
- connection
- The connection information. See FRtcConnection.
- uid
- The user ID.
- currentEvent
- The current video frame rendering event. See EMEDIA_TRACE_EVENT.
- tracingInfo
- The indicators during the video frame rendering process. Developers need to reduce the value of indicators as much as possible in order to improve the efficiency of the first video frame rendering. See FVideoRenderingTracingInfo.
PauseAllChannelMediaRelay
Pauses the media stream relay to all target channels.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int PauseAllChannelMediaRelay();
Details
After the cross-channel media stream relay starts, you can call this method to pause relaying media streams to all target channels; after the pause, if you want to resume the relay, call ResumeAllChannelMediaRelay.
Returns
- 0: Success.
- < 0: Failure.
- -5: The method call was rejected. There is no ongoing channel media relay.
PauseAllEffects
Pauses all audio effects.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int PauseAllEffects();
Returns
- 0: Success.
- < 0: Failure.
PauseAudioMixing
Pauses playing and mixing the music file.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int PauseAudioMixing();
After calling StartAudioMixing to play a music file, you can call this method to pause the playing. If you need to stop the playback, call StopAudioMixing.
Call timing
Call this method after joining a channel.
Restrictions
None.
Returns
- 0: Success.
- < 0: Failure.
PauseEffect
Pauses a specified audio effect file.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int PauseEffect(int soundId);
Parameters
- soundId
- The audio effect ID. The ID of each audio effect file is unique.
Returns
- 0: Success.
- < 0: Failure.
PlayAllEffects
Plays all audio effect files.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int PlayAllEffects(int loopCount, float pitch, float pan, int gain, bool publish);
Details
After calling PreloadEffect multiple times to preload multiple audio effects into the memory, you can call this method to play all the specified audio effects for all users in the channel.
Parameters
- loopCount
- The number of times the audio effect loops:
- -1: Play the audio effect files in an indefinite loop until you call StopEffect or StopAllEffects.
- 0: Play the audio effect once.
- 1: Play the audio effect twice.
- pitch
-
The pitch of the audio effect. The value ranges between 0.5 and 2.0. The default value is 1.0 (original pitch). The lower the value, the lower the pitch.
- pan
- The spatial position of the audio effect. The value ranges between -1.0 and 1.0:
- -1.0: The audio effect shows on the left.
- 0: The audio effect shows ahead.
- 1.0: The audio effect shows on the right.
- gain
-
The volume of the audio effect. The value range is [0, 100]. The default value is 100 (original volume). The smaller the value, the lower the volume.
- publish
- Whether to publish the audio effect to the remote users:
true
: Publish the audio effect to the remote users. Both the local user and remote users can hear the audio effect.false
: (Default) Do not publish the audio effect to the remote users. Only the local user can hear the audio effect.
Returns
- 0: Success.
- < 0: Failure.
PlayEffect
Plays the specified local or online audio effect file.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int PlayEffect(int soundId, const FString& filePath, int loopCount, float pitch, float pan, int gain, bool publish, int startPos);
To play multiple audio effect files at the same time, call this method multiple times with different soundId and filePath. To achieve the optimal user experience, Agora recommends that you do not playing more than three audio files at the same time.
Call timing
You can call this method either before or after joining a channel.
Restrictions
If you need to play an online audio effect file, Agora recommends that you cache the online audio effect file to your local device, call PreloadEffect to preload the file into memory, and then call this method to play the audio effect. Otherwise, you might encounter playback failures or no sound during playback due to loading timeouts or failures.
Parameters
- soundId
- The audio effect ID. The ID of each audio effect file is unique.Attention: If you have preloaded an audio effect into memory by calling PreloadEffect, ensure that the value of this parameter is the same as that of soundId in PreloadEffect.
- filePath
-
The file path. The SDK supports URLs and absolute path of local files. The absolute path needs to be accurate to the file name and extension. Supported audio formats include MP3, AAC, M4A, MP4, WAV, and 3GP.
Attention: If you have preloaded an audio effect into memory by calling PreloadEffect, ensure that the value of this parameter is the same as that of filePath in PreloadEffect. - loopCount
-
The number of times the audio effect loops.
- ≥ 0: The number of playback times. For example, 1 means looping one time, which means playing the audio effect two times in total.
- -1: Play the audio file in an infinite loop.
- pitch
- The pitch of the audio effect. The value range is 0.5 to 2.0. The default value is 1.0, which means the original pitch. The lower the value, the lower the pitch.
- pan
-
The spatial position of the audio effect. The value ranges between -1.0 and 1.0:
- -1.0: The audio effect is heard on the left of the user.
- 0.0: The audio effect is heard in front of the user.
- 1.0: The audio effect is heard on the right of the user.
- gain
- The volume of the audio effect. The value range is 0.0 to 100.0. The default value is 100.0, which means the original volume. The smaller the value, the lower the volume.
- publish
-
Whether to publish the audio effect to the remote users:
true
: Publish the audio effect to the remote users. Both the local user and remote users can hear the audio effect.false
: Do not publish the audio effect to the remote users. Only the local user can hear the audio effect.
- startPos
-
The playback position (ms) of the audio effect file.
Returns
- 0: Success.
- < 0: Failure.
PreloadChannel
Preloads a channel with token, channelId, and uid.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int PreloadChannel(const FString & token, const FString & channelId, int64 uid);
When audience members need to switch between different channels frequently, calling the method can help shortening the time of joining a channel, thus reducing the time it takes for audience members to hear and see the host.
If you join a preloaded channel, leave it and want to rejoin the same channel, you do not need to call this method unless the token for preloading the channel expires.
Call timing
To improve the user experience of preloading channels, Agora recommends that before joining the channel, calling this method as early as possible once confirming the channel name and user information.
Restrictions
- When calling this method, ensure you set the user role as audience and do not set the audio scenario as AUDIO_SCENARIO_CHORUS, otherwise, this method does not take effect.
- You also need to make sure that the channel name, user ID and token passed in for preloading are the same as the values passed in when joinning the channel, otherwise, this method does not take effect.
- One IRtcEngine instance supports preloading 20 channels at most. When exceeding this limit, the latest 20 preloaded channels take effect.
Parameters
- token
- The token generated on your server for authentication. See .When the token for preloading channels expires, you can update the token based on the number of channels you preload.
- When preloading one channel, calling this method to pass in the new token.
- When preloading more than one channels:
- If you use a wildcard token for all preloaded channels, call UpdatePreloadChannelToken to update the token.Note: When generating a wildcard token, ensure the user ID is not set as 0. See Secure authentication with tokens.
- If you use different tokens to preload different channels, call this method to pass in your user ID, channel name and the new token.
- If you use a wildcard token for all preloaded channels, call UpdatePreloadChannelToken to update the token.
- channelId
- The channel name that you want to preload. This parameter signifies the channel in which users engage in real-time audio and video interaction. Under the premise of the same App ID, users who fill in the same channel ID enter the same channel for audio and video interaction. The string length must be less than 64 bytes. Supported characters (89 characters in total):
- All lowercase English letters: a to z.
- All uppercase English letters: A to Z.
- All numeric characters: 0 to 9.
- "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", "{", "}", "|", "~", ","
- uid
- The user ID. This parameter is used to identify the user in the channel for real-time audio and video interaction. You need to set and manage user IDs yourself, and ensure that each user ID in the same channel is unique. This parameter is a 32-bit unsigned integer. The value range is 1 to 232-1. If the user ID is not assigned (or set to 0), the SDK assigns a random user ID and OnJoinChannelSuccess returns it in the callback. Your application must record and maintain the returned user ID, because the SDK does not do so.
Returns
- 0: Success.
- < 0: Failure.
- -7: The IRtcEngine object has not been initialized. You need to initialize the IRtcEngine object before calling this method.
- -102: The channel name is invalid. You need to pass in a valid channel name and join the channel again.
PreloadChannelWithUserAccount
Preloads a channel with token, channelId, and userAccount.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int PreloadChannelWithUserAccount(const FString& token, const FString& channelId, const FString& userAccount);
When audience members need to switch between different channels frequently, calling the method can help shortening the time of joining a channel, thus reducing the time it takes for audience members to hear and see the host.
If you join a preloaded channel, leave it and want to rejoin the same channel, you do not need to call this method unless the token for preloading the channel expires.
Call timing
To improve the user experience of preloading channels, Agora recommends that before joining the channel, calling this method as early as possible once confirming the channel name and user information.
Restrictions
- When calling this method, ensure you set the user role as audience and do not set the audio scenario as AUDIO_SCENARIO_CHORUS, otherwise, this method does not take effect.
- You also need to make sure that the User Account, channel ID and token passed in for preloading are the same as the values passed in when joining the channel, otherwise, this method does not take effect.
- One IRtcEngine instance supports preloading 20 channels at most. When exceeding this limit, the latest 20 preloaded channels take effect.
Parameters
- token
- The token generated on your server for authentication. See .When the token for preloading channels expires, you can update the token based on the number of channels you preload.
- When preloading one channel, calling this method to pass in the new token.
- When preloading more than one channels:
- If you use a wildcard token for all preloaded channels, call UpdatePreloadChannelToken to update the token.Note: When generating a wildcard token, ensure the user ID is not set as 0. See Secure authentication with tokens.
- If you use different tokens to preload different channels, call this method to pass in your user ID, channel name and the new token.
- If you use a wildcard token for all preloaded channels, call UpdatePreloadChannelToken to update the token.
- channelId
- The channel name that you want to preload. This parameter signifies the channel in which users engage in real-time audio and video interaction. Under the premise of the same App ID, users who fill in the same channel ID enter the same channel for audio and video interaction. The string length must be less than 64 bytes. Supported characters (89 characters in total):
- All lowercase English letters: a to z.
- All uppercase English letters: A to Z.
- All numeric characters: 0 to 9.
- "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", "{", "}", "|", "~", ","
- userAccount
-
The user account. This parameter is used to identify the user in the channel for real-time audio and video engagement. You need to set and manage user accounts yourself and ensure that each user account in the same channel is unique. The maximum length of this parameter is 255 bytes. Ensure that you set this parameter and do not set it as NULL. Supported characters are as follows(89 in total):
- The 26 lowercase English letters: a to z.
- The 26 uppercase English letters: A to Z.
- All numeric characters: 0 to 9.
- Space
- "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", "{", "}", "|", "~", ","
Returns
- 0: Success.
- < 0: Failure.
- -2: The parameter is invalid. For example, the User Account is empty. You need to pass in a valid parameter and join the channel again.
- -7: The IRtcEngine object has not been initialized. You need to initialize the IRtcEngine object before calling this method.
- -102: The channel name is invalid. You need to pass in a valid channel name and join the channel again.
PreloadEffect
Preloads a specified audio effect file into the memory.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int PreloadEffect(int soundId, const FString & filePath, int startPos);
Ensure the size of all preloaded files does not exceed the limit.
For the audio file formats supported by this method, see What formats of audio files does the Agora RTC SDK support.
Call timing
Agora recommends that you call this method before joining a channel.
Restrictions
None.
Parameters
- soundId
- The audio effect ID. The ID of each audio effect file is unique.
- filePath
- File path:
- Android: The file path, which needs to be accurate to the file name and suffix. Agora supports URL addresses, absolute paths, or file paths that start with
/assets/
. You might encounter permission issues if you use an absolute path to access a local file, so Agora recommends using a URI address instead. For example: content://com.android.providers.media.documents/document/audio%3A14441
- Windows: The absolute path or URL address (including the suffixes of the filename) of the audio effect file. For example
: C:\music\audio.mp4
.
- Android: The file path, which needs to be accurate to the file name and suffix. Agora supports URL addresses, absolute paths, or file paths that start with
Returns
- 0: Success.
- < 0: Failure.
QueryCameraFocalLengthCapability
Queries the focal length capability supported by the camera.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int QueryCameraFocalLengthCapability(const TArray<FFocalLengthInfo> & focalLengthInfos);
Details
If you want to enable the wide-angle or ultra-wide-angle mode for camera capture, it is recommended to start by calling this method to check whether the device supports the required focal length capability. Then, adjust the camera's focal length configuration based on the query result by calling SetCameraCapturerConfiguration, ensuring the best camera capture performance.
Parameters
- focalLengthInfos
- Input and output parameter. The pointer to an array of FFocalLengthInfo objects:
- Input value: The pointer to an array of FFocalLengthInfo objects, used to store focal length information.
- Output value: After the method is executed, output the queried focal length information.
Returns
- 0: Success.
- < 0: Failure.
QueryCodecCapability
Queries the video codec capabilities of the SDK.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") int QueryCodecCapability(TArray<FCodecCapInfo> & codecInfo, int QuerySize = 10);
Details
Parameters
- codecInfo
-
Input and output parameter. An array representing the video codec capabilities of the SDK. See FCodecCapInfo.
- Input value: One FCodecCapInfodefined by the user when executing this method, representing the video codec capability to be queried.
- Output value: The FCodecCapInfo after the method is executed, representing the actual video codec capabilities of the SDK.
- size
- Input and output parameter, represent the size of the FCodecCapInfo array.
- Input value: Size of the FCodecCapInfo defined by the user when executing the method.
- Output value: Size of the output FCodecCapInfo after this method is executed.
Returns
- 0: Success.
- < 0: Failure.
QueryDeviceScore
Queries device score.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int QueryDeviceScore();
Details
Applicable scenarios
In high-definition or ultra-high-definition video scenarios, you can first call this method to query the device's score. If the returned score is low (for example, below 60), you need to lower the video resolution to avoid affecting the video experience. The minimum device score required for different business scenarios is varied. For specific score recommendations, please technical support.
Returns
- < 0: Failure.
QueryScreenCaptureCapability
Queries the highest frame rate supported by the device during screen sharing.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int QueryScreenCaptureCapability();
Details
Applicable scenarios
This method is for Android and iOS only.
To ensure optimal screen sharing performance, particularly in enabling high frame rates like 60 fps, Agora recommends you to query the device's maximum supported frame rate using this method beforehand. This way, if the device cannot support such a high frame rate, you can adjust the screen sharing stream accordingly to avoid any negative impact on the sharing quality. If the device does not support high frame rate, you can reduce the frame rate of the screen sharing stream appropriately when sharing the screen to ensure that the sharing effect meets your expectation.
Returns
- The highest frame rate supported by the device, if the method is called successfully.
- 0: The device supports the frame rate of up to 15 fps.
- 1: The device supports the frame rate of up to 30 fps.
- 2: The device supports the frame rate of up to 60 fps.
- < 0: Failure.
Rate
Allows a user to rate a call after the call ends.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int Rate(const FString& callId, int rating, const FString& description);
Details
Parameters
- callId
- The current call ID. You can get the call ID by calling GetCallId.
- rating
- The value is between 1 (the lowest score) and 5 (the highest score).
- description
- (Optional) A description of the call. The string length should be less than 800 bytes.
Returns
- 0: Success.
- < 0: Failure.
- -1: A general error occurs (no specified reason).
- -2: The parameter is invalid.
RegisterExtension
Registers an extension.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int RegisterExtension(const FString& provider, const FString& extension, EMEDIA_SOURCE_TYPE type);
For extensions external to the SDK (such as those from Extensions Marketplace and SDK Extensions), you need to load them before calling this method. Extensions internal to the SDK (those included in the full SDK package) are automatically loaded and registered after the initialization of IRtcEngine.
Call timing
- Agora recommends you call this method after the initialization of IRtcEngine and before joining a channel.
- For video extensions (such as the image enhancement extension), you need to call this method after enabling the video module by calling EnableVideo or EnableLocalVideo.
- Before calling this method, you need to call LoadExtensionProvider to load the extension first.
Restrictions
- If you want to register multiple extensions, you need to call this method multiple times.
- The data processing order of different extensions in the SDK is determined by the order in which the extensions are registered. That is, the extension that is registered first will process the data first.
Parameters
- provider
- The name of the extension provider.
- extension
- The name of the extension.
- type
- Source type of the extension. See EMEDIA_SOURCE_TYPE.
Returns
- 0: Success.
- < 0: Failure.
- -3: The extension library is not loaded. Agora recommends that you check the storage location or the name of the dynamic library.
RegisterLocalUserAccount
Registers a user account.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int RegisterLocalUserAccount(const FString& appId, const FString& userAccount);
Once registered, the user account can be used to identify the local user when the user joins the channel. After the registration is successful, the user account can identify the identity of the local user, and the user can use it to join the channel.
- Call the RegisterLocalUserAccount method to register a user account, and then call the JoinChannelWithUserAccount method to join a channel, which can shorten the time it takes to enter the channel.
- Call the JoinChannelWithUserAccount method to join a channel.
- Ensure that the userAccount is unique in the channel.
- To ensure smooth communication, use the same parameter type to identify the user. For example, if a user joins the channel with a UID, then ensure all the other users use the UID too. The same applies to the user account. If a user joins the channel with the Agora Web SDK, ensure that the ID of the user is set to the same parameter type.
Restrictions
None.
Parameters
- appId
- The App ID of your project on Agora Console.
- userAccount
-
The user account. This parameter is used to identify the user in the channel for real-time audio and video engagement. You need to set and manage user accounts yourself and ensure that each user account in the same channel is unique. The maximum length of this parameter is 255 bytes. Ensure that you set this parameter and do not set it as NULL. Supported characters are as follow(89 in total):
- The 26 lowercase English letters: a to z.
- The 26 uppercase English letters: A to Z.
- All numeric characters: 0 to 9.
- Space
- "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", "{", "}", "|", "~", ","
Returns
- 0: Success.
- < 0: Failure.
Release
Releases the IRtcEngine instance.
static void Release(bool sync = false);
Details
This method releases all resources used by the Agora SDK. Use this method for apps in which users occasionally make voice or video calls. When users do not make calls, you can free up resources for other operations.
After a successful method call, you can no longer use any method or callback in the SDK anymore. If you want to use the real-time communication functions again, you must call GetAgoraRtcEngine and Initialize to create a new IRtcEngine instance.
- This method can be called synchronously. You need to wait for the resource of IRtcEngine to be released before performing other operations (for example, create a new IRtcEngine object). Therefore, Agora recommends calling this method in the child thread to avoid blocking the main thread.
- Besides, Agora does not recommend you calling Release in any callback of the SDK. Otherwise, the SDK cannot release the resources until the callbacks return results, which may result in a deadlock.
Parameters
- sync
-
Whether the method is called synchronously:
true
: Synchronous call.false
: Asynchronous call. Currently this method only supports synchronous calls. Do not set this parameter to this value.
RenewToken
Renews the token.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int RenewToken(const FString & token);
You can call this method to pass a new token to the SDK. A token will expire after a certain period of time, at which point the SDK will be unable to establish a connection with the server.
Call timing
- Receiving the OnTokenPrivilegeWillExpire callback reporting the token is about to expire.
- Receiving the OnRequestToken callback reporting the token has expired.
- Receiving the OnConnectionStateChanged callback reporting CONNECTION_CHANGED_TOKEN_EXPIRED(9).
Restrictions
None.
Parameters
- token
- The new token.
Returns
- 0: Success.
- < 0: Failure.
- -2: The parameter is invalid. For example, the token is empty.
- -7: The IRtcEngine object has not been initialized. You need to initialize the IRtcEngine object before calling this method.
- 110: Invalid token. Ensure the following:
- The user ID specified when generating the token is consistent with the user ID used when joining the channel.
- The generated token is the same as the token passed in to join the channel.
ResumeAllChannelMediaRelay
Resumes the media stream relay to all target channels.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int ResumeAllChannelMediaRelay();
Details
After calling the PauseAllChannelMediaRelay method, you can call this method to resume relaying media streams to all destination channels.
Returns
- 0: Success.
- < 0: Failure.
- -5: The method call was rejected. There is no paused channel media relay.
ResumeAllEffects
Resumes playing all audio effect files.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int ResumeAllEffects();
After you call PauseAllEffects to pause the playback, you can call this method to resume the playback.
Call timing
Call this method after PauseAllEffects.
Restrictions
None.
Returns
- 0: Success.
- < 0: Failure.
ResumeAudioMixing
Resumes playing and mixing the music file.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int ResumeAudioMixing();
After calling PauseAudioMixing to pause the playback, you can call this method to resume the playback.
Call timing
Call this method after joining a channel.
Restrictions
None.
Returns
- 0: Success.
- < 0: Failure.
ResumeEffect
Resumes playing a specified audio effect.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int ResumeEffect(int soundId);
Parameters
- soundId
- The audio effect ID. The ID of each audio effect file is unique.
Returns
- 0: Success.
- < 0: Failure.
SelectAudioTrack
Selects the audio track used during playback.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SelectAudioTrack(int index);
Details
After getting the track index of the audio file, you can call this method to specify any track to play. For example, if different tracks of a multi-track file store songs in different languages, you can call this method to set the playback language.
- For the supported formats of audio files, see https://docs.agora.io/en/help/general-product-inquiry/audio_format#extended-audio-file-formats.
- You need to call this method after calling StartAudioMixing and receiving the OnAudioMixingStateChanged
(AUDIO_MIXING_STATE_PLAYING)
callback.
Parameters
- index
- The audio track you want to specify. The value should be greater than 0 and less than that of returned by GetAudioTrackCount.
Returns
- 0: Success.
- < 0: Failure.
SelectMultiAudioTrack
Selects the audio tracks that you want to play on your local device and publish to the channel respectively.
UFUNCTION(BlueprintCallable, Category = "Agora|IMediaPlayer")
int SelectMultiAudioTrack(int playoutTrackIndex, int publishTrackIndex);
Details
You can call this method to determine the audio track to be played on your local device and published to the channel.
Before calling this method, you need to open the media file with the OpenWithMediaSource method and set enableMultiAudioTrack in FAgoraMediaSource as true
.
Applicable scenarios
For example, in KTV scenarios, the host can choose to play the original sound locally and publish the accompaniment track to the channel.
Parameters
- playoutTrackIndex
- The index of audio tracks for local playback. You can obtain the index through GetStreamInfo.
- publishTrackIndex
- The index of audio tracks to be published in the channel. You can obtain the index through GetStreamInfo.
Returns
- < 0: Failure.
SendCustomReportMessage
Reports customized messages.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SendCustomReportMessage(const FString& id, const FString& category, const FString& event, const FString& label, int value);
Details
Agora supports reporting and analyzing customized messages. This function is in the beta stage with a free trial. The ability provided in its beta test version is reporting a maximum of 10 message pieces within 6 seconds, with each message piece not exceeding 256 bytes and each string not exceeding 100 bytes. To try out this function, contact support@agora.io and discuss the format of customized messages with us.
SendStreamMessage
Sends data stream messages.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SendStreamMessage(int streamId, const FString& data);
Details
After calling CreateDataStream, you can call this method to send data stream messages to all users in the channel.
- Each user can have up to five data streams simultaneously.
- Up to 60 packets can be sent per second in a data stream with each packet having a maximum size of 1 KB.
- Up to 30 KB of data can be sent per second in a data stream.
A successful method call triggers the OnStreamMessage callback on the remote client, from which the remote user gets the stream message. A failed method call triggers the OnStreamMessageError callback on the remote client.
- This method needs to be called after CreateDataStream and joining the channel.
- In live streaming scenarios, this method only applies to hosts.
Parameters
- streamId
- The data stream ID. You can get the data stream ID by calling CreateDataStream.
- data
- The message to be sent.
- length
- The length of the data.
Returns
- 0: Success.
- < 0: Failure.
SetAdvancedAudioOptions
Sets audio advanced options.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetAdvancedAudioOptions(const FAdvancedAudioOptions& options);
Details
If you have advanced audio processing requirements, such as capturing and sending stereo audio, you can call this method to set advanced audio options.
Parameters
- options
- The advanced options for audio. See FAdvancedAudioOptions.
Returns
- 0: Success.
- < 0: Failure.
SetAudioEffectParameters
Sets parameters for SDK preset audio effects.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetAudioEffectParameters(FENUMWRAP_AUDIO_EFFECT_PRESET preset, int param1, int param2);
Details
- 3D voice effect: Sets the cycle period of the 3D voice effect.
- Pitch correction effect: Sets the basic mode and tonic pitch of the pitch correction effect. Different songs have different modes and tonic pitches. Agora recommends bounding this method with interface elements to enable users to adjust the pitch correction interactively.
After setting the audio parameters, all users in the channel can hear the effect.
- Call SetAudioScenario to set the audio scenario to high-quality audio scenario, namely AUDIO_SCENARIO_GAME_STREAMING(3).
- Call SetAudioProfileAndScenario to set the profile parameter to AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4) or AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5).
- You can call this method either before or after joining a channel.
- Do not set the profile parameter in SetAudioProfileAndScenario to AUDIO_PROFILE_SPEECH_STANDARD(1) or AUDIO_PROFILE_IOT(6), or the method does not take effect.
- This method has the best effect on human voice processing, and Agora does not recommend calling this method to process audio data containing music.
- After calling SetAudioEffectParameters, Agora does not recommend you to call the following methods, otherwise the effect set by SetAudioEffectParameters will be overwritten:
- This method relies on the voice beautifier dynamic library
libagora_audio_beauty_extension.dll
. If the dynamic library is deleted, the function cannot be enabled normally.
Parameters
- preset
- The options for SDK preset audio effects:
- ROOM_ACOUSTICS_3D_VOICE, 3D voice effect:
- You need to set the profile parameter in SetAudioProfileAndScenario to AUDIO_PROFILE_MUSIC_STANDARD_STEREO(3) or AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5) before setting this enumerator; otherwise, the enumerator setting does not take effect.
- If the 3D voice effect is enabled, users need to use stereo audio playback devices to hear the anticipated voice effect.
- PITCH_CORRECTION, Pitch correction effect:
- ROOM_ACOUSTICS_3D_VOICE, 3D voice effect:
- param1
-
- If you set preset to ROOM_ACOUSTICS_3D_VOICE, param1 sets the cycle period of the 3D voice effect. The value range is [1,60] and the unit is seconds. The default value is 10, indicating that the voice moves around you every 10 seconds.
- If you set preset to PITCH_CORRECTION, param1 indicates the basic mode of the pitch correction effect:
1
: (Default) Natural major scale.2
: Natural minor scale.3
: Japanese pentatonic scale.
- param2
-
- If you set preset to ROOM_ACOUSTICS_3D_VOICE , you need to set param2 to
0
. - If you set preset to PITCH_CORRECTION, param2 indicates the tonic pitch of the pitch correction effect:
1
: A2
: A#3
: B4
: (Default) C5
: C#6
: D7
: D#8
: E9
: F10
: F#11
: G12
: G#
- If you set preset to ROOM_ACOUSTICS_3D_VOICE , you need to set param2 to
Returns
- 0: Success.
- < 0: Failure.
SetAudioEffectPreset
Sets an SDK preset audio effect.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetAudioEffectPreset(FENUMWRAP_AUDIO_EFFECT_PRESET preset);
Call this method to set an SDK preset audio effect for the local user who sends an audio stream. This audio effect does not change the gender characteristics of the original voice. After setting an audio effect, all users in the channel can hear the effect.
Call timing
This method can be called either before or after joining the channel.
- Call SetAudioScenario to set the audio scenario to high-quality audio scenario, namely AUDIO_SCENARIO_GAME_STREAMING(3).
- Call SetAudioProfileAndScenario to set the profile parameter to AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4) or AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5).
Restrictions
- Do not set the profile parameter in SetAudioProfileAndScenario to AUDIO_PROFILE_SPEECH_STANDARD(1) or AUDIO_PROFILE_IOT(6), or the method does not take effect.
- If you call SetAudioEffectPreset and set enumerators except for ROOM_ACOUSTICS_3D_VOICE or PITCH_CORRECTION, do not call SetAudioEffectParameters; otherwise, SetAudioEffectPreset is overridden.
- After calling SetAudioEffectPreset, Agora does not recommend you to call the following methods, otherwise the effect set by SetAudioEffectPreset will be overwritten:
- This method relies on the voice beautifier dynamic library
libagora_audio_beauty_extension.dll
. If the dynamic library is deleted, the function cannot be enabled normally.
Parameters
- preset
- The options for SDK preset audio effects. See FENUMWRAP_AUDIO_EFFECT_PRESET.
Returns
- 0: Success.
- < 0: Failure.
SetAudioMixingDualMonoMode
Sets the channel mode of the current audio file.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetAudioMixingDualMonoMode(EAUDIO_MIXING_DUAL_MONO_MODE mode);
In a stereo music file, the left and right channels can store different audio data. According to your needs, you can set the channel mode to original mode, left channel mode, right channel mode, or mixed channel mode.
Applicable scenarios
- If you only want to hear the accompaniment, use this method to set the audio file's channel mode to left channel mode.
- If you need to hear both the accompaniment and the original vocals simultaneously, call this method to set the channel mode to mixed mode.
Call timing
Call this method after StartAudioMixing and receiving the OnAudioMixingStateChanged(AUDIO_MIXING_STATE_PLAYING)
callback.
Restrictions
This method only applies to stereo audio files.
Parameters
- mode
- The channel mode. See EAUDIO_MIXING_DUAL_MONO_MODE.
Returns
- 0: Success.
- < 0: Failure.
SetAudioMixingPitch
Sets the pitch of the local music file.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetAudioMixingPitch(int pitch);
When a local music file is mixed with a local human voice, call this method to set the pitch of the local music file only.
Call timing
You need to call this method after calling StartAudioMixing and receiving the OnAudioMixingStateChanged(AUDIO_MIXING_STATE_PLAYING)
callback.
Restrictions
None.
Parameters
- pitch
- Sets the pitch of the local music file by the chromatic scale. The default value is 0, which means keeping the original pitch. The value ranges from -12 to 12, and the pitch value between consecutive values is a chromatic value. The greater the absolute value of this parameter, the higher or lower the pitch of the local music file.
Returns
- 0: Success.
- < 0: Failure.
SetAudioMixingPlaybackSpeed
Sets the playback speed of the current audio file.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetAudioMixingPlaybackSpeed(int speed);
Details
Ensure you call this method after calling StartAudioMixing receiving the OnAudioMixingStateChanged callback reporting the state as AUDIO_MIXING_STATE_PLAYING.
Parameters
- speed
- The playback speed. Agora recommends that you set this to a value between 50 and 400, defined as follows:
- 50: Half the original speed.
- 100: The original speed.
- 400: 4 times the original speed.
Returns
- 0: Success.
- < 0: Failure.
SetAudioMixingPosition
Sets the audio mixing position.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetAudioMixingPosition(int pos);
Call this method to set the playback position of the music file to a different starting position (the default plays from the beginning).
Call timing
Call this method after StartAudioMixing and receiving the OnAudioMixingStateChanged(AUDIO_MIXING_STATE_PLAYING)
callback.
Restrictions
None.
Parameters
- pos
- Integer. The playback position (ms).
Returns
- 0: Success.
- < 0: Failure.
SetAudioProfileAndScenario
Sets the audio profile and audio scenario.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetAudioProfileAndScenario(EAUDIO_PROFILE_TYPE profile = EAUDIO_PROFILE_TYPE::AUDIO_PROFILE_DEFAULT, EAUDIO_SCENARIO_TYPE scenario = EAUDIO_SCENARIO_TYPE::AUDIO_SCENARIO_DEFAULT);
Applicable scenarios
This method is suitable for various audio scenarios. You can choose as needed. For example, in scenarios with high audio quality requirements such as music teaching, it is recommended to set profile to AUDIO_PROFILE_MUSIC_HIGH_QUALITY
(4) and scenario to AUDIO_SCENARIO_GAME_STREAMING
(3).
Call timing
You can call this method either before or after joining a channel.
Restrictions
Due to iOS system restrictions, some audio routes cannot be recognized in call volume mode. Therefore, if you need to use an external sound card, it is recommended to set the audio scenario to AUDIO_SCENARIO_GAME_STREAMING
(3). In this scenario, the SDK will switch to media volume to avoid this issue.
Parameters
- profile
-
The audio profile, including the sampling rate, bitrate, encoding mode, and the number of channels. See EAUDIO_PROFILE_TYPE.
- scenario
- The audio scenarios. Under different audio scenarios, the device uses different volume types. See EAUDIO_SCENARIO_TYPE.
Returns
- 0: Success.
- < 0: Failure.
SetAudioProfile
Sets audio profiles.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetAudioProfile(EAUDIO_PROFILE_TYPE profile = EAUDIO_PROFILE_TYPE::AUDIO_PROFILE_DEFAULT);
If you need to set the audio scenario, you can either call SetAudioScenario, or Initialize and set the audioScenario in FRtcEngineContext.
Applicable scenarios
This method is suitable for various audio scenarios. You can choose as needed. For example, in scenarios with high audio quality requirements such as music teaching, it is recommended to set profile
to AUDIO_PROFILE_MUSIC_HIGH_QUALITY
(4).
Call timing
You can call this method either before or after joining a channel.
Restrictions
None.
Parameters
- profile
-
The audio profile, including the sampling rate, bitrate, encoding mode, and the number of channels. See EAUDIO_PROFILE_TYPE.
SetAudioScenario
Sets audio scenarios.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetAudioScenario(EAUDIO_SCENARIO_TYPE scenario = EAUDIO_SCENARIO_TYPE::AUDIO_SCENARIO_DEFAULT);
Applicable scenarios
This method is suitable for various audio scenarios. You can choose as needed. For example, in scenarios such as music teaching that require high sound quality, it is recommended to set scenario to AUDIO_SCENARIO_GAME_STREAMING
(3).
Call timing
You can call this method either before or after joining a channel.
Restrictions
Due to iOS system restrictions, some audio routes cannot be recognized in call volume mode. Therefore, if you need to use an external sound card, it is recommended to set the audio scenario to AUDIO_SCENARIO_GAME_STREAMING
(3). In this scenario, the SDK will switch to media volume to avoid this issue.
Parameters
- scenario
- The audio scenarios. Under different audio scenarios, the device uses different volume types. See EAUDIO_SCENARIO_TYPE.
Returns
- 0: Success.
- < 0: Failure.
SetAudioSessionOperationRestriction
Sets the operational permission of the SDK on the audio session.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetAudioSessionOperationRestriction(EAUDIO_SESSION_OPERATION_RESTRICTION restriction);
Details
The SDK and the app can both configure the audio session by default. If you need to only use the app to configure the audio session, this method restricts the operational permission of the SDK on the audio session.
You can call this method either before or after joining a channel. Once you call this method to restrict the operational permission of the SDK on the audio session, the restriction takes effect when the SDK needs to change the audio session.
- This method is only available for iOS platforms.
- This method does not restrict the operational permission of the app on the audio session.
Parameters
- restriction
- The operational permission of the SDK on the audio session. See EAUDIO_SESSION_OPERATION_RESTRICTION. This parameter is in bit mask format, and each bit corresponds to a permission.
Returns
- 0: Success.
- < 0: Failure.
SetAINSMode
Sets whether to enable the AI ​​noise suppression function and set the noise suppression mode.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetAINSMode(bool enabled, EAUDIO_AINS_MODE mode);
- Television;
- Air conditioner;
- Machinery, etc.
- Thunder;
- Explosion;
- Cracking, etc.
Applicable scenarios
In scenarios such as co-streaming, online education and video meeting, this function can detect and reduce background noises to improve experience.
Call timing
You can call this method either before or after joining a channel.
Restrictions
- Agora does not recommend enabling this function on devices running Android 6.0 and below.
Parameters
- enabled
- Whether to enable the AI noise suppression function:
true
: Enable the AI noise suppression.false
: (Default) Disable the AI noise suppression.
- mode
-
The AI noise suppression modes. See EAUDIO_AINS_MODE.
Returns
- 0: Success.
- < 0: Failure.
SetBeautyEffectOptions
Sets the image enhancement options.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetBeautyEffectOptions(bool enabled, const FBeautyOptions& options, EMEDIA_SOURCE_TYPE type);
Enables or disables image enhancement, and sets the options.
Call timing
Call this method after calling EnableVideo or StartPreview.
Restrictions
- This method relies on the image enhancement dynamic library
libagora_clear_vision_extension.dll
. If the dynamic library is deleted, the function cannot be enabled normally. - This feature has high requirements on device performance. When calling this method, the SDK automatically checks the capabilities of the current device.
Parameters
- enabled
- Whether to enable the image enhancement function:
true
: Enable the image enhancement function.false
: (Default) Disable the image enhancement function.
- options
- The image enhancement options. See FBeautyOptions.
Returns
- 0: Success.
- < 0: Failure.
- -4: The current device does not support this feature. Possible reasons include:
- The current device capabilities do not meet the requirements for image enhancement. Agora recommends you replace it with a high-performance device.
- -4: The current device does not support this feature. Possible reasons include:
SetCameraAutoFocusFaceModeEnabled
Enables the camera auto-face focus function.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetCameraAutoFocusFaceModeEnabled(bool enabled);
By default, the SDK disables face autofocus on Android and enables face autofocus on iOS. To set face autofocus, call this method.
Call timing
This method must be called after the SDK triggers the OnLocalVideoStateChanged callback and returns the local video state as LOCAL_VIDEO_STREAM_STATE_ENCODING (2).
Restrictions
None.
Parameters
- enabled
-
Whether to enable face autofocus:
true
: Enable the camera auto-face focus function.false
: Disable face autofocus.
Returns
- 0: Success.
- < 0: Failure.
SetCameraAutoExposureFaceModeEnabled
Sets whether to enable auto exposure.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetCameraAutoExposureFaceModeEnabled(bool enabled);
Details
- This method applies to iOS only.
- You must call this method after EnableVideo. The setting result will take effect after the camera is successfully turned on, that is, after the SDK triggers the OnLocalVideoStateChanged callback and returns the local video state as LOCAL_VIDEO_STREAM_STATE_CAPTURING (1).
Parameters
- enabled
-
Whether to enable auto exposure:
true
: Enable auto exposure.false
: Disable auto exposure.
Returns
- 0: Success.
- < 0: Failure.
SetCameraCapturerConfiguration
Sets the camera capture configuration.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetCameraCapturerConfiguration(const FCameraCapturerConfiguration& config);
Call timing
Call this method before enabling local camera capture, such as before calling StartPreview and JoinChannelWithOptions.
Restrictions
To adjust the camera focal length configuration, It is recommended to call QueryCameraFocalLengthCapability first to check the device's focal length capabilities, and then configure based on the query results.
Due to limitations on some Android devices, even if you set the focal length type according to the results returned in QueryCameraFocalLengthCapability, the settings may not take effect.
Parameters
- config
- The camera capture configuration. See FCameraCapturerConfiguration.Attention: In this method, you do not need to set the deviceId parameter.
Returns
- 0: Success.
- < 0: Failure.
SetCameraDeviceOrientation
Sets the rotation angle of the captured video.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetCameraDeviceOrientation(EVIDEO_SOURCE_TYPE type, FENUMWRAP_VIDEO_ORIENTATION orientation);
Details
- This method applies to Windows only.
- You must call this method after EnableVideo. The setting result will take effect after the camera is successfully turned on, that is, after the SDK triggers the OnLocalVideoStateChanged callback and returns the local video state as LOCAL_VIDEO_STREAM_STATE_CAPTURING (1).
- When the video capture device does not have the gravity sensing function, you can call this method to manually adjust the rotation angle of the captured video.
Parameters
- type
- The video source type. See EVIDEO_SOURCE_TYPE.
- orientation
- The clockwise rotation angle. See FENUMWRAP_VIDEO_ORIENTATION.
Returns
- 0: Success.
- < 0: Failure.
SetCameraExposureFactor
Sets the camera exposure value.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetCameraExposureFactor(float factor);
Details
Insufficient or excessive lighting in the shooting environment can affect the image quality of video capture. To achieve optimal video quality, you can use this method to adjust the camera's exposure value.
- This method is for Android and iOS only.
- You must call this method after EnableVideo. The setting result will take effect after the camera is successfully turned on, that is, after the SDK triggers the OnLocalVideoStateChanged callback and returns the local video state as LOCAL_VIDEO_STREAM_STATE_CAPTURING (1).
- Before calling this method, Agora recommends calling IsCameraExposureSupported to check whether the current camera supports adjusting the exposure value.
- By calling this method, you adjust the exposure value of the currently active camera, that is, the camera specified when calling SetCameraCapturerConfiguration.
Parameters
- factor
-
The camera exposure value. The default value is 0, which means using the default exposure of the camera. The larger the value, the greater the exposure. When the video image is overexposed, you can reduce the exposure value; when the video image is underexposed and the dark details are lost, you can increase the exposure value. If the exposure value you specified is beyond the range supported by the device, the SDK will automatically adjust it to the actual supported range of the device.
On Android, the value range is [-20.0, 20.0]. On iOS, the value range is [-8.0, 8.0].
Returns
- 0: Success.
- < 0: Failure.
SetCameraExposurePosition
Sets the camera exposure position.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetCameraExposurePosition(float positionXinView, float positionYinView);
Details
- This method is for Android and iOS only.
- You must call this method after EnableVideo. The setting result will take effect after the camera is successfully turned on, that is, after the SDK triggers the OnLocalVideoStateChanged callback and returns the local video state as LOCAL_VIDEO_STREAM_STATE_CAPTURING (1).
- After a successful method call, the SDK triggers the OnCameraExposureAreaChanged callback.
Parameters
- positionXinView
- The horizontal coordinate of the touchpoint in the view.
- positionYinView
- The vertical coordinate of the touchpoint in the view.
Returns
- 0: Success.
- < 0: Failure.
SetCameraFocusPositionInPreview
Sets the camera manual focus position.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetCameraFocusPositionInPreview(float positionX, float positionY);
Details
- This method is for Android and iOS only.
- You must call this method after EnableVideo. The setting result will take effect after the camera is successfully turned on, that is, after the SDK triggers the OnLocalVideoStateChanged callback and returns the local video state as LOCAL_VIDEO_STREAM_STATE_CAPTURING (1).
- After a successful method call, the SDK triggers the OnCameraFocusAreaChanged callback.
Parameters
- positionX
- The horizontal coordinate of the touchpoint in the view.
- positionY
- The vertical coordinate of the touchpoint in the view.
Returns
- 0: Success.
- < 0: Failure.
SetCameraStabilizationMode
Set the camera stabilization mode.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetCameraStabilizationMode(FENUMWRAP_CAMERA_STABILIZATION_MODE mode);
This method applies to iOS only.
The camera stabilization mode is off by default. You need to call this method to turn it on and set the appropriate stabilization mode.
Applicable scenarios
When shooting on the move, in low light conditions, or with mobile devices, you can set the camera stabilization mode to reduce the impact of camera shake and get a more stable, clear picture.
Call timing
This method must be called after the camera is successfully enabled, that is, after the SDK triggers the OnLocalVideoStateChanged callback and returns the local video state as LOCAL_VIDEO_STREAM_STATE_CAPTURING (1).
Restrictions
- Camera stabilization only works for scenarios with a video resolution greater than 1280 x 720.
- After enabling camera stabilization, the higher the camera stabilization level, the smaller the camera's field of view and the greater the camera's latency. To improve user experience, it is recommended that you set the mode parameter to CAMERA_STABILIZATION_MODE_LEVEL_1.
Parameters
- mode
- Camera stabilization mode. See FENUMWRAP_CAMERA_STABILIZATION_MODE.
Returns
- 0: Success.
- < 0: Failure.
SetCameraTorchOn
Enables the camera flash.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetCameraTorchOn(bool isOn);
Details
- This method is for Android and iOS only.
- You must call this method after EnableVideo. The setting result will take effect after the camera is successfully turned on, that is, after the SDK triggers the OnLocalVideoStateChanged callback and returns the local video state as LOCAL_VIDEO_STREAM_STATE_CAPTURING (1).
Parameters
- isOn
-
Whether to turn on the camera flash:
true
: Turn on the flash.false
: (Default) Turn off the flash.
Returns
- 0: Success.
- < 0: Failure.
SetCameraZoomFactor
Sets the camera zoom factor.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetCameraZoomFactor(float factor);
Details
For iOS devices equipped with multi-lens rear cameras, such as those featuring dual-camera (wide-angle and ultra-wide-angle) or triple-camera (wide-angle, ultra-wide-angle, and telephoto), you can call SetCameraCapturerConfiguration first to set the cameraFocalLengthType as CAMERA_FOCAL_LENGTH_DEFAULT (0) (standard lens). Then, adjust the camera zoom factor to a value less than 1.0. This configuration allows you to capture video with an ultra-wide-angle perspective.
- This method is for Android and iOS only.
- You must call this method after EnableVideo. The setting result will take effect after the camera is successfully turned on, that is, after the SDK triggers the OnLocalVideoStateChanged callback and returns the local video state as LOCAL_VIDEO_STREAM_STATE_CAPTURING (1).
Parameters
- factor
- The camera zoom factor. For devices that do not support ultra-wide-angle, the value ranges from 1.0 to the maximum zoom factor; for devices that support ultra-wide-angle, the value ranges from 0.5 to the maximum zoom factor. You can get the maximum zoom factor supported by the device by calling the GetCameraMaxZoomFactor method.
Returns
- The camera zoom factor value, if successful.
- < 0: if the method if failed.
SetChannelProfile
Sets the channel profile.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetChannelProfile(ECHANNEL_PROFILE_TYPE profile);
You can call this method to set the channel profile. The SDK adopts different optimization strategies for different channel profiles. For example, in a live streaming scenario, the SDK prioritizes video quality. After initializing the SDK, the default channel profile is the live streaming profile.
In different channel scenarios, the default audio routing of the SDK is different. See SetDefaultAudioRouteToSpeakerphone.
Call timing
Call this method before joining a channel.
Restrictions
To ensure the quality of real-time communication, Agora recommends that all users in a channel use the same channel profile.
Parameters
- profile
-
The channel profile. See ECHANNEL_PROFILE_TYPE.
Returns
- 0: Success.
- < 0: Failure.
- -2: The parameter is invalid.
- -7: The SDK is not initialized.
SetCloudProxy
Sets up cloud proxy service.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetCloudProxy(ECLOUD_PROXY_TYPE proxyType);
Details
When users' network access is restricted by a firewall, configure the firewall to allow specific IP addresses and ports provided by Agora; then, call this method to enable the cloud proxyType and set the cloud proxy type with the proxyType parameter.
After successfully connecting to the cloud proxy, the SDK triggers the OnConnectionStateChanged (CONNECTION_STATE_CONNECTING, CONNECTION_CHANGED_SETTING_PROXY_SERVER) callback.
To disable the cloud proxy that has been set, call the SetCloudProxy(NONE_PROXY)
.
To change the cloud proxy type that has been set, call the SetCloudProxy(NONE_PROXY)
first, and then call the SetCloudProxy to set the proxyType you want.
- Agora recommends that you call this method after joining a channel.
- When a user is behind a firewall and uses the Force UDP cloud proxy, the services for Media Push and cohosting across channels are not available.
- When you use the Force TCP cloud proxy, note that an error would occur when calling the StartAudioMixing method to play online music files in the HTTP protocol. The services for Media Push and cohosting across channels use the cloud proxy with the TCP protocol.
Parameters
- proxyType
-
The type of the cloud proxy. See ECLOUD_PROXY_TYPE.
This parameter is mandatory. The SDK reports an error if you do not pass in a value.
Returns
- 0: Success.
- < 0: Failure.
- -2: The parameter is invalid.
- -7: The SDK is not initialized.
SetClientRole
Set the user role and the audience latency level in a live streaming scenario.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetClientRole(FClientRoleOptions options, ECLIENT_ROLE_TYPE clientroletype = ECLIENT_ROLE_TYPE::CLIENT_ROLE_BROADCASTER);
By default,the SDK sets the user role as audience. You can call this method to set the user role as host. The user role (roles) determines the users' permissions at the SDK level, including whether they can publish audio and video streams in a channel.
Call timing
You can call this method either before or after joining a channel.
If you call this method to set the user role as the host before joining the channel and set the local video property through the SetupLocalVideo method, the local video preview is automatically enabled when the user joins the channel.
If you call this method to set the user role after joining a channel, the SDK will automatically call the MuteLocalAudioStream and MuteLocalVideoStream method to change the state for publishing audio and video streams.
Restrictions
When the user role is set to host, the audience latency level can only be set to AUDIENCE_LATENCY_LEVEL_ULTRA_LOW_LATENCY.
When calling this method before joining a channel and setting the role to BROADCASTER, the OnClientRoleChanged callback will not be triggered on the local client.
Parameters
- clientRoleType
- The user role. See ECLIENT_ROLE_TYPE.
Note: If you set the user role as an audience member, you cannot publish audio and video streams in the channel. If you want to publish media streams in a channel during live streaming, ensure you set the user role as broadcaster.
- options
- The detailed options of a user, including the user level. See FClientRoleOptions.
Returns
- 0: Success.
- < 0: Failure.
- -1: A general error occurs (no specified reason).
- -2: The parameter is invalid.
- -5: The request is rejected.
- -7: The SDK is not initialized.
SetColorEnhanceOptions
Sets color enhancement.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetColorEnhanceOptions(bool enabled, const FColorEnhanceOptions& options, EMEDIA_SOURCE_TYPE type);
Details
The video images captured by the camera can have color distortion. The color enhancement feature intelligently adjusts video characteristics such as saturation and contrast to enhance the video color richness and color reproduction, making the video more vivid.
You can call this method to enable the color enhancement feature and set the options of the color enhancement effect.
- Call this method after calling EnableVideo.
- The color enhancement feature has certain performance requirements on devices. With color enhancement turned on, Agora recommends that you change the color enhancement level to one that consumes less performance or turn off color enhancement if your device is experiencing severe heat problems.
- Both this method and SetExtensionProperty can enable color enhancement:
- When you use the SDK to capture video, Agora recommends this method (this method only works for video captured by the SDK).
- When you use an external video source to implement custom video capture, or send an external video source to the SDK, Agora recommends using SetExtensionProperty.
- This method relies on the image enhancement dynamic library
libagora_clear_vision_extension.dll
. If the dynamic library is deleted, the function cannot be enabled normally.
Parameters
- enabled
- Whether to enable color enhancement:
true
Enable color enhancement.false
: (Default) Disable color enhancement.
- options
- The color enhancement options. See FColorEnhanceOptions.
- type
- The type of the video source. See EMEDIA_SOURCE_TYPE.
Returns
- 0: Success.
- < 0: Failure.
SetDefaultAudioRouteToSpeakerphone
Sets the default audio playback route.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetDefaultAudioRouteToSpeakerphone(bool defaultToSpeaker);
Most mobile phones have two audio routes: an earpiece at the top, and a speakerphone at the bottom. The earpiece plays at a lower volume, and the speakerphone at a higher volume. When setting the default audio route, you determine whether audio playback comes through the earpiece or speakerphone when no external audio device is connected.
- Voice call: Earpiece.
- Audio broadcast: Speakerphone.
- Video call: Speakerphone.
- Video broadcast: Speakerphone.
You can call this method to change the default audio route.
Call timing
Call this method before joining a channel. If you need to change the audio route after joining a channel, call SetEnableSpeakerphone.
Restrictions
None.
Parameters
- defaultToSpeaker
- Whether to set the speakerphone as the default audio route:
true
: Set the speakerphone as the default audio route.false
: Set the earpiece as the default audio route.
Returns
- 0: Success.
- < 0: Failure.
SetDualStreamMode
Sets dual-stream mode configuration on the sender side.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetDualStreamMode(FENUMWRAP_SIMULCAST_STREAM_MODE mode, const FSimulcastStreamConfig& streamConfig);
Details
- If you want to modify this behavior, you can call this method and set mode to DISABLE_SIMULCAST_STREAM (never send low-quality video streams) or ENABLE_SIMULCAST_STREAM (always send low-quality video streams).
- If you want to restore the default behavior after making changes, you can call this method again with mode set to AUTO_SIMULCAST_STREAM.
- When calling this method and setting mode to DISABLE_SIMULCAST_STREAM, it has the same effect as calling EnableDualStreamMode and setting enabled to
false
. - When calling this method and setting mode to ENABLE_SIMULCAST_STREAM, it has the same effect as calling EnableDualStreamMode and setting enabled to
true
. - Both methods can be called before and after joining a channel. If both methods are used, the settings in the method called later takes precedence.
Parameters
- mode
- The mode in which the video stream is sent. See FENUMWRAP_SIMULCAST_STREAM_MODE.
- streamConfig
-
The configuration of the low-quality video stream. See FSimulcastStreamConfig.Note: When setting mode to DISABLE_SIMULCAST_STREAM, setting streamConfig will not take effect.
Returns
- 0: Success.
- < 0: Failure.
SetEffectPosition
Sets the playback position of an audio effect file.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetEffectPosition(int soundId, int pos);
Details
After a successful setting, the local audio effect file starts playing at the specified position.
Parameters
- soundId
- The audio effect ID. The ID of each audio effect file is unique.
- pos
- The playback position (ms) of the audio effect file.
Returns
- 0: Success.
- < 0: Failure.
SetEffectsVolume
Sets the volume of the audio effects.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetEffectsVolume(int volume);
Call timing
Call this method after PlayEffect.
Restrictions
None.
Parameters
- volume
- The playback volume. The value range is [0, 100]. The default value is 100, which represents the original volume.
Returns
- 0: Success.
- < 0: Failure.
SetEnableSpeakerphone
Enables/Disables the audio route to the speakerphone.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetEnableSpeakerphone(bool speakerOn);
Applicable scenarios
If the default audio route of the SDK or the setting in SetDefaultAudioRouteToSpeakerphone cannot meet your requirements, you can call this method to switch the current audio route.
Call timing
Call this method after joining a channel.
Restrictions
- This method only sets the audio route in the current channel and does not influence the default audio route. If the user leaves the current channel and joins another channel, the default audio route is used.
- If the user uses an external audio playback device such as a Bluetooth or wired headset, this method does not take effect, and the SDK plays audio through the external device. When the user uses multiple external devices, the SDK plays audio through the last connected device.
Parameters
- speakerOn
-
Sets whether to enable the speakerphone or earpiece:
true
: Enable device state monitoring. The audio route is the speakerphone.false
: Disable device state monitoring. The audio route is the earpiece.
Returns
- 0: Success.
- < 0: Failure.
SetExtensionProperty
Sets the properties of the extension.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetExtensionProperty(const FString& provider, const FString& extension, const FString& key, const FString& value, EMEDIA_SOURCE_TYPE type = EMEDIA_SOURCE_TYPE::UNKNOWN_MEDIA_SOURCE);
After enabling the extension, you can call this method to set the properties of the extension.
Call timing
Call this mehtod after calling EnableExtension.
Restrictions
If you want to set properties for multiple extensions, you need to call this method multiple times.
Parameters
- provider
- The name of the extension provider.
- extension
- The name of the extension.
- key
- The key of the extension.
- value
- The value of the extension key.
- type
- Source type of the extension. See EMEDIA_SOURCE_TYPE.
Returns
- 0: Success.
- < 0: Failure.
SetExtensionProviderProperty
Sets the properties of the extension provider.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetExtensionProviderProperty(const FString& provider, const FString& key, const FString& value);
You can call this method to set the attributes of the extension provider and initialize the relevant parameters according to the type of the provider.
Call timing
Call this method before EnableExtension and after RegisterExtension.
Restrictions
If you want to set the properties of the extension provider for multiple extensions, you need to call this method multiple times.
Parameters
- provider
- The name of the extension provider.
- key
- The key of the extension.
- value
- The value of the extension key.
Returns
- 0: Success.
- < 0: Failure.
SetHeadphoneEQParameters
Sets the low- and high-frequency parameters of the headphone equalizer.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetHeadphoneEQParameters(int lowGain, int highGain);
Details
In a spatial audio effect scenario, if the preset headphone equalization effect is not achieved after calling the SetHeadphoneEQPreset method, you can further adjust the headphone equalization effect by calling this method.
Parameters
- lowGain
- The low-frequency parameters of the headphone equalizer. The value range is [-10,10]. The larger the value, the deeper the sound.
- highGain
- The high-frequency parameters of the headphone equalizer. The value range is [-10,10]. The larger the value, the sharper the sound.
Returns
- 0: Success.
- < 0: Failure.
- -1: A general error occurs (no specified reason).
SetHeadphoneEQPreset
Sets the preset headphone equalization effect.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetHeadphoneEQPreset(FENUMWRAP_HEADPHONE_EQUALIZER_PRESET preset);
Details
This method is mainly used in spatial audio effect scenarios. You can select the preset headphone equalizer to listen to the audio to achieve the expected audio experience.
Parameters
- preset
- The preset headphone equalization effect. See FENUMWRAP_HEADPHONE_EQUALIZER_PRESET.
Returns
- 0: Success.
- < 0: Failure.
- -1: A general error occurs (no specified reason).
SetInEarMonitoringVolume
Sets the volume of the in-ear monitor.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetInEarMonitoringVolume(int volume);
Call timing
This method can be called either before or after joining the channel.
Restrictions
None.
Parameters
- volume
-
The volume of the user. The value range is [0,400].
- 0: Mute.
- 100: (Default) The original volume.
- 400: Four times the original volume (amplifying the audio signals by four times).
Returns
- 0: Success.
- < 0: Failure.
- -2: Invalid parameter settings, such as in-ear monitoring volume exceeding the valid range (< 0 or > 400).
SetLocalRenderMode
Updates the display mode of the local video view.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetLocalRenderMode(ERENDER_MODE_TYPE renderMode, EVIDEO_MIRROR_MODE_TYPE mirrorMode = EVIDEO_MIRROR_MODE_TYPE::VIDEO_MIRROR_MODE_AUTO);
After initializing the local video view, you can call this method to update its rendering and mirror modes. It affects only the video view that the local user sees and does not impact the publishing of the local video.
Call timing
- Ensure that you have called the SetupLocalVideo method to initialize the local video view before calling this method.
- During a call, you can call this method as many times as necessary to update the display mode of the local video view.
Restrictions
This method only takes effect on the primary camera (PRIMARY_CAMERA_SOURCE)
. In scenarios involving custom video capture or the use of alternative video sources, you need to use SetupLocalVideo instead of this method.
Parameters
- renderMode
-
The local video display mode. See ERENDER_MODE_TYPE.
- mirrorMode
-
The mirror mode of the local video view. See EVIDEO_MIRROR_MODE_TYPE.Attention: This parameter does not take effect. To achieve a mirror display effect, configure the mirror settings in Unreal Engine.Attention: If you use a front camera, the SDK enables the mirror mode by default; if you use a rear camera, the SDK disables the mirror mode by default.
Returns
- 0: Success.
- < 0: Failure.
SetLocalVideoMirrorMode
Sets the local video mirror mode.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetLocalVideoMirrorMode(EVIDEO_MIRROR_MODE_TYPE mirrorMode);
Details
- Deprecated:
- This method is deprecated.
Parameters
- mirrorMode
-
The local video mirror mode. See EVIDEO_MIRROR_MODE_TYPE.
Attention: This parameter does not take effect. To achieve a mirror display effect, configure the mirror settings in Unreal Engine.
Returns
- 0: Success.
- < 0: Failure.
SetLocalVoiceEqualization
Sets the local voice equalization effect.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetLocalVoiceEqualization(EAUDIO_EQUALIZATION_BAND_FREQUENCY bandFrequency, int bandGain);
Call timing
This method can be called either before or after joining the channel.
Restrictions
None.
Parameters
- bandFrequency
- The band frequency. The value ranges between 0 and 9; representing the respective 10-band center frequencies of the voice effects, including 31, 62, 125, 250, 500, 1k, 2k, 4k, 8k, and 16k Hz. See EAUDIO_EQUALIZATION_BAND_FREQUENCY.
- bandGain
- The gain of each band in dB. The value ranges between -15 and 15. The default value is 0.
Returns
- 0: Success.
- < 0: Failure.
SetLocalVoiceFormant
Set the formant ratio to change the timbre of human voice.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") int SetLocalVoiceFormant(const FString & formantRatio = "0.0");
Formant ratio affects the timbre of voice. The smaller the value, the deeper the sound will be, and the larger, the sharper. After you set the formant ratio, all users in the channel can hear the changed voice. If you want to change the timbre and pitch of voice at the same time, Agora recommends using this method together with SetLocalVoicePitch.
Applicable scenarios
You can call this method to set the formant ratio of local audio to change the timbre of human voice.
Call timing
This method can be called either before or after joining the channel.
Restrictions
None.
Parameters
- formantRatio
- The formant ratio. The value range is [-1.0, 1.0]. The default value is 0.0, which means do not change the timbre of the voice.Note: Agora recommends setting this value within the range of [-0.4, 0.6]. Otherwise, the voice may be seriously distorted.
Returns
- 0: Success.
- < 0: Failure.
SetLocalVoicePitch
Changes the voice pitch of the local speaker.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetLocalVoicePitch(float pitch);
Call timing
This method can be called either before or after joining the channel.
Restrictions
None.
Parameters
- pitch
- The local voice pitch. The value range is [0.5,2.0]. The lower the value, the lower the pitch. The default value is 1.0 (no change to the pitch).
Returns
- 0: Success.
- < 0: Failure.
SetLocalVoiceReverb
Sets the local voice reverberation.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetLocalVoiceReverb(EAUDIO_REVERB_TYPE reverbKey, int value);
Details
The SDK provides an easier-to-use method, SetAudioEffectPreset, to directly implement preset reverb effects for such as pop, R&B, and KTV.
Parameters
- reverbKey
- The reverberation key. Agora provides five reverberation keys, see EAUDIO_REVERB_TYPE.
- value
- The value of the reverberation key.
Returns
- 0: Success.
- < 0: Failure.
SetLogFile
Sets the log file.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetLogFile(const FString& filePath);
- Deprecated:
- This method is deprecated. Set the log file path by configuring the context parameter when calling Initialize.
Specifies an SDK output log file. The log file records all log data for the SDK’s operation.
Call timing
This method needs to be called immediately after Initialize, otherwise the output log may be incomplete.
Restrictions
Ensure that the directory for the log file exists and is writable.
Parameters
- filePath
- The complete path of the log files. These log files are encoded in UTF-8.
Returns
- 0: Success.
- < 0: Failure.
SetLogFileSize
Sets the log file size.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetLogFileSize(int fileSizeInKBytes);
Details
- Deprecated:
- Use the
logConfig
parameter in Initialize instead.
By default, the SDK generates five SDK log files and five API call log files with the following rules:
- The SDK log files are:
agorasdk.log
,agorasdk.1.log
,agorasdk.2.log
,agorasdk.3.log
, andagorasdk.4.log
. - The API call log files are:
agoraapi.log
,agoraapi.1.log
,agoraapi.2.log
,agoraapi.3.log
, andagoraapi.4.log
. - The default size of each SDK log file and API log file is 2,048 KB. These log files are encoded in UTF-8.
- The SDK writes the latest logs in
agorasdk.log
oragoraapi.log
. - When
agorasdk.log
is full, the SDK processes the log files in the following order:- Delete the
agorasdk.4.log
file (if any). - Rename
agorasdk.3.log
toagorasdk.4.log
. - Rename
agorasdk.2.log
toagorasdk.3.log
. - Rename
agorasdk.1.log
toagorasdk.2.log
. - Create a new
agorasdk.log
file.
- Delete the
- The overwrite rules for the
agoraapi.log
file are the same as foragorasdk.log
.
This method is used to set the size of the agorasdk.log
file only and does not effect the agoraapi.log file
.
Parameters
- fileSizeInKBytes
- The size (KB) of an
agorasdk.log
file. The value range is [128,20480]. The default value is 2,048 KB. If you setfileSizeInKByte
smaller than 128 KB, the SDK automatically adjusts it to 128 KB; if you setfileSizeInKByte
greater than 20,480 KB, the SDK automatically adjusts it to 20,480 KB.
Returns
- 0: Success.
- < 0: Failure.
SetLogFilter
Sets the log output level of the SDK.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetLogFilter(int filter);
Details
- Deprecated:
- Use logConfig in Initialize instead.
This method sets the output log level of the SDK. You can use one or a combination of the log filter levels. The log level follows the sequence of LOG_FILTER_OFF, LOG_FILTER_CRITICAL, LOG_FILTER_ERROR, LOG_FILTER_WARN, LOG_FILTER_INFO, and LOG_FILTER_DEBUG. Choose a level to see the logs preceding that level.
If, for example, you set the log level to LOG_FILTER_WARN, you see the logs within levels LOG_FILTER_CRITICAL, LOG_FILTER_ERROR and LOG_FILTER_WARN.
Parameters
- filter
-
The output log level of the SDK.
- LOG_FILTER_OFF(0): Do not output any log information.
- LOG_FILTER_DEBUG(0x080f): Output all log information. Set your log filter as DEBUG if you want to get the most complete log file.
- LOG_FILTER_INFO(0x0f): Output LOG_FILTER_CRITICAL, LOG_FILTER_ERROR, LOG_FILTER_WARN, and LOG_FILTER_INFO level log information. Agora recommends that you set the log level to this level.
- LOG_FILTER_WARN(0x0e): Output LOG_FILTER_CRITICAL, LOG_FILTER_ERROR and LOG_FILTER_WARN level log information.
- LOG_FILTER_ERROR(0x0c): Output LOG_FILTER_CRITICAL and LOG_FILTER_ERROR level log information.
- LOG_FILTER_CRITICAL(0x08): Output LOG_FILTER_CRITICAL level log information.
Returns
- 0: Success.
- < 0: Failure.
SetLogLevel
Sets the output log level of the SDK.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetLogLevel(ELOG_LEVEL level);
- Deprecated:
- This method is deprecated. Set the log file level by configuring the context parameter when calling Initialize.
Choose a level to see the logs preceding that level.
Parameters
- level
- The log level. See ELOG_LEVEL.
Returns
- 0: Success.
- < 0: Failure.
SetLowlightEnhanceOptions
Sets low-light enhancement.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetLowlightEnhanceOptions(bool enabled, const FLowlightEnhanceOptions& options, EMEDIA_SOURCE_TYPE type);
Details
The low-light enhancement feature can adaptively adjust the brightness value of the video captured in situations with low or uneven lighting, such as backlit, cloudy, or dark scenes. It restores or highlights the image details and improves the overall visual effect of the video.
You can call this method to enable the color enhancement feature and set the options of the color enhancement effect.
- Call this method after calling EnableVideo.
- Dark light enhancement has certain requirements for equipment performance. The low-light enhancement feature has certain performance requirements on devices. If your device overheats after you enable low-light enhancement, Agora recommends modifying the low-light enhancement options to a less performance-consuming level or disabling low-light enhancement entirely.
- Both this method and SetExtensionProperty can turn on low-light enhancement:
- When you use the SDK to capture video, Agora recommends this method (this method only works for video captured by the SDK).
- When you use an external video source to implement custom video capture, or send an external video source to the SDK, Agora recommends using SetExtensionProperty.
- This method relies on the image enhancement dynamic library
libagora_clear_vision_extension.dll
. If the dynamic library is deleted, the function cannot be enabled normally.
Parameters
- enabled
- Whether to enable low-light enhancement:
true
: Enable low-light enhancement.false
: (Default) Disable low-light enhancement.
- options
- The low-light enhancement options. See FLowlightEnhanceOptions.
- type
- The type of the video source. See EMEDIA_SOURCE_TYPE.
Returns
- 0: Success.
- < 0: Failure.
SetParameters
Provides technical preview functionalities or special customizations by configuring the SDK with JSON options.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetParameters(const FString& parameters);
Contact technical support to get the JSON configuration method.
Parameters
- parameters
- Pointer to the set parameters in a JSON string.
Returns
- 0: Success.
- < 0: Failure.
SetRemoteDefaultVideoStreamType
Sets the default video stream type to subscribe to.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetRemoteDefaultVideoStreamType(EVIDEO_STREAM_TYPE streamType);
- The SDK enables low-quality video stream adaptive mode (AUTO_SIMULCAST_STREAM) on the sender side by default, meaning only the high-quality video stream is transmitted. Only the receiver with the role of the host can call this method to initiate a low-quality video stream request. Once the sender receives the request, it starts automatically sending the low-quality video stream. At this point, all users in the channel can call this method to switch to low-quality video stream subscription mode.
- If the sender calls SetDualStreamMode and sets mode to DISABLE_SIMULCAST_STREAM (never send low-quality video stream), then calling this method will have no effect.
- If the sender calls SetDualStreamMode and sets mode to ENABLE_SIMULCAST_STREAM (always send low-quality video stream), both the host and audience receivers can call this method to switch to low-quality video stream subscription mode.
The SDK will dynamically adjust the size of the corresponding video stream based on the size of the video window to save bandwidth and computing resources. The default aspect ratio of the low-quality video stream is the same as that of the high-quality video stream. According to the current aspect ratio of the high-quality video stream, the system will automatically allocate the resolution, frame rate, and bitrate of the low-quality video stream.
Call timing
Call this method before joining a channel. The SDK does not support changing the default subscribed video stream type after joining a channel.
Restrictions
If you call both this method and SetRemoteVideoStreamType, the setting of SetRemoteVideoStreamType takes effect.
Parameters
- streamType
-
The default video-stream type. See EVIDEO_STREAM_TYPE.
Returns
- 0: Success.
- < 0: Failure.
SetRouteInCommunicationMode
Selects the audio playback route in communication audio mode.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetRouteInCommunicationMode(int route);
This method is used to switch the audio route from Bluetooth headphones to earpiece, wired headphones or speakers in communication audio mode ().
Call timing
This method can be called either before or after joining the channel.
Restrictions
Using this method and the SetEnableSpeakerphone method at the same time may cause conflicts. Agora recommends that you use the SetRouteInCommunicationMode method alone.
Parameters
- route
- The audio playback route you want to use:
- -1: The default audio route.
- 0: Headphones with microphone.
- 1: Handset.
- 2: Headphones without microphone.
- 3: Device's built-in speaker.
- 4: (Not supported yet) External speakers.
- 5: Bluetooth headphones.
- 6: USB device.
Returns
Without practical meaning.
SetupRemoteVideo
Initializes the video view of a remote user.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetupRemoteVideo(const FVideoCanvas& canvas);
Details
This method initializes the video view of a remote stream on the local device. It affects only the video view that the local user sees. Call this method to bind the remote video stream to a video view and to set the rendering and mirror modes of the video view.
You need to specify the ID of the remote user in this method. If the remote user ID is unknown to the application, set it after the app receives the OnUserJoined callback.
To unbind the remote user from the view, set the view parameter to NULL.
Once the remote user leaves the channel, the SDK unbinds the remote user.
- To update the rendering or mirror mode of the remote video view during a call, use the SetRemoteRenderMode method.
- When using the recording service, the app does not need to bind a view, as it does not send a video stream. If your app does not recognize the recording service, bind the remote user to the view when the SDK triggers the OnFirstRemoteVideoDecoded callback.
Parameters
- canvas
-
The remote video view and settings. See FVideoCanvas.
Returns
- 0: Success.
- < 0: Failure.
SetRemoteRenderMode
Updates the display mode of the video view of a remote user.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetRemoteRenderMode(int64 uid, ERENDER_MODE_TYPE renderMode, EVIDEO_MIRROR_MODE_TYPE mirrorMode);
Details
After initializing the video view of a remote user, you can call this method to update its rendering and mirror modes. This method affects only the video view that the local user sees.
- Call this method after initializing the remote view by calling the SetupRemoteVideo method.
- During a call, you can call this method as many times as necessary to update the display mode of the video view of a remote user.
Parameters
- userId
- The user ID of the remote user.
- renderMode
-
The rendering mode of the remote user view. For details, see ERENDER_MODE_TYPE.
- mirrorMode
-
The mirror mode of the remote user view. See EVIDEO_MIRROR_MODE_TYPE.
Attention: This parameter does not take effect. To achieve a mirror display effect, configure the mirror settings in Unreal Engine.
Returns
- 0: Success.
- < 0: Failure.
SetRemoteSubscribeFallbackOption
Sets the fallback option for the subscribed video stream based on the network conditions.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetRemoteSubscribeFallbackOption(ESTREAM_FALLBACK_OPTIONS option);
Details
An unstable network affects the audio and video quality in a video call or interactive live video streaming. If option is set as STREAM_FALLBACK_OPTION_VIDEO_STREAM_LOW or STREAM_FALLBACK_OPTION_AUDIO_ONLY, the SDK automatically switches the video from a high-quality stream to a low-quality stream or disables the video when the downlink network conditions cannot support both audio and video to guarantee the quality of the audio. Meanwhile, the SDK continuously monitors network quality and resumes subscribing to audio and video streams when the network quality improves.
When the subscribed video stream falls back to an audio-only stream, or recovers from an audio-only stream to an audio-video stream, the SDK triggers the OnRemoteSubscribeFallbackToAudioOnly callback.
Parameters
- option
- Fallback options for the subscribed stream. See ESTREAM_FALLBACK_OPTIONS.
Returns
- 0: Success.
- < 0: Failure.
SetRemoteVideoStreamType
Sets the video stream type to subscribe to.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetRemoteVideoStreamType(int64 uid, EVIDEO_STREAM_TYPE streamType);
Details
- The SDK enables low-quality video stream adaptive mode (AUTO_SIMULCAST_STREAM) on the sender side by default, meaning only the high-quality video stream is transmitted. Only the receiver with the role of the host can call this method to initiate a low-quality video stream request. Once the sender receives the request, it starts automatically sending the low-quality video stream. At this point, all users in the channel can call this method to switch to low-quality video stream subscription mode.
- If the sender calls SetDualStreamMode and sets mode to DISABLE_SIMULCAST_STREAM (never send low-quality video stream), then calling this method will have no effect.
- If the sender calls SetDualStreamMode and sets mode to ENABLE_SIMULCAST_STREAM (always send low-quality video stream), both the host and audience receivers can call this method to switch to low-quality video stream subscription mode.
The SDK will dynamically adjust the size of the corresponding video stream based on the size of the video window to save bandwidth and computing resources. The default aspect ratio of the low-quality video stream is the same as that of the high-quality video stream. According to the current aspect ratio of the high-quality video stream, the system will automatically allocate the resolution, frame rate, and bitrate of the low-quality video stream.
- You can call this method either before or after joining a channel.
- If you call both this method and SetRemoteDefaultVideoStreamType, the setting of this method takes effect.
Parameters
- uid
- The user ID.
- streamType
-
The video stream type, see EVIDEO_STREAM_TYPE.
Returns
- 0: Success.
- < 0: Failure.
SetRemoteVoicePosition
Sets the 2D position (the position on the horizontal plane) of the remote user's voice.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetRemoteVoicePosition(int64 uid, float pan, float gain);
Details
This method sets the 2D position and volume of a remote user, so that the local user can easily hear and identify the remote user's position.
When the local user calls this method to set the voice position of a remote user, the voice difference between the left and right channels allows the local user to track the real-time position of the remote user, creating a sense of space. This method applies to massive multiplayer online games, such as Battle Royale games.
- For this method to work, enable stereo panning for remote users by calling the EnableSoundPositionIndication method before joining a channel.
- For the best voice positioning, Agora recommends using a wired headset.
- Call this method after joining a channel.
Parameters
- uid
- The user ID of the remote user.
- pan
- The voice position of the remote user. The value ranges from -1.0 to 1.0:
- 0.0: (Default) The remote voice comes from the front.
- -1.0: The remote voice comes from the left.
- 1.0: The remote voice comes from the right.
- gain
- The volume of the remote user. The value ranges from 0.0 to 100.0. The default value is 100.0 (the original volume of the remote user). The smaller the value, the lower the volume.
Returns
- 0: Success.
- < 0: Failure.
SetScreenCaptureContentHint
Sets the content hint for screen sharing.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetScreenCaptureContentHint(EVIDEO_CONTENT_HINT contentHint);
Details
A content hint suggests the type of the content being shared, so that the SDK applies different optimization algorithms to different types of content. If you don't call this method, the default content hint is CONTENT_HINT_NONE.
Parameters
- contentHint
- The content hint for screen sharing. See EVIDEO_CONTENT_HINT.
Returns
- 0: Success.
- < 0: Failure.
- -2: The parameter is invalid.
- -8: The screen sharing state is invalid. Probably because you have shared other screens or windows. Try calling StopScreenCapture to stop the current sharing and start sharing the screen again.
SetScreenCaptureScenario
Sets the screen sharing scenario.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetScreenCaptureScenario(ESCREEN_SCENARIO_TYPE screenScenario);
Details
When you start screen sharing or window sharing, you can call this method to set the screen sharing scenario. The SDK adjusts the video quality and experience of the sharing according to the scenario.
Parameters
- screenScenario
- The screen sharing scenario. See ESCREEN_SCENARIO_TYPE.
Returns
- 0: Success.
- < 0: Failure.
SetSubscribeAudioBlocklist
Set the blocklist of subscriptions for audio streams.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetSubscribeAudioBlocklist(TArray<int64> uidList, int uidNumber);
Details
You can call this method to specify the audio streams of a user that you do not want to subscribe to.
- You can call this method either before or after joining a channel.
- The blocklist is not affected by the setting in MuteRemoteAudioStream,MuteAllRemoteAudioStreams, and autoSubscribeAudio in FChannelMediaOptions.
- Once the blocklist of subscriptions is set, it is effective even if you leave the current channel and rejoin the channel.
- If a user is added in the allowlist and blocklist at the same time, only the blocklist takes effect.
Parameters
- uidList
-
The user ID list of users that you do not want to subscribe to.
If you want to specify the audio streams of a user that you do not want to subscribe to, add the user ID in this list. If you want to remove a user from the blocklist, you need to call the SetSubscribeAudioBlocklist method to update the user ID list; this means you only add the uid of users that you do not want to subscribe to in the new user ID list.
- uidNumber
- The number of users in the user ID list.
Returns
- 0: Success.
- < 0: Failure.
SetSubscribeAudioAllowlist
Sets the allowlist of subscriptions for audio streams.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetSubscribeAudioAllowlist(TArray<int64> uidList, int uidNumber);
Details
You can call this method to specify the audio streams of a user that you want to subscribe to.
- You can call this method either before or after joining a channel.
- The allowlist is not affected by the setting in MuteRemoteAudioStream, MuteAllRemoteAudioStreams and autoSubscribeAudio in FChannelMediaOptions.
- Once the allowlist of subscriptions is set, it is effective even if you leave the current channel and rejoin the channel.
- If a user is added in the allowlist and blocklist at the same time, only the blocklist takes effect.
Parameters
- uidList
-
The user ID list of users that you want to subscribe to.
If you want to specify the audio streams of a user for subscription, add the user ID in this list. If you want to remove a user from the allowlist, you need to call the SetSubscribeAudioAllowlist method to update the user ID list; this means you only add the uid of users that you want to subscribe to in the new user ID list.
- uidNumber
- The number of users in the user ID list.
Returns
- 0: Success.
- < 0: Failure.
SetSubscribeVideoBlocklist
Set the blocklist of subscriptions for video streams.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetSubscribeVideoBlocklist(TArray<int64> uidList, int uidNumber);
Details
You can call this method to specify the video streams of a user that you do not want to subscribe to.
- You can call this method either before or after joining a channel.
- The blocklist is not affected by the setting in MuteRemoteVideoStream, MuteAllRemoteVideoStreams and autoSubscribeAudio in FChannelMediaOptions.
- Once the blocklist of subscriptions is set, it is effective even if you leave the current channel and rejoin the channel.
- If a user is added in the allowlist and blocklist at the same time, only the blocklist takes effect.
Parameters
- uidList
-
The user ID list of users that you do not want to subscribe to.
If you want to specify the video streams of a user that you do not want to subscribe to, add the user ID of that user in this list. If you want to remove a user from the blocklist, you need to call the SetSubscribeVideoBlocklist method to update the user ID list; this means you only add the uid of users that you do not want to subscribe to in the new user ID list.
- uidNumber
- The number of users in the user ID list.
Returns
- 0: Success.
- < 0: Failure.
SetSubscribeVideoAllowlist
Set the allowlist of subscriptions for video streams.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetSubscribeVideoAllowlist(TArray<int64> uidList, int uidNumber);
Details
You can call this method to specify the video streams of a user that you want to subscribe to.
- You can call this method either before or after joining a channel.
- The allowlist is not affected by the setting in MuteRemoteVideoStream, MuteAllRemoteVideoStreams and autoSubscribeAudio in FChannelMediaOptions.
- Once the allowlist of subscriptions is set, it is effective even if you leave the current channel and rejoin the channel.
- If a user is added in the allowlist and blocklist at the same time, only the blocklist takes effect.
Parameters
- uidList
-
The user ID list of users that you want to subscribe to.
If you want to specify the video streams of a user for subscription, add the user ID of that user in this list. If you want to remove a user from the allowlist, you need to call the SetSubscribeVideoAllowlist method to update the user ID list; this means you only add the uid of users that you want to subscribe to in the new user ID list.
- uidNumber
- The number of users in the user ID list.
Returns
- 0: Success.
- < 0: Failure.
SetVideoDenoiserOptions
Sets video noise reduction.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetVideoDenoiserOptions(bool enabled, const FVideoDenoiserOptions& options, EMEDIA_SOURCE_TYPE type);
Details
Underlit environments and low-end video capture devices can cause video images to contain significant noise, which affects video quality. In real-time interactive scenarios, video noise also consumes bitstream resources and reduces encoding efficiency during encoding.
You can call this method to enable the video noise reduction feature and set the options of the video noise reduction effect.
- Call this method after calling EnableVideo.
- Video noise reduction has certain requirements for equipment performance. If your device overheats after you enable video noise reduction, Agora recommends modifying the video noise reduction options to a less performance-consuming level or disabling video noise reduction entirely.
- Both this method and SetExtensionProperty can turn on video noise reduction function:
- When you use the SDK to capture video, Agora recommends this method (this method only works for video captured by the SDK).
- When you use an external video source to implement custom video capture, or send an external video source to the SDK, Agora recommends using SetExtensionProperty.
- This method relies on the image enhancement dynamic library
libagora_clear_vision_extension.dll
. If the dynamic library is deleted, the function cannot be enabled normally.
Parameters
- enabled
- Whether to enable video noise reduction:
true
: Enable video noise reduction.false
: (Default) Disable video noise reduction.
- options
- The video noise reduction options. See FVideoDenoiserOptions.
- type
- The type of the video source. See EMEDIA_SOURCE_TYPE.
Returns
- 0: Success.
- < 0: Failure.
SetVideoEncoderConfiguration
Sets the video encoder configuration.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetVideoEncoderConfiguration(const FVideoEncoderConfiguration& config);
Sets the encoder configuration for the local video. Each configuration profile corresponds to a set of video parameters, including the resolution, frame rate, and bitrate.
Call timing
You can call this method either before or after joining a channel. If the user does not need to reset the video encoding properties after joining the channel, Agora recommends calling this method before EnableVideo to reduce the time to render the first video frame.
Restrictions
- The config specified in this method is the maximum value under ideal network conditions. If the video engine cannot render the video using the specified config due to unreliable network conditions, the parameters further down the list are considered until a successful configuration is found.
Parameters
- config
- Video profile. See FVideoEncoderConfiguration.
Returns
- 0: Success.
- < 0: Failure.
SetVideoScenario
Sets video application scenarios.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetVideoScenario(EVIDEO_APPLICATION_SCENARIO_TYPE scenarioType);
Details
After successfully calling this method, the SDK will automatically enable the best practice strategies and adjust key performance metrics based on the specified scenario, to optimize the video experience.
Parameters
- scenarioType
- The type of video application scenario. See EVIDEO_APPLICATION_SCENARIO_TYPE.APPLICATION_SCENARIO_MEETING (1) is suitable for meeting scenarios. The SDK automatically enables the following strategies:
- In meeting scenarios where low-quality video streams are required to have a high bitrate, the SDK automatically enables multiple technologies used to deal with network congestions, to enhance the performance of the low-quality streams and to ensure the smooth reception by subscribers.
- The SDK monitors the number of subscribers to the high-quality video stream in real time and dynamically adjusts its configuration based on the number of subscribers.
- If nobody subscribers to the high-quality stream, the SDK automatically reduces its bitrate and frame rate to save upstream bandwidth.
- If someone subscribes to the high-quality stream, the SDK resets the high-quality stream to the FVideoEncoderConfiguration configuration used in the most recent calling of SetVideoEncoderConfiguration. If no configuration has been set by the user previously, the following values are used:
- Resolution: (Windows and macOS) 1280 Ă— 720; (Android and iOS) 960 Ă— 540
- Frame rate: 15 fps
- Bitrate: (Windows and macOS) 1600 Kbps; (Android and iOS) 1000 Kbps
- The SDK monitors the number of subscribers to the low-quality video stream in real time and dynamically enables or disables it based on the number of subscribers.Note: If the user has called SetDualStreamMode to set that never send low-quality video stream (DISABLE_SIMULCAST_STREAM), the dynamic adjustment of the low-quality stream in meeting scenarios will not take effect.
- If nobody subscribes to the low-quality stream, the SDK automatically disables it to save upstream bandwidth.
- If someone subscribes to the low-quality stream, the SDK enables the low-quality stream and resets it to the FSimulcastStreamConfig configuration used in the most recent calling of SetDualStreamMode. If no configuration has been set by the user previously, the following values are used:
- Resolution: 480 Ă— 272
- Frame rate: 15 fps
- Bitrate: 500 Kbps
APPLICATION_SCENARIO_1V1 (2) is suitable for 1v1 video call scenarios. To meet the requirements for low latency and high-quality video in this scenario, the SDK optimizes its strategies, improving performance in terms of video quality, first frame rendering, latency on mid-to-low-end devices, and smoothness under weak network conditions.
Returns
- 0: Success.
- < 0: Failure.
- -1: A general error occurs (no specified reason).
- -4: Video application scenarios are not supported. Possible reasons include that you use the Voice SDK instead of the Video SDK.
- -7: The IRtcEngine object has not been initialized. You need to initialize the IRtcEngine object before calling this method.
SetupLocalVideo
Initializes the local video view.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetupLocalVideo(const FVideoCanvas& canvas);
This method initializes the video view of a local stream on the local device. It only affects the video seen by the local user and does not impact the publishing of the local video. Call this method to bind the local video stream to a video view (view) and to set the rendering and mirror modes of the video view.
The binding remains valid after leaving the channel. To stop rendering or unbind the local video from the view, set view as NULL.
- To update only the rendering or mirror mode of the local video view during a call, call SetLocalRenderMode instead.
Applicable scenarios
After initialization, call this method to set the local video and then join the channel.
In real-time interactive scenarios, if you need to simultaneously view multiple preview frames in the local video preview, and each frame is at a different observation position along the video link, you can repeatedly call this method to set different views and set different observation positions for each view. For example, by setting the video source to the camera and then configuring two views with position setting to POSITION_POST_CAPTURER_ORIGIN and POSITION_POST_CAPTURER, you can simultaneously preview the raw, unprocessed video frame and the video frame that has undergone preprocessing (image enhancement effects, virtual background, watermark) in the local video preview.
Call timing
You can call this method either before or after joining a channel.
Restrictions
None.
Parameters
- canvas
- The local video view and settings. See FVideoCanvas.
Returns
- 0: Success.
- < 0: Failure.
SetVoiceBeautifierParameters
Sets parameters for the preset voice beautifier effects.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetVoiceBeautifierParameters(FENUMWRAP_VOICE_BEAUTIFIER_PRESET preset, int param1, int param2);
Details
Call this method to set a gender characteristic and a reverberation effect for the singing beautifier effect. This method sets parameters for the local user who sends an audio stream. After setting the audio parameters, all users in the channel can hear the effect.
- Call SetAudioScenario to set the audio scenario to high-quality audio scenario, namely AUDIO_SCENARIO_GAME_STREAMING(3).
- Call SetAudioProfileAndScenario to set the profile parameter to AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4) or AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5).
- You can call this method either before or after joining a channel.
- Do not set the profile parameter in SetAudioProfileAndScenario to AUDIO_PROFILE_SPEECH_STANDARD(1) or AUDIO_PROFILE_IOT(6), or the method does not take effect.
- This method has the best effect on human voice processing, and Agora does not recommend calling this method to process audio data containing music.
- After calling SetVoiceBeautifierParameters, Agora does not recommend calling the following methods, otherwise the effect set by SetVoiceBeautifierParameters will be overwritten:
- This method relies on the voice beautifier dynamic library
libagora_audio_beauty_extension.dll
. If the dynamic library is deleted, the function cannot be enabled normally.
Parameters
- preset
- The option for the preset audio effect:
SINGING_BEAUTIFIER
: The singing beautifier effect.
- param1
- The gender characteristics options for the singing voice:
1
: A male-sounding voice.2
: A female-sounding voice.
- param2
- The reverberation effect options for the singing voice:
1
: The reverberation effect sounds like singing in a small room.2
: The reverberation effect sounds like singing in a large room.3
: The reverberation effect sounds like singing in a hall.
Returns
- 0: Success.
- < 0: Failure.
SetVoiceBeautifierPreset
Sets a preset voice beautifier effect.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetVoiceBeautifierPreset(FENUMWRAP_VOICE_BEAUTIFIER_PRESET preset);
Call this method to set a preset voice beautifier effect for the local user who sends an audio stream. After setting a voice beautifier effect, all users in the channel can hear the effect. You can set different voice beautifier effects for different scenarios.
Call timing
This method can be called either before or after joining the channel.
- Call SetAudioScenario to set the audio scenario to high-quality audio scenario, namely AUDIO_SCENARIO_GAME_STREAMING(3).
- Call SetAudioProfileAndScenario to set the profile parameter to AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4) or AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5).
Restrictions
- Do not set the profile parameter in SetAudioProfileAndScenario to AUDIO_PROFILE_SPEECH_STANDARD(1) or AUDIO_PROFILE_IOT(6), or the method does not take effect.
- This method has the best effect on human voice processing, and Agora does not recommend calling this method to process audio data containing music.
- After calling SetVoiceBeautifierPreset, Agora does not recommend calling the following methods, otherwise the effect set by SetVoiceBeautifierPreset will be overwritten:
- This method relies on the voice beautifier dynamic library
libagora_audio_beauty_extension.dll
. If the dynamic library is deleted, the function cannot be enabled normally.
Parameters
- preset
-
The preset voice beautifier effect options: FENUMWRAP_VOICE_BEAUTIFIER_PRESET.
Returns
- 0: Success.
- < 0: Failure.
SetVoiceConversionPreset
Sets a preset voice beautifier effect.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetVoiceConversionPreset(FENUMWRAP_VOICE_CONVERSION_PRESET preset);
Call this method to set a preset voice changing effect for the local user who publishes an audio stream in a channel. After setting the voice changing effect, all users in the channel can hear the effect. You can set different voice changing effects for the user depending on different scenarios.
Call timing
This method can be called either before or after joining the channel.
- Call SetAudioScenario to set the audio scenario to high-quality audio scenario, namely AUDIO_SCENARIO_GAME_STREAMING(3).
- Call SetAudioProfileAndScenario to set the profile parameter to AUDIO_PROFILE_MUSIC_HIGH_QUALITY(4) or AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO(5).
Restrictions
- Do not set the profile parameter in SetAudioProfileAndScenario to AUDIO_PROFILE_SPEECH_STANDARD(1) or AUDIO_PROFILE_IOT(6), or the method does not take effect.
- This method has the best effect on human voice processing, and Agora does not recommend calling this method to process audio data containing music.
- After calling SetVoiceConversionPreset, Agora does not recommend you to call the following methods, otherwise the effect set by SetVoiceConversionPreset will be overwritten:
- This method relies on the voice beautifier dynamic library
libagora_audio_beauty_extension.dll
. If the dynamic library is deleted, the function cannot be enabled normally.
Parameters
- preset
-
The options for the preset voice beautifier effects: FENUMWRAP_VOICE_CONVERSION_PRESET.
Returns
- 0: Success.
- < 0: Failure.
SetVolumeOfEffect
Gets the volume of a specified audio effect file.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SetVolumeOfEffect(int soundId, int volume);
Call timing
Call this method after PlayEffect.
Restrictions
None.
Parameters
- soundId
- The ID of the audio effect. The ID of each audio effect file is unique.
- volume
- The playback volume. The value range is [0, 100]. The default value is 100, which represents the original volume.
Returns
- 0: Success.
- < 0: Failure.
StartAudioMixing
Starts playing the music file.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine") int StartAudioMixing(const FString & filePath, bool loopback, int cycle, int startPos = 0);
For the audio file formats supported by this method, see What formats of audio files does the Agora RTC SDK support. If the local music file does not exist, the SDK does not support the file format, or the the SDK cannot access the music file URL, the SDK reports AUDIO_MIXING_REASON_CAN_NOT_OPEN.
Call timing
You can call this method either before or after joining a channel.
Restrictions
- If you call this method to play short sound effect files, you may encounter playback failure. Agora recommends using PlayEffect instead to play such files.
- If you need to call this method multiple times, ensure that the time interval between calling this method is more than 500 ms.
- On Android, there are following considerations:
- To use this method, ensure that the Android device is v4.2 or later, and the API version is v16 or later.
- If you need to play an online music file, Agora does not recommend using the redirected URL address. Some Android devices may fail to open a redirected URL address.
- If you call this method on an emulator, ensure that the music file is in the
/sdcard/
directory and the format is MP3.
Parameters
- filePath
- File path:
- Android: The file path, which needs to be accurate to the file name and suffix. Agora supports URL addresses, absolute paths, or file paths that start with
/assets/
. You might encounter permission issues if you use an absolute path to access a local file, so Agora recommends using a URI address instead. For example: content://com.android.providers.media.documents/document/audio%3A14441
- Windows: The absolute path or URL address (including the suffixes of the filename) of the audio effect file. For example
: C:\music\audio.mp4
.
- Android: The file path, which needs to be accurate to the file name and suffix. Agora supports URL addresses, absolute paths, or file paths that start with
- loopback
-
Whether to only play music files on the local client:
true
: Only play music files on the local client so that only the local user can hear the music.false
: Publish music files to remote clients so that both the local user and remote users can hear the music.
- cycle
-
The number of times the music file plays.
- >0: The number of times for playback. For example, 1 represents playing 1 time.
- -1: Play the audio file in an infinite loop.
- startPos
- The playback position (ms) of the music file.
Returns
- 0: Success.
- < 0: Failure.
- -1: A general error occurs (no specified reason).
- -2: The parameter is invalid.
- -3: The SDK is not ready.
- The audio module is disabled.
- The program is not complete.
- The initialization of IRtcEngine fails. Reinitialize the IRtcEngine.
StartAudioRecording
Starts audio recording on the client and sets recording configurations.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int StartAudioRecording(const FAudioRecordingConfiguration& config);
- WAV: High-fidelity files with typically larger file sizes. For example, if the sample rate is 32,000 Hz, the file size for 10-minute recording is approximately 73 MB.
- AAC: Low-fidelity files with typically smaller file sizes. For example, if the sample rate is 32,000 Hz and the recording quality is AUDIO_RECORDING_QUALITY_MEDIUM, the file size for 10-minute recording is approximately 2 MB.
Once the user leaves the channel, the recording automatically stops.
Call timing
Call this method after joining a channel.
Restrictions
None.
Parameters
- config
- Recording configurations. See FAudioRecordingConfiguration.
Returns
- 0: Success.
- < 0: Failure.
StartCameraCapture
Starts camera capture.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int StartCameraCapture(EVIDEO_SOURCE_TYPE sourceType, const FCameraCapturerConfiguration& config);
Details
You can call this method to start capturing video from one or more cameras by specifying sourceType.
true
before calling this method.Parameters
- sourceType
-
The type of the video source. See EVIDEO_SOURCE_TYPE.
Note:- On iOS devices, you can capture video from up to 2 cameras, provided the device has multiple cameras or supports external cameras.
- On Android devices, you can capture video from up to 4 cameras, provided the device has multiple cameras or supports external cameras.
- On the desktop platforms, you can capture video from up to 4 cameras.
- config
-
The configuration of the video capture. See FCameraCapturerConfiguration.
Note: On the iOS platform, this parameter has no practical function. Use the config parameter in EnableMultiCamera instead to set the video capture configuration.
Returns
- 0: Success.
- < 0: Failure.
StopCameraCapture
Stops camera capture.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int StopCameraCapture(EVIDEO_SOURCE_TYPE sourceType);
Details
After calling StartCameraCapture to start capturing video through one or more cameras, you can call this method and set the sourceType parameter to stop the capture from the specified cameras.
false
.Parameters
- sourceType
- The type of the video source. See EVIDEO_SOURCE_TYPE.
Returns
- 0: Success.
- < 0: Failure.
StartEchoTest
Starts an audio device loopback test.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int StartEchoTest(const FEchoTestConfiguration& config);
To test whether the user's local sending and receiving streams are normal, you can call this method to perform an audio and video call loop test, which tests whether the audio and video devices and the user's upstream and downstream networks are working properly.
After starting the test, the user needs to make a sound or face the camera. The audio or video is output after about two seconds. If the audio playback is normal, the audio device and the user's upstream and downstream networks are working properly; if the video playback is normal, the video device and the user's upstream and downstream networks are working properly.
Call timing
You can call this method either before or after joining a channel.
Restrictions
- When calling in a channel, make sure that no audio or video stream is being published.
- After calling this method, call StopEchoTest to end the test; otherwise, the user cannot perform the next audio and video call loop test and cannot join the channel.
- In live streaming scenarios, this method only applies to hosts.
Parameters
- config
- The configuration of the audio and video call loop test. See FEchoTestConfiguration.
Returns
- 0: Success.
- < 0: Failure.
StartLastmileProbeTest
Starts the last mile network probe test.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int StartLastmileProbeTest(const FLastmileProbeConfig& config);
This method starts the last-mile network probe test before joining a channel to get the uplink and downlink last mile network statistics, including the bandwidth, packet loss, jitter, and round-trip time (RTT).
Call timing
Do not call other methods before receiving the OnLastmileQuality and OnLastmileProbeResult callbacks. Otherwise, the callbacks may be interrupted.
Restrictions
None.
Parameters
- config
- The configurations of the last-mile network probe test. See FLastmileProbeConfig.
Returns
- 0: Success.
- < 0: Failure.
StartLocalVideoTranscoder
Starts the local video mixing.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int StartLocalVideoTranscoder(const FLocalTranscoderConfiguration& config);
After calling this method, you can merge multiple video streams into one video stream locally. For example, you can merge the video streams captured by the camera, screen sharing, media player, remote video, video files, images, etc. into one video stream, and then publish the mixed video stream to the channel.
Applicable scenarios
You can enable the local video mixing function in scenarios such as remote conferences, live streaming, and online education, which allows users to view and manage multiple videos more conveniently, and supports portrait-in-picture effect and other functions.
- Call EnableVirtualBackground, and set the custom background image to BACKGROUND_NONE, that is, separate the portrait and the background in the video captured by the camera.
- Call StartScreenCaptureBySourceType to start capturing the screen sharing video stream.
- Call this method and set the video source for capturing portraits as one of the video sources participating in the local video mixing, picture-in-picture of the portrait can be achived in the mixed video.
Call timing
- If you need to mix the locally collected video streams, you need to call this method after StartCameraCapture or StartScreenCaptureBySourceType.
- If you want to publish the mixed video stream to the channel, you need to set publishTranscodedVideoTrack in FChannelMediaOptions to
true
when calling JoinChannelWithOptions or UpdateChannelMediaOptions.
Restrictions
- Local video mixing requires more CPU resources. Therefore, Agora recommends enabling this function on devices with higher performance.
- If you need to mix locally captured video streams, the SDK supports the following capture combinations:
- On the Windows platform, it supports up to 4 video streams captured by cameras + 4 screen sharing streams.
- On the macOS platform, it supports up to 4 video streams captured by cameras + 1 screen sharing stream.
- On Android and iOS platforms, it supports video streams captured by up to 2 cameras (the device itself needs to support dual cameras or supports external cameras) + 1 screen sharing stream.
- When configuring the local video mixing, it is necessary to ensure that the layer number of the video stream capturing the portrait is greater than the layer number of the screen sharing stream. Otherwise, the portrait will be covered by the screen sharing and will not be displayed in the final mixed video stream.
Parameters
- config
- Configuration of the local video mixing, see FLocalTranscoderConfiguration.Attention:
- The maximum resolution of each video stream participating in the local video mixing is 4096 Ă— 2160. If this limit is exceeded, video mixing does not take effect.
- The maximum resolution of the mixed video stream is 4096 Ă— 2160.
Returns
- 0: Success.
- < 0: Failure.
StartMediaRenderingTracing
Enables tracing the video frame rendering process.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int StartMediaRenderingTracing();
Details
The SDK starts tracing the rendering status of the video frames in the channel from the moment this method is successfully called and reports information about the event through the OnVideoRenderingTracingResult callback.
- By default, the SDK starts tracing the video rendering event automatically when the local user successfully joins the channel. You can call this method at an appropriate time according to the actual application scenario to customize the tracing process.
- After the local user leaves the current channel, the SDK automatically resets the time point to the next time when the user successfully joins the channel.
Applicable scenarios
Agora recommends that you use this method in conjunction with the UI settings (such as buttons and sliders) in your app to improve the user experience. For example, call this method when the user clicks the Join Channel
button, and then get the indicators in the video frame rendering process through the OnVideoRenderingTracingResult callback, so as to optimize the indicators accordingly.
Returns
- 0: Success.
- < 0: Failure.
- -7: The method is called before IRtcEngine is initialized.
StartOrUpdateChannelMediaRelay
Starts relaying media streams across channels or updates channels for media relay.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int StartOrUpdateChannelMediaRelay(const FChannelMediaRelayConfiguration& configuration);
Details
The first successful call to this method starts relaying media streams from the source channel to the destination channels. To relay the media stream to other channels, or exit one of the current media relays, you can call this method again to update the destination channels. This feature supports relaying media streams to a maximum of six destination channels.
- If the OnChannelMediaRelayStateChanged callback returns RELAY_STATE_RUNNING (2) and RELAY_OK (0), it means that the SDK starts relaying media streams from the source channel to the destination channel.
- If the OnChannelMediaRelayStateChanged callback returns RELAY_STATE_FAILURE (3), an exception occurs during the media stream relay.
- Call this method after joining the channel.
- This method takes effect only when you are a host in a live streaming channel.
- The relaying media streams across channels function needs to be enabled by contacting technical support.
- Agora does not support string user accounts in this API.
Parameters
- configuration
- The configuration of the media stream relay. See FChannelMediaRelayConfiguration.
Returns
- 0: Success.
- < 0: Failure.
- -1: A general error occurs (no specified reason).
- -2: The parameter is invalid.
- -8: Internal state error. Probably because the user is not a broadcaster.
StartPreview
Enables the local video preview and specifies the video source for the preview.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int StartPreview(EVIDEO_SOURCE_TYPE sourceType = EVIDEO_SOURCE_TYPE::VIDEO_SOURCE_CAMERA_PRIMARY);
This method is used to start local video preview and specify the video source that appears in the preview screen.
Call timing
This method must be called after EnableVideo and SetupLocalVideo.
Restrictions
- The local preview enables the mirror mode by default.
- After leaving the channel, local preview remains enabled. You need to call StopPreview to disable local preview.
Parameters
- sourceType
- The type of the video source. See EVIDEO_SOURCE_TYPE.
Returns
- 0: Success.
- < 0: Failure.
StartRhythmPlayer
Enables the virtual metronome.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int StartRhythmPlayer(const FString& sound1, const FString& sound2, const FAgoraRhythmPlayerConfig& config);
- After enabling the virtual metronome, the SDK plays the specified audio effect file from the beginning, and controls the playback duration of each file according to beatsPerMinute you set in FAgoraRhythmPlayerConfig. For example, if you set beatsPerMinute as
60
, the SDK plays one beat every second. If the file duration exceeds the beat duration, the SDK only plays the audio within the beat duration. - By default, the sound of the virtual metronome is published in the channel. If you want the sound to be heard by the remote users, you can set publishRhythmPlayerTrack in FChannelMediaOptions as
true
.
Applicable scenarios
In music education, physical education and other scenarios, teachers usually need to use a metronome so that students can practice with the correct beat. The meter is composed of a downbeat and upbeats. The first beat of each measure is called a downbeat, and the rest are called upbeats.
Call timing
This method can be called either before or after joining the channel.
Restrictions
None.
Parameters
- sound1
- The absolute path or URL address (including the filename extensions) of the file for the downbeat. For example,
C:\music\audio.mp4
. For the audio file formats supported by this method, see What formats of audio files does the Agora RTC SDK support. - sound2
- The absolute path or URL address (including the filename extensions) of the file for the upbeats. For example,
C:\music\audio.mp4
. For the audio file formats supported by this method, see What formats of audio files does the Agora RTC SDK support. - config
- The metronome configuration. See FAgoraRhythmPlayerConfig.
Returns
- 0: Success.
- < 0: Failure.
- -22: Cannot find audio effect files. Please set the correct paths for sound1 and sound2.
StartRtmpStreamWithoutTranscoding
Starts pushing media streams to a CDN without transcoding.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int StartRtmpStreamWithoutTranscoding(const FString& url);
Details
Agora recommends that you use the server-side Media Push function. For details, see Use RESTful API.
You can call this method to push an audio or 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.
- Call this method after joining a channel.
- Only hosts in the LIVE_BROADCASTING profile can call this method.
- If you want to retry pushing streams after a failed push, make sure to call StopRtmpStream first, then call this method to retry pushing streams; otherwise, the SDK returns the same error code as the last failed push.
Parameters
- url
- The address of Media Push. The format is RTMP or RTMPS. The character length cannot exceed 1024 bytes. Special characters such as Chinese characters are not supported.
Returns
- 0: Success.
- < 0: Failure.
- -2: The URL or configuration of transcoding is invalid; check your URL and transcoding configurations.
- -7: The SDK is not initialized before calling this method.
- -19: The Media Push URL is already in use; use another URL instead.
StartRtmpStreamWithTranscoding
Starts Media Push and sets the transcoding configuration.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int StartRtmpStreamWithTranscoding(const FString& url, const FLiveTranscoding& transcoding);
Details
Agora recommends that you use the server-side Media Push function. For details, see Use RESTful API.
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.
Under one Agora project, the maximum number of concurrent tasks to push media streams is 200 by default. If you need a higher quota, contact technical support.
After you call this method, the SDK triggers the OnRtmpStreamingStateChanged callback on the local client to report the state of the streaming.
- Call this method after joining a channel.
- Only hosts in the LIVE_BROADCASTING profile can call this method.
- If you want to retry pushing streams after a failed push, make sure to call StopRtmpStream first, then call this method to retry pushing streams; otherwise, the SDK returns the same error code as the last failed push.
Parameters
- url
- The address of Media Push. 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 Media Push. See FLiveTranscoding.
Returns
- 0: Success.
- < 0: Failure.
- -2: The URL or configuration of transcoding is invalid; check your URL and transcoding configurations.
- -7: The SDK is not initialized before calling this method.
- -19: The Media Push URL is already in use; use another URL instead.
StartScreenCapture
Starts screen capture.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int StartScreenCapture(const FScreenCaptureParameters2& captureParams);
- This method is for Android and iOS only.
- The billing for the screen sharing stream is based on the dimensions in FScreenVideoParameters:
- When you do not pass in a value, Agora bills you at 1280 Ă— 720.
- When you pass in a value, Agora bills you at that value.
Applicable scenarios
In the screen sharing scenario, you need to call this method to start capturing the screen video stream. For implementation guidance of screen sharing, please refer to .
Call timing
- Call this method first and then call JoinChannelWithOptions to join channel and set publishScreenCaptureVideo to
true
to start screen sharing. - Call this method after joining a channel, then call UpdateChannelMediaOptions and set publishScreenCaptureVideo to
true
to start screen sharing.
Restrictions
- On the iOS platform, screen sharing is only available on iOS 12.0 and later.
- If you are using the custom audio source instead of the SDK to capture audio, Agora recommends you add the keep-alive processing logic to your application to avoid screen sharing stopping when the application goes to the background.
- This feature requires high-performance device, and Agora recommends that you use it on iPhone X and later models.
- This method relies on the iOS screen sharing dynamic library
AgoraReplayKitExtension.xcframework
. If the dynamic library is deleted, screen sharing cannot be enabled normally. - On the Android platform, if the user has not granted the app screen capture permission, the SDK reports the OnPermissionError
(2)
callback. - On Android 9 and later, to avoid the application being killed by the system after going to the background, Agora recommends you add the foreground service
android.permission.FOREGROUND_SERVICE
to the/app/Manifests/AndroidManifest.xml
file. - Due to performance limitations, screen sharing is not supported on Android TV.
- Due to system limitations, if you are using Huawei phones, do not adjust the video encoding resolution of the screen sharing stream during the screen sharing, or you could experience crashes.
- Due to system limitations, some Xiaomi devices do not support capturing system audio during screen sharing.
- To avoid system audio capture failure when sharing screen, Agora recommends that you set the audio application scenario to AUDIO_SCENARIO_GAME_STREAMING by using the SetAudioScenario method before joining the channel.
Parameters
- captureParams
- The screen sharing encoding parameters. The default video dimension is 1920 x 1080, that is, 2,073,600 pixels. Agora uses the value of this parameter to calculate the charges. See FScreenCaptureParameters2.
Returns
- 0: Success.
- < 0: Failure.
- -2 (iOS platform): Empty parameter.
- -2 (Android platform): The system version is too low. Ensure that the Android API level is not lower than 21.
- -3 (Android platform): Unable to capture system audio. Ensure that the Android API level is not lower than 29.
StartScreenCaptureBySourceType
Starts screen capture from the specified video source.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int StartScreenCaptureBySourceType(EVIDEO_SOURCE_TYPE sourceType, const FScreenCaptureConfiguration& config);
Applicable scenarios
In the screen sharing scenario, you need to call this method to start capturing the screen video stream.
- StartScreenCapture/StartScreenCaptureByDisplayId/StartScreenCaptureByWindowId: Only supports capturing a single screen or window, suitable for scenarios where only a single screen is shared.
- StartScreenCaptureBySourceType: Supports specifying multiple video sources to capture multiple screen sharing streams, used for local video mixing or multi-channel scenarios.
Call timing
- Call this method first and then call JoinChannelWithOptions to join channel and set publishScreenCaptureVideo to
true
to start screen sharing. - Call this method after joining a channel, then call UpdateChannelMediaOptions and set publishScreenCaptureVideo to
true
to start screen sharing.
Restrictions
- If you start screen capture by calling this method, you need to call StopScreenCaptureBySourceType to stop screen capture.
- On the Windows platform, it supports up to four screen capture video streams.
- On the macOS platform, it supports only one screen capture video stream.
Parameters
- sourceType
- The type of the video source. See EVIDEO_SOURCE_TYPE.Attention: On the macOS platform, this parameter can only be set to VIDEO_SOURCE_SCREEN (2).
- config
- The configuration of the captured screen. See FScreenCaptureConfiguration.
Returns
- 0: Success.
- < 0: Failure.
StartScreenCaptureByDisplayId
Captures the screen by specifying the display ID.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int StartScreenCaptureByDisplayId(int64 displayId, const FRectangle& regionRect, const FScreenCaptureParameters& captureParams);
Captures the video stream of a screen or a part of the screen area.
Applicable scenarios
In the screen sharing scenario, you need to call this method to start capturing the screen video stream. For implementation guidance of screen sharing, please refer to .
Call timing
- Call this method before joining a channel, and then call JoinChannelWithOptions to join a channel and set publishScreenTrack or publishSecondaryScreenTrack to
true
to start screen sharing. - Call this method after joining a channel, and then call UpdateChannelMediaOptions to join a channel and set publishScreenTrack or publishSecondaryScreenTrack to
true
to start screen sharing.
Restrictions
None.
Parameters
- displayId
- The display ID of the screen to be shared.Note: For the Windows platform, if you need to simultaneously share two screens (main screen and secondary screen), you can set displayId to
-1
when calling this method. - regionRect
- (Optional) Sets the relative location of the region to the screen. Pass in
nil
to share the entire screen. See FRectangle. - captureParams
- Screen sharing configurations. The default video dimension is 1920 x 1080, that is, 2,073,600 pixels. Agora uses the value of this parameter to calculate the charges. See FScreenCaptureParameters.Attention: The video properties of the screen sharing stream only need to be set through this parameter, and are unrelated to SetVideoEncoderConfiguration.
Returns
- 0: Success.
- < 0: Failure.
- -2: The parameter is invalid.
- -8: The screen sharing state is invalid. Probably because you have shared other screens or windows. Try calling StopScreenCapture to stop the current sharing and start sharing the screen again.
StartScreenCaptureByScreenRect
Captures the whole or part of a screen by specifying the screen rect.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int StartScreenCaptureByScreenRect(const FRectangle& screenRect, const FRectangle& regionRect, const FScreenCaptureParameters& captureParams) __deprecated;
Details
- Deprecated:
- This method is deprecated. Use StartScreenCaptureByDisplayId instead. Agora strongly recommends using StartScreenCaptureByDisplayId if you need to start screen sharing on a device connected to another display.
This method shares a screen or part of the screen. You need to specify the area of the screen to be shared.
- Call this method before joining a channel, and then call JoinChannelWithOptions to join a channel and set publishScreenTrack or publishSecondaryScreenTrack to
true
to start screen sharing. - Call this method after joining a channel, and then call UpdateChannelMediaOptions to join a channel and set publishScreenTrack or publishSecondaryScreenTrack to
true
to start screen sharing.
Parameters
- screenRect
- Sets the relative location of the screen to the virtual screen.
- regionRect
- (Optional) Sets the relative location of the region to the screen. If you do not set this parameter, the SDK shares the whole screen. See FRectangle. If the specified region overruns the screen, the SDK shares only the region within it; if you set width or height as 0, the SDK shares the whole screen.
- captureParams
- The screen sharing encoding parameters. The default video resolution is 1920 Ă— 1080, that is, 2,073,600 pixels. Agora uses the value of this parameter to calculate the charges. See FScreenCaptureParameters.
Returns
- 0: Success.
- < 0: Failure.
- -2: The parameter is invalid.
- -8: The screen sharing state is invalid. Probably because you have shared other screens or windows. Try calling StopScreenCapture to stop the current sharing and start sharing the screen again.
StartScreenCaptureByWindowId
Captures the whole or part of a window by specifying the window ID.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int StartScreenCaptureByWindowId(int64 windowId, const FRectangle& regionRect, const FScreenCaptureParameters& captureParams);
This method captures a window or part of the window. You need to specify the ID of the window to be captured.
This method supports window sharing of UWP (Universal Windows Platform) applications. Agora tests the mainstream UWP applications by using the lastest SDK, see details as follows:
System version | Software | Compatible versions | Support |
---|---|---|---|
win10 | Chrome | 76.0.3809.100 | No |
Office Word | 18.1903.1152.0 | Yes | |
Office Excel | No | ||
Office PPT | Yes | ||
WPS Word | 11.1.0.9145 | Yes | |
WPS Excel | |||
WPS PPT | |||
Media Player (comes with the system) | All | Yes | |
win8 | Chrome | All | Yes |
Office Word | All | Yes | |
Office Excel | |||
Office PPT | |||
WPS Word | 11.1.0.9098 | Yes | |
WPS Excel | |||
WPS PPT | |||
Media Player (comes with the system) | All | Yes | |
win7 | Chrome | 73.0.3683.103 | No |
Office Word | All | Yes | |
Office Excel | |||
Office PPT | |||
WPS Word | 11.1.0.9098 | No | |
WPS Excel | |||
WPS PPT | 11.1.0.9098 | Yes | |
Media Player (comes with the system) | All | No |
Applicable scenarios
In the screen sharing scenario, you need to call this method to start capturing the screen video stream. For implementation guidance of screen sharing, please refer to .
Call timing
- Call this method before joining a channel, and then call JoinChannelWithOptions to join a channel and set publishScreenTrack or publishSecondaryScreenTrack to
true
to start screen sharing. - Call this method after joining a channel, and then call UpdateChannelMediaOptions to join a channel and set publishScreenTrack or publishSecondaryScreenTrack to
true
to start screen sharing.
Restrictions
The window sharing feature of the Agora SDK relies on WGC (Windows Graphics Capture) or GDI (Graphics Device Interface) capture, and WGC cannot be set to disable mouse capture on systems earlier than Windows 10 2004. Therefore, captureMouseCursor(false)
might not work when you start window sharing on a device with a system earlier than Windows 10 2004. See FScreenCaptureParameters.
Parameters
- windowId
- The ID of the window to be shared.
- regionRect
- (Optional) Sets the relative location of the region to the screen. If you do not set this parameter, the SDK shares the whole screen. See FRectangle. If the specified region overruns the window, the SDK shares only the region within it; if you set width or height as 0, the SDK shares the whole window.
- captureParams
- Screen sharing configurations. The default video resolution is 1920 Ă— 1080, that is, 2,073,600 pixels. Agora uses the value of this parameter to calculate the charges. See FScreenCaptureParameters.
Returns
- 0: Success.
- < 0: Failure.
- -2: The parameter is invalid.
- -8: The screen sharing state is invalid. Probably because you have shared other screens or windows. Try calling StopScreenCapture to stop the current sharing and start sharing the screen again.
StopAllEffects
Stops playing all audio effects.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int StopAllEffects();
When you no longer need to play the audio effect, you can call this method to stop the playback. If you only need to pause the playback, call PauseAllEffects.
Call timing
Call this method after PlayEffect.
Restrictions
None.
Returns
- 0: Success.
- < 0: Failure.
StopAudioMixing
Stops playing the music file.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int StopAudioMixing();
After calling StartAudioMixing to play a music file, you can call this method to stop the playing. If you only need to pause the playback, call PauseAudioMixing.
Call timing
Call this method after joining a channel.
Restrictions
None.
Returns
- 0: Success.
- < 0: Failure.
StopAudioRecording
Stops the audio recording on the client.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int StopAudioRecording();
Returns
- 0: Success.
- < 0: Failure.
StopChannelMediaRelay
Stops the media stream relay. Once the relay stops, the host quits all the target channels.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int StopChannelMediaRelay();
Details
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.
Returns
- 0: Success.
- < 0: Failure.
- -5: The method call was rejected. There is no ongoing channel media relay.
StopEchoTest
Stops the audio call test.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int StopEchoTest();
After calling StartEchoTest, you must call this method to end the test; otherwise, the user cannot perform the next audio and video call loop test and cannot join the channel.
Returns
- 0: Success.
-
< 0: Failure.
- -5(ERR_REFUSED): Failed to stop the echo test. The echo test may not be running.
StopEffect
Stops playing a specified audio effect.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int StopEffect(int soundId);
When you no longer need to play the audio effect, you can call this method to stop the playback. If you only need to pause the playback, call PauseEffect.
Call timing
Call this method after PlayEffect.
Restrictions
None.
Parameters
- soundId
- The ID of the audio effect. Each audio effect has a unique ID.
Returns
- 0: Success.
- < 0: Failure.
StopLastmileProbeTest
Stops the last mile network probe test.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int StopLastmileProbeTest();
Returns
- 0: Success.
- < 0: Failure.
StopLocalVideoTranscoder
Stops the local video mixing.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int StopLocalVideoTranscoder();
Details
After calling StartLocalVideoTranscoder, call this method if you want to stop the local video mixing.
Returns
- 0: Success.
- < 0: Failure.
StopPreview
Stops the local video preview.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int StopPreview(EVIDEO_SOURCE_TYPE sourceType = EVIDEO_SOURCE_TYPE::VIDEO_SOURCE_CAMERA_PRIMARY);
Applicable scenarios
After calling StartPreview to start the preview, if you want to stop the local video preview, call this method.
Call timing
Call this method before joining a channel or after leaving a channel.
Restrictions
None.
Parameters
- sourceType
- The type of the video source. See EVIDEO_SOURCE_TYPE.
Returns
- 0: Success.
- < 0: Failure.
StopRhythmPlayer
Disables the virtual metronome.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int StopRhythmPlayer();
Details
After calling StartRhythmPlayer, you can call this method to disable the virtual metronome.
Returns
- 0: Success.
- < 0: Failure.
StopRtmpStream
Stops pushing media streams to a CDN.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int StopRtmpStream(const FString& url);
Details
Agora recommends that you use the server-side Media Push function. For details, see Use RESTful API.
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.
Parameters
- url
- The address of Media Push. The format is RTMP or RTMPS. The character length cannot exceed 1024 bytes. Special characters such as Chinese characters are not supported.
Returns
- 0: Success.
- < 0: Failure.
StopScreenCapture
Stops screen capture.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int StopScreenCapture();
Applicable scenarios
If you start screen capture by calling StartScreenCapture, StartScreenCaptureByWindowId, or StartScreenCaptureByDisplayId, you need to call this method to stop screen capture.
Call timing
You can call this method either before or after joining a channel.
Restrictions
None.
Returns
- 0: Success.
- < 0: Failure.
StopScreenCaptureBySourceType
Stops screen capture from the specified video source.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int StopScreenCaptureBySourceType(EVIDEO_SOURCE_TYPE sourceType);
Applicable scenarios
If you start screen capture from one or more screens by calling StartScreenCaptureBySourceType, you need to call this method to stop screen capture, specifying the screen through the sourceType parameter.
Call timing
You can call this method either before or after joining a channel.
Restrictions
None.
Parameters
- sourceType
- The type of the video source. See EVIDEO_SOURCE_TYPE.
Returns
- 0: Success.
- < 0: Failure.
SwitchCamera
Switches between front and rear cameras.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int SwitchCamera();
You can call this method to dynamically switch cameras based on the actual camera availability during the app's runtime, without having to restart the video stream or reconfigure the video source.
Call timing
This method must be called after the camera is successfully enabled, that is, after the SDK triggers the OnLocalVideoStateChanged callback and returns the local video state as LOCAL_VIDEO_STREAM_STATE_CAPTURING (1).
Restrictions
This method only switches the camera for the video stream captured by the first camera, that is, the video source set to VIDEO_SOURCE_CAMERA (0) when calling StartCameraCapture.
Returns
- 0: Success.
- < 0: Failure.
TakeSnapshot
Takes a snapshot of a video stream.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int TakeSnapshot(int64 uid, const FString& filePath);
This method takes a snapshot of a video stream from the specified user, generates a JPG image, and saves it to the specified path.
Call timing
Call this method after joining a channel.
Restrictions
- The method is asynchronous, and the SDK has not taken the snapshot when the method call returns.
- When used for local video snapshots, this method takes a snapshot for the video streams specified in FChannelMediaOptions.
- If the user's video has been preprocessed, for example, watermarked or beautified, the resulting snapshot includes the pre-processing effect.
Parameters
- uid
- The user ID. Set uid as 0 if you want to take a snapshot of the local user's video.
- filePath
-
The local path (including filename extensions) of the snapshot. For example:
- Windows:
C:\Users\<user_name>\AppData\Local\Agora\<process_name>\example.jpg
- iOS:
/App Sandbox/Library/Caches/example.jpg
- macOS:
~/Library/Logs/example.jpg
- Android:
/storage/emulated/0/Android/data/<package name>/files/example.jpg
Attention: Ensure that the path you specify exists and is writable. - Windows:
Returns
- 0: Success.
- < 0: Failure.
UnloadAllEffects
Releases a specified preloaded audio effect from the memory.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int UnloadAllEffects();
Returns
- 0: Success.
- < 0: Failure.
UnloadEffect
Releases a specified preloaded audio effect from the memory.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int UnloadEffect(int soundId);
After loading the audio effect file into memory using PreloadEffect, if you need to release the audio effect file, call this method.
Call timing
You can call this method either before or after joining a channel.
Restrictions
None.
Parameters
- soundId
- The ID of the audio effect. Each audio effect has a unique ID.
Returns
- 0: Success.
- < 0: Failure.
UpdateChannelMediaOptions
Updates the channel media options after joining the channel.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int UpdateChannelMediaOptions(const FChannelMediaOptions& options);
Parameters
- options
- The channel media options. See FChannelMediaOptions.
Returns
- 0: Success.
- < 0: Failure.
- -2: The value of a member in FChannelMediaOptions is invalid. For example, the token or the user ID is invalid. You need to fill in a valid parameter.
- -7: The IRtcEngine object has not been initialized. You need to initialize the IRtcEngine object before calling this method.
- -8: The internal state of the IRtcEngine object is wrong. The possible reason is that the user is not in the channel. Agora recommends that you use the OnConnectionStateChanged callback to see whether the user is in the channel. If you receive the CONNECTION_STATE_DISCONNECTED (1) or CONNECTION_STATE_FAILED (5) state, the user is not in the channel. You need to call JoinChannelWithOptions to join a channel before calling this method.
UpdateLocalTranscoderConfiguration
Updates the local video mixing configuration.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int UpdateLocalTranscoderConfiguration(const FLocalTranscoderConfiguration& config);
Details
After calling StartLocalVideoTranscoder, call this method if you want to update the local video mixing configuration.
Parameters
- config
- Configuration of the local video mixing, see FLocalTranscoderConfiguration.
Returns
- 0: Success.
- < 0: Failure.
UpdatePreloadChannelToken
Updates the wildcard token for preloading channels.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int UpdatePreloadChannelToken(const FString& token);
Details
You need to maintain the life cycle of the wildcard token by yourself. When the token expires, you need to generate a new wildcard token and then call this method to pass in the new token.
Applicable scenarios
In scenarios involving multiple channels, such as switching between different channels, using a wildcard token means users do not need to apply for a new token every time joinning a new channel, which can save users time for switching channels and reduce the pressure on your token server.
Parameters
- token
- The new token.
Returns
- 0: Success.
- < 0: Failure.
- -2: The parameter is invalid. For example, the token is invalid. You need to pass in a valid parameter and join the channel again.
- -7: The IRtcEngine object has not been initialized. You need to initialize the IRtcEngine object before calling this method.
UpdateRtmpTranscoding
Updates the transcoding configuration.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int UpdateRtmpTranscoding(const FLiveTranscoding& transcoding);
Details
Agora recommends that you use the server-side Media Push function. For details, see Use RESTful API.
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.
Parameters
- transcoding
-
The transcoding configuration for Media Push. See FLiveTranscoding.
Returns
- 0: Success.
- < 0: Failure.
UpdateScreenCapture
Updates the screen capturing parameters.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int UpdateScreenCapture(const FScreenCaptureParameters2& captureParams);
Details
- Call this method, and set captureAudio to
true
. - Call UpdateChannelMediaOptions, and set publishScreenCaptureAudio to
true
to publish the audio captured by the screen.
- This method is for Android and iOS only.
- On the iOS platform, screen sharing is only available on iOS 12.0 and later.
Parameters
- captureParams
- The screen sharing encoding parameters. The default video resolution is 1920 Ă— 1080, that is, 2,073,600 pixels. Agora uses the value of this parameter to calculate the charges. See FScreenCaptureParameters2.
Returns
- 0: Success.
- < 0: Failure.
- -2: The parameter is invalid.
- -8: The screen sharing state is invalid. Probably because you have shared other screens or windows. Try calling StopScreenCapture to stop the current sharing and start sharing the screen again.
UpdateScreenCaptureParameters
Updates the screen capturing parameters.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int UpdateScreenCaptureParameters(const FScreenCaptureParameters& captureParams);
Details
- This method is for Windows and macOS only.
- Call this method after starting screen sharing or window sharing.
Parameters
- captureParams
- The screen sharing encoding parameters. The default video resolution is 1920 Ă— 1080, that is, 2,073,600 pixels. Agora uses the value of this parameter to calculate the charges. See FScreenCaptureParameters.Attention: The video properties of the screen sharing stream only need to be set through this parameter, and are unrelated to SetVideoEncoderConfiguration.
Returns
- 0: Success.
- < 0: Failure.
- -2: The parameter is invalid.
- -8: The screen sharing state is invalid. Probably because you have shared other screens or windows. Try calling StopScreenCapture to stop the current sharing and start sharing the screen again.
UpdateScreenCaptureRegion
Updates the screen capturing region.
UFUNCTION(BlueprintCallable, Category = "Agora|IRtcEngine")
int UpdateScreenCaptureRegion(const FRectangle& regionRect);
Details
Parameters
- regionRect
- The relative location of the screen-share area to the screen or window. If you do not set this parameter, the SDK shares the whole screen or window. See FRectangle. If the specified region overruns the screen or window, the SDK shares only the region within it; if you set width or height as 0, the SDK shares the whole screen or window.
Returns
- 0: Success.
- < 0: Failure.
- -2: The parameter is invalid.
- -8: The screen sharing state is invalid. Probably because you have shared other screens or windows. Try calling StopScreenCapture to stop the current sharing and start sharing the screen again.