RtcEngine class

RtcEngine is the main class of the Agora SDK.

Available Extensions

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addInjectStreamUrl(String url, LiveInjectStreamConfig config) Future<void>
Injects an online media stream to a live broadcast.
addPublishStreamUrl(String url, bool transcodingEnabled) Future<void>
Publishes the local stream to a specified CDN streaming URL.
addVideoWatermark(String watermarkUrl, WatermarkOptions options) Future<void>
Adds a watermark image to the local video.
adjustAudioMixingPlayoutVolume(int volume) Future<void>
Adjusts the volume of audio mixing for local playback.
adjustAudioMixingPublishVolume(int volume) Future<void>
Adjusts the volume of audio mixing for publishing (sending to other users).
adjustAudioMixingVolume(int volume) Future<void>
Adjusts the volume of audio mixing.
adjustPlaybackSignalVolume(int volume) Future<void>
Adjusts the playback volume of all remote users.
adjustRecordingSignalVolume(int volume) Future<void>
Adjusts the recording volume.
adjustUserPlaybackSignalVolume(int uid, int volume) Future<void>
Adjusts the playback volume of a specified remote user.
clearVideoWatermarks() Future<void>
Removes the watermark image from the video stream added by RtcEngine.addVideoWatermark.
complain(String callId, String description) Future<void>
Allows a user to complain about the call quality after a call ends.
configRhythmPlayer(RhythmPlayerConfig config) Future<void>
Configures the virtual metronome.
createDataStream(bool reliable, bool ordered) Future<int?>
Creates a data stream.
createDataStreamWithConfig(DataStreamConfig config) Future<int?>
Creates a data stream.
destroy() Future<void>
Destroys the RtcEngine instance and releases all resources used by the Agora SDK.
disableAudio() Future<void>
Disables the audio module.
disableLastmileTest() Future<void>
Disables the network connection quality test.
disableVideo() Future<void>
Disables the video module.
enableAudio() Future<void>
Enables the audio module.
enableAudioVolumeIndication(int interval, int smooth, bool report_vad) Future<void>
Enables the RtcEngineEventHandler.audioVolumeIndication callback at a set time interval to report on which users are speaking and the speakers' volume.
enableDeepLearningDenoise(bool enabled) Future<void>
Enables or disables deep-learning noise reduction.
enableDualStreamMode(bool enabled) Future<void>
Enables/Disables the dual video stream mode.
enableEncryption(bool enabled, EncryptionConfig config) Future<void>
Enables/Disables the built-in encryption.
enableFaceDetection(bool enabled) Future<void>
Enables/Disables face detection for the local user.
enableInEarMonitoring(bool enabled) Future<void>
Enables in-ear monitoring.
enableLastmileTest() Future<void>
Enables the network connection quality test.
enableLocalAudio(bool enabled) Future<void>
Enables/Disables the local audio capture.
enableLocalVideo(bool enabled) Future<void>
Disables/Re-enables the local video capture.
enableRemoteSuperResolution(int uid, bool enabled) Future<void>
Enables/Disables the super resolution feature for a remote user’s video. (beta feature)
enableSoundPositionIndication(bool enabled) Future<void>
Enables/Disables stereo panning for remote users.
enableVideo() Future<void>
Enables the video module.
enableVirtualBackground(bool enabled, VirtualBackgroundSource backgroundSource) Future<void>
Enables/Disables the virtual background. (beta function).
enableWebSdkInteroperability(bool enabled) Future<void>
Enables interoperability with the Agora Web SDK (LiveBroadcasting only).
getAudioFileInfo(String filePath) Future<void>
Gets the information of a specified audio file.
getAudioMixingCurrentPosition() Future<int?>
Gets the playback position of the audio file.
getAudioMixingDuration([String? filePath]) Future<int?>
Gets the total duration (ms) of the music file.
getAudioMixingPlayoutVolume() Future<int?>
Gets the audio mixing volume for local playback.
getAudioMixingPublishVolume() Future<int?>
Gets the audio mixing volume for publishing.
getAudioTrackCount() Future<int?>
Gets the audio track index of the current music file.
getCallId() Future<String?>
Gets the current call ID.
getCameraMaxZoomFactor() Future<double?>
Gets the maximum zoom ratio supported by the camera.
getConnectionState() Future<ConnectionStateType>
Gets the connection state of the SDK.
getEffectCurrentPosition(int soundId) Future<int?>
Gets the playback postion of the audio effect file.
getEffectDuration(String filePath) Future<int?>
Gets the duration of the audio effect file.
getEffectsVolume() Future<double?>
Gets the volume of the audio effects.
getNativeHandle() Future<int?>
Gets the native handle of the SDK engine.
getUserInfoByUid(int uid) Future<UserInfo>
Gets the user information by passing in the user ID.
getUserInfoByUserAccount(String userAccount) Future<UserInfo>
Gets the user information by passing in the user account.
isCameraAutoFocusFaceModeSupported() Future<bool?>
Checks whether the camera auto-face focus function is supported.
isCameraExposurePositionSupported() Future<bool?>
Checks whether the camera exposure function is supported.
isCameraFocusSupported() Future<bool?>
Checks whether the camera manual focus function is supported.
isCameraTorchSupported() Future<bool?>
Checks whether the camera flash function is supported.
isCameraZoomSupported() Future<bool?>
Checks whether the camera zoom function is supported.
isSpeakerphoneEnabled() Future<bool?>
Checks whether the speakerphone is enabled.
joinChannel(String? token, String channelName, String? optionalInfo, int optionalUid, [ChannelMediaOptions? options]) Future<void>
Allows a user to join a channel.
joinChannelWithUserAccount(String? token, String channelName, String userAccount, [ChannelMediaOptions? options]) Future<void>
Joins the channel with a user account.
leaveChannel() Future<void>
Allows a user to leave a channel.
muteAllRemoteAudioStreams(bool muted) Future<void>
Stops/Resumes receiving all remote audio streams.
muteAllRemoteVideoStreams(bool muted) Future<void>
Stops/Resumes receiving all remote video streams.
muteLocalAudioStream(bool muted) Future<void>
Stops/Resumes sending the local audio stream.
muteLocalVideoStream(bool muted) Future<void>
Stops/Resumes sending the local video stream.
muteRemoteAudioStream(int uid, bool muted) Future<void>
Stops/Resumes receiving a specified audio stream.
muteRemoteVideoStream(int uid, bool muted) Future<void>
Stops/Resumes receiving a specified remote user's video stream.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pauseAllChannelMediaRelay() Future<void>
Pauses the media stream relay to all destination channels.
pauseAllEffects() Future<void>
Pauses all audio effects.
pauseAudioMixing() Future<void>
Pauses playing and mixing the music file.
pauseEffect(int soundId) Future<void>
Pauses a specified audio effect.
playEffect(int soundId, String filePath, int loopCount, double pitch, double pan, double gain, bool publish, [int? startPos]) Future<void>
Plays a specified local or online audio effect file.
preloadEffect(int soundId, String filePath) Future<void>
Preloads a specified audio effect file into the memory.
rate(String callId, int rating, {String? description}) Future<void>
Allows the user to rate a call after the call ends.
registerLocalUserAccount(String appId, String userAccount) Future<void>
Registers a user account.
registerMediaMetadataObserver() Future<void>
Registers the metadata observer.
removeInjectStreamUrl(String url) Future<void>
Removes the injected online media stream from a live broadcast.
removePublishStreamUrl(String url) Future<void>
Removes an RTMP or RTMPS stream from the CDN.
renewToken(String token) Future<void>
Renews the token when the current token expires.
resumeAllChannelMediaRelay() Future<void>
Resumes the media stream relay to all destination channels.
resumeAllEffects() Future<void>
Resumes playing all audio effects.
resumeAudioMixing() Future<void>
Resumes playing and mixing the music file.
resumeEffect(int soundId) Future<void>
Resumes playing a specified audio effect.
selectAudioTrack(int index) Future<void>
Specifies the playback track index of the current music file.
sendCustomReportMessage(String id, String category, String event, String label, int value) Future<void>
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.
sendMetadata(String metadata) Future<void>
Sends the metadata.
sendStreamMessage(int streamId, String message) Future<void>
Sends data stream messages.
setAudioEffectParameters(AudioEffectPreset preset, int param1, int param2) Future<void>
Sets parameters for SDK preset audio effects.
setAudioEffectPreset(AudioEffectPreset preset) Future<void>
Sets an SDK preset audio effect.
setAudioMixingDualMonoMode(AudioMixingDualMonoMode mode) Future<void>
Sets the channel mode of the current music file.
setAudioMixingPitch(int pitch) Future<void>
Sets the pitch of the local music file.
setAudioMixingPlaybackSpeed(int speed) Future<void>
Sets the playback speed of the current music file.
setAudioMixingPosition(int pos) Future<void>
Sets the playback position (ms) of the music file to a different starting position (the default plays from the beginning).
setAudioProfile(AudioProfile profile, AudioScenario scenario) Future<void>
Sets the audio parameters and application scenarios.
setAudioSessionOperationRestriction(AudioSessionOperationRestriction restriction) Future<void>
Sets the operational permission of the SDK on the audio session. (iOS only)
setBeautyEffectOptions(bool enabled, BeautyOptions options) Future<void>
Enables/Disables image enhancement and sets the options.
setCameraAutoFocusFaceModeEnabled(bool enabled) Future<void>
Sets whether to enable face autofocus.
setCameraCapturerConfiguration(CameraCapturerConfiguration config) Future<void>
Sets The camera capture configuration.
setCameraExposurePosition(double positionXinView, double positionYinView) Future<void>
Sets the camera exposure position.
setCameraFocusPositionInPreview(double positionX, double positionY) Future<void>
Sets the camera manual focus position. A successful method call triggers the RtcEngineEventHandler.cameraFocusAreaChanged callback on the local client.
setCameraTorchOn(bool isOn) Future<void>
Enables the camera flash function.
setCameraZoomFactor(double factor) Future<void>
Sets the camera zoom ratio.
setChannelProfile(ChannelProfile profile) Future<void>
Sets the channel profile of the Agora RtcEngine.
setClientRole(ClientRole role, [ClientRoleOptions? options]) Future<void>
Sets the role of a user in a live interactive streaming.
setCloudProxy(CloudProxyType proxyType) Future<void>
Sets the Agora cloud proxy service.
setDefaultAudioRoutetoSpeakerphone(bool defaultToSpeaker) Future<void>
Sets the default audio route.
setDefaultMuteAllRemoteAudioStreams(bool muted) Future<void>
Sets whether to receive all remote audio streams by default.
setDefaultMuteAllRemoteVideoStreams(bool muted) Future<void>
Sets whether to receive all remote video streams by default.
setEffectPosition(int soundId, int pos) Future<void>
Sets the playback position of an audio effect file.
setEffectsVolume(double volume) Future<void>
Sets the volume of the audio effects.
setEnableSpeakerphone(bool enabled) Future<void>
Enables/Disables the audio playback route to the speakerphone.
setEncryptionMode(EncryptionMode encryptionMode) Future<void>
Sets the built-in encryption mode.
setEncryptionSecret(String secret) Future<void>
Enables built-in encryption with an encryption password before joining a channel.
setEventHandler(RtcEngineEventHandler handler) → void
Sets the engine event handler.
setInEarMonitoringVolume(int volume) Future<void>
Sets the volume of the in-ear monitor.
setLiveTranscoding(LiveTranscoding transcoding) Future<void>
Sets the video layout and audio settings for CDN live.
setLocalAccessPoint(List<String> ips, String domain) Future<void>
@nodoc
setLocalPublishFallbackOption(StreamFallbackOptions option) Future<void>
Sets the fallback option for the locally published video stream based on the network conditions.
setLocalVoiceChanger(AudioVoiceChanger voiceChanger) Future<void>
Sets the local voice changer option.
setLocalVoiceEqualization(AudioEqualizationBandFrequency bandFrequency, int bandGain) Future<void>
Sets the local voice equalization effect.
setLocalVoicePitch(double pitch) Future<void>
Changes the voice pitch of the local speaker.
setLocalVoiceReverb(AudioReverbType reverbKey, int value) Future<void>
Sets the local voice reverberation.
setLocalVoiceReverbPreset(AudioReverbPreset preset) Future<void>
Sets the preset local voice reverberation effect.
setLogFile(String filePath) Future<void>
Specifies an SDK output log file.
setLogFileSize(int fileSizeInKBytes) Future<void>
Sets the log file size (KB).
setLogFilter(LogFilter filter) Future<void>
Sets the output log level of the SDK.
setMaxMetadataSize(int size) Future<void>
Sets the maximum size of the metadata.
setParameters(String parameters) Future<void>
@nodoc
setRemoteDefaultVideoStreamType(VideoStreamType streamType) Future<void>
Sets the default video-stream type of the remotely subscribed video stream when the remote user sends dual streams.
setRemoteSubscribeFallbackOption(StreamFallbackOptions option) Future<void>
Sets the fallback option for the remotely subscribed video stream based on the network conditions.
setRemoteUserPriority(int uid, UserPriority userPriority) Future<void>
Sets the priority of a remote user's media stream.
setRemoteVideoStreamType(int uid, VideoStreamType streamType) Future<void>
Sets the stream type of the remote video.
setRemoteVoicePosition(int uid, double pan, double gain) Future<void>
Sets the sound position of a remote user. When the local user calls this method to set the sound position of a remote user, the sound difference between the left and right channels allows the local user to track the real-time position of the remote user, creating a real sense of space. This method applies to massively multiplayer online games, such as Battle Royale games.
setVideoEncoderConfiguration(VideoEncoderConfiguration config) Future<void>
Sets the video encoder configuration.
setVoiceBeautifierParameters(VoiceBeautifierPreset preset, int param1, int param2) Future<void>
Sets parameters for SDK preset voice beautifier effects.
setVoiceBeautifierPreset(VoiceBeautifierPreset preset) Future<void>
Sets an SDK preset voice beautifier effect.
setVoiceConversionPreset(VoiceConversionPreset preset) Future<void>
Sets an SDK preset voice conversion effect.
setVolumeOfEffect(int soundId, double volume) Future<void>
Sets the volume of a specified audio effect.
startAudioMixing(String filePath, bool loopback, bool replace, int cycle, [int? startPos]) Future<void>
Starts playing and mixing the music file.
startAudioRecording(String filePath, AudioSampleRateType sampleRate, AudioRecordingQuality quality) Future<void>
Starts an audio recording on the client.
startAudioRecordingWithConfig(AudioRecordingConfiguration config) Future<void>
Starts an audio recording on the client.
startChannelMediaRelay(ChannelMediaRelayConfiguration channelMediaRelayConfiguration) Future<void>
Starts to relay media streams across channels.
startEchoTest({int? intervalInSeconds, EchoTestConfiguration? config}) Future<void>
Starts an audio call test.
startLastmileProbeTest(LastmileProbeConfig config) Future<void>
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).
startPreview() Future<void>
Starts the local video preview before joining a channel.
startRhythmPlayer(String sound1, String sound2, RhythmPlayerConfig config) Future<void>
Enables the virtual metronome.
stopAllEffects() Future<void>
Stops playing all audio effects.
stopAudioMixing() Future<void>
Stops playing or mixing the music file.
stopAudioRecording() Future<void>
Stops the audio recording on the client.
stopChannelMediaRelay() Future<void>
Stops the media stream relay.
stopEchoTest() Future<void>
Stops the audio call test.
stopEffect(int soundId) Future<void>
Stops playing a specified audio effect.
stopLastmileProbeTest() Future<void>
Stops the last-mile network probe test.
stopPreview() Future<void>
Stops the local video preview and the video.
stopRhythmPlayer() Future<void>
Disables the virtual metronome.
switchCamera() Future<void>
Switches between front and rear cameras.
switchChannel(String? token, String channelName, [ChannelMediaOptions? options]) Future<void>
Switches to a different channel.
takeSnapshot(String channel, int uid, String filePath) Future<void>
Takes a snapshot of a video stream.
toString() String
A string representation of this object.
inherited
unloadEffect(int soundId) Future<void>
Releases a specified preloaded audio effect from the memory.
unregisterMediaMetadataObserver() Future<void>
Unregisters the metadata observer.
updateChannelMediaRelay(ChannelMediaRelayConfiguration channelMediaRelayConfiguration) Future<void>
Updates the channels for media relay.
uploadLogFile() Future<String?>
@nodoc

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

instance RtcEngine?
Get the singleton of RtcEngine.
no setter
methodChannel MethodChannel
Exposing methodChannel to other files
no setter

Static Methods

create(String appId) Future<RtcEngine>
Creates an RtcEngine instance.
createWithAreaCode(String appId, List<AreaCode> areaCode) Future<RtcEngine>
Creates an RtcEngine instance.
createWithConfig(RtcEngineConfig config) Future<RtcEngine>
Creates an RtcEngine instance and specifies the connection area.
createWithContext(RtcEngineContext context) Future<RtcEngine>
Creates an RtcEngine instance and specifies one or multiple connection areas.
getErrorDescription(int error) Future<String?>
Retrieves the description of a warning or error code.
getSdkVersion() Future<String?>
Retrieves the SDK version.