Agora C++ API Reference for All Platforms
agora::rtc::IRtcEngine2 Class Referenceabstract

#include <IAgoraRtcChannel.h>

Inherits agora::rtc::IRtcEngine.

Public Member Functions

virtual IChannelcreateChannel (const char *channelId)=0
- Public Member Functions inherited from agora::rtc::IRtcEngine
virtual int initialize (const RtcEngineContext &context)=0
virtual int setChannelProfile (CHANNEL_PROFILE_TYPE profile)=0
virtual int setClientRole (CLIENT_ROLE_TYPE role)=0
virtual int setClientRole (CLIENT_ROLE_TYPE role, const ClientRoleOptions &options)=0
virtual int joinChannel (const char *token, const char *channelId, const char *info, uid_t uid)=0
virtual int joinChannel (const char *token, const char *channelId, const char *info, uid_t uid, const ChannelMediaOptions &options)=0
virtual int switchChannel (const char *token, const char *channelId)=0
virtual int switchChannel (const char *token, const char *channelId, const ChannelMediaOptions &options)=0
virtual int leaveChannel ()=0
virtual int renewToken (const char *token)=0
virtual int queryInterface (INTERFACE_ID_TYPE iid, void **inter)=0
virtual int registerLocalUserAccount (const char *appId, const char *userAccount)=0
virtual int joinChannelWithUserAccount (const char *token, const char *channelId, const char *userAccount)=0
virtual int joinChannelWithUserAccount (const char *token, const char *channelId, const char *userAccount, const ChannelMediaOptions &options)=0
virtual int getUserInfoByUserAccount (const char *userAccount, UserInfo *userInfo)=0
virtual int getUserInfoByUid (uid_t uid, UserInfo *userInfo)=0
virtual int startEchoTest ()=0
virtual int startEchoTest (int intervalInSeconds)=0
virtual int startEchoTest (const EchoTestConfiguration &config)=0
virtual int stopEchoTest ()=0
virtual int setCloudProxy (CLOUD_PROXY_TYPE proxyType)=0
virtual int enableVideo ()=0
virtual int disableVideo ()=0
virtual int setVideoProfile (VIDEO_PROFILE_TYPE profile, bool swapWidthAndHeight) AGORA_DEPRECATED_ATTRIBUTE=0
virtual int setVideoEncoderConfiguration (const VideoEncoderConfiguration &config)=0
virtual int setCameraCapturerConfiguration (const CameraCapturerConfiguration &config)=0
virtual int setupLocalVideo (const VideoCanvas &canvas)=0
virtual int setupRemoteVideo (const VideoCanvas &canvas)=0
virtual int startPreview ()=0
virtual int setRemoteUserPriority (uid_t uid, PRIORITY_TYPE userPriority)=0
virtual int stopPreview ()=0
virtual int enableAudio ()=0
virtual int enableLocalAudio (bool enabled)=0
virtual int disableAudio ()=0
virtual int setAudioProfile (AUDIO_PROFILE_TYPE profile, AUDIO_SCENARIO_TYPE scenario)=0
virtual int muteLocalAudioStream (bool mute)=0
virtual int muteAllRemoteAudioStreams (bool mute)=0
virtual int setDefaultMuteAllRemoteAudioStreams (bool mute) AGORA_DEPRECATED_ATTRIBUTE=0
virtual int adjustUserPlaybackSignalVolume (unsigned int uid, int volume)=0
virtual int muteRemoteAudioStream (uid_t userId, bool mute)=0
virtual int muteLocalVideoStream (bool mute)=0
virtual int enableLocalVideo (bool enabled)=0
virtual int muteAllRemoteVideoStreams (bool mute)=0
virtual int setDefaultMuteAllRemoteVideoStreams (bool mute) AGORA_DEPRECATED_ATTRIBUTE=0
virtual int muteRemoteVideoStream (uid_t userId, bool mute)=0
virtual int setRemoteVideoStreamType (uid_t userId, REMOTE_VIDEO_STREAM_TYPE streamType)=0
virtual int setRemoteDefaultVideoStreamType (REMOTE_VIDEO_STREAM_TYPE streamType)=0
virtual int enableAudioVolumeIndication (int interval, int smooth, bool report_vad)=0
virtual int enableLocalVoicePitchCallback (int interval)=0
virtual int startAudioRecording (const char *filePath, AUDIO_RECORDING_QUALITY_TYPE quality) AGORA_DEPRECATED_ATTRIBUTE=0
virtual int startAudioRecording (const char *filePath, int sampleRate, AUDIO_RECORDING_QUALITY_TYPE quality) AGORA_DEPRECATED_ATTRIBUTE=0
virtual int startAudioRecording (const AudioRecordingConfiguration &config)=0
virtual int stopAudioRecording ()=0
virtual int startAudioMixing (const char *filePath, bool loopback, bool replace, int cycle) AGORA_DEPRECATED_ATTRIBUTE=0
virtual int startAudioMixing (const char *filePath, bool loopback, bool replace, int cycle, int startPos)=0
virtual int setAudioMixingPlaybackSpeed (int speed)=0
virtual int stopAudioMixing ()=0
virtual int pauseAudioMixing ()=0
virtual int selectAudioTrack (int index)=0
virtual int getAudioTrackCount ()=0
virtual int setAudioMixingDualMonoMode (agora::media::AUDIO_MIXING_DUAL_MONO_MODE mode)=0
virtual int resumeAudioMixing ()=0
virtual int setHighQualityAudioParameters (bool fullband, bool stereo, bool fullBitrate)=0
virtual int adjustAudioMixingVolume (int volume)=0
virtual int adjustAudioMixingPlayoutVolume (int volume)=0
virtual int getAudioMixingPlayoutVolume ()=0
virtual int adjustAudioMixingPublishVolume (int volume)=0
virtual int getAudioMixingPublishVolume ()=0
virtual int getAudioMixingDuration () AGORA_DEPRECATED_ATTRIBUTE=0
virtual int getAudioMixingCurrentPosition ()=0
virtual int setAudioMixingPosition (int pos)=0
virtual int setAudioMixingPitch (int pitch)=0
virtual int getEffectsVolume ()=0
virtual int setEffectsVolume (int volume)=0
virtual int setVolumeOfEffect (int soundId, int volume)=0
virtual int enableFaceDetection (bool enable)=0
virtual int playEffect (int soundId, const char *filePath, int loopCount, double pitch, double pan, int gain, bool publish=false) AGORA_DEPRECATED_ATTRIBUTE=0
virtual int playEffect (int soundId, const char *filePath, int loopCount, double pitch, double pan, int gain, bool publish, int startPos)=0
virtual int stopEffect (int soundId)=0
virtual int stopAllEffects ()=0
virtual int preloadEffect (int soundId, const char *filePath)=0
virtual int unloadEffect (int soundId)=0
virtual int pauseEffect (int soundId)=0
virtual int pauseAllEffects ()=0
virtual int resumeEffect (int soundId)=0
virtual int resumeAllEffects ()=0
virtual int getEffectDuration (const char *filePath)=0
virtual int setEffectPosition (int soundId, int pos)=0
virtual int getEffectCurrentPosition (int soundId)=0
virtual int getAudioFileInfo (const char *filePath)=0
virtual int enableDeepLearningDenoise (bool enable)=0
virtual int enableSoundPositionIndication (bool enabled)=0
virtual int setRemoteVoicePosition (uid_t uid, double pan, double gain)=0
virtual int setLocalVoicePitch (double pitch)=0
virtual int setLocalVoiceEqualization (AUDIO_EQUALIZATION_BAND_FREQUENCY bandFrequency, int bandGain)=0
virtual int setLocalVoiceReverb (AUDIO_REVERB_TYPE reverbKey, int value)=0
virtual int setLocalVoiceChanger (VOICE_CHANGER_PRESET voiceChanger) AGORA_DEPRECATED_ATTRIBUTE=0
virtual int setLocalVoiceReverbPreset (AUDIO_REVERB_PRESET reverbPreset) AGORA_DEPRECATED_ATTRIBUTE=0
virtual int setVoiceBeautifierPreset (VOICE_BEAUTIFIER_PRESET preset)=0
virtual int setAudioEffectPreset (AUDIO_EFFECT_PRESET preset)=0
virtual int setVoiceConversionPreset (VOICE_CONVERSION_PRESET preset)=0
virtual int setAudioEffectParameters (AUDIO_EFFECT_PRESET preset, int param1, int param2)=0
virtual int setVoiceBeautifierParameters (VOICE_BEAUTIFIER_PRESET preset, int param1, int param2)=0
virtual int setLogFile (const char *filePath) AGORA_DEPRECATED_ATTRIBUTE=0
virtual int setLogFilter (unsigned int filter) AGORA_DEPRECATED_ATTRIBUTE=0
virtual int setLogFileSize (unsigned int fileSizeInKBytes) AGORA_DEPRECATED_ATTRIBUTE=0
virtual int setLocalRenderMode (RENDER_MODE_TYPE renderMode) AGORA_DEPRECATED_ATTRIBUTE=0
virtual int setLocalRenderMode (RENDER_MODE_TYPE renderMode, VIDEO_MIRROR_MODE_TYPE mirrorMode)=0
virtual int setRemoteRenderMode (uid_t userId, RENDER_MODE_TYPE renderMode) AGORA_DEPRECATED_ATTRIBUTE=0
virtual int setRemoteRenderMode (uid_t userId, RENDER_MODE_TYPE renderMode, VIDEO_MIRROR_MODE_TYPE mirrorMode)=0
virtual int setLocalVideoMirrorMode (VIDEO_MIRROR_MODE_TYPE mirrorMode) AGORA_DEPRECATED_ATTRIBUTE=0
virtual int enableDualStreamMode (bool enabled)=0
virtual int setExternalAudioSource (bool enabled, int sampleRate, int channels)=0
virtual int setExternalAudioSink (bool enabled, int sampleRate, int channels)=0
virtual int setRecordingAudioFrameParameters (int sampleRate, int channel, RAW_AUDIO_FRAME_OP_MODE_TYPE mode, int samplesPerCall)=0
virtual int setPlaybackAudioFrameParameters (int sampleRate, int channel, RAW_AUDIO_FRAME_OP_MODE_TYPE mode, int samplesPerCall)=0
virtual int setMixedAudioFrameParameters (int sampleRate, int samplesPerCall)=0
virtual int adjustRecordingSignalVolume (int volume)=0
virtual int adjustPlaybackSignalVolume (int volume)=0
virtual int adjustLoopbackRecordingSignalVolume (int volume)=0
virtual int enableWebSdkInteroperability (bool enabled) AGORA_DEPRECATED_ATTRIBUTE=0
virtual int setVideoQualityParameters (bool preferFrameRateOverImageQuality)=0
virtual int setLocalPublishFallbackOption (STREAM_FALLBACK_OPTIONS option)=0
virtual int setRemoteSubscribeFallbackOption (STREAM_FALLBACK_OPTIONS option)=0
virtual int switchCamera ()=0
virtual int setDefaultAudioRouteToSpeakerphone (bool defaultToSpeaker)=0
virtual int setEnableSpeakerphone (bool speakerOn)=0
virtual int enableInEarMonitoring (bool enabled)=0
virtual int setInEarMonitoringVolume (int volume)=0
virtual bool isSpeakerphoneEnabled ()=0
virtual int setAudioSessionOperationRestriction (AUDIO_SESSION_OPERATION_RESTRICTION restriction)=0
virtual int enableLoopbackRecording (bool enabled, const char *deviceName=NULL)=0
virtual IScreenCaptureSourceListgetScreenCaptureSources (const SIZE &thumbSize, const SIZE &iconSize, const bool includeScreen)=0
virtual int startScreenCaptureByDisplayId (unsigned int displayId, const Rectangle &regionRect, const ScreenCaptureParameters &captureParams)=0
virtual int startScreenCaptureByScreenRect (const Rectangle &screenRect, const Rectangle &regionRect, const ScreenCaptureParameters &captureParams)=0
virtual int startScreenCaptureByWindowId (view_t windowId, const Rectangle &regionRect, const ScreenCaptureParameters &captureParams)=0
virtual int setScreenCaptureContentHint (VideoContentHint contentHint)=0
virtual int setScreenCaptureScenario (SCREEN_SCENARIO_TYPE screenScenario)=0
virtual int updateScreenCaptureParameters (const ScreenCaptureParameters &captureParams)=0
virtual int updateScreenCaptureRegion (const Rectangle &regionRect)=0
virtual int stopScreenCapture ()=0
virtual int startScreenCapture (WindowIDType windowId, int captureFreq, const Rect *rect, int bitrate)=0
virtual int updateScreenCaptureRegion (const Rect *rect)=0
virtual bool setVideoSource (IVideoSource *source)=0
virtual int getCallId (agora::util::AString &callId)=0
virtual int rate (const char *callId, int rating, const char *description)=0
virtual int complain (const char *callId, const char *description)=0
virtual const char * getVersion (int *build)=0
virtual int enableLastmileTest ()=0
virtual int disableLastmileTest ()=0
virtual int startLastmileProbeTest (const LastmileProbeConfig &config)=0
virtual int stopLastmileProbeTest ()=0
virtual const char * getErrorDescription (int code)=0
virtual int setEncryptionSecret (const char *secret) AGORA_DEPRECATED_ATTRIBUTE=0
virtual int setEncryptionMode (const char *encryptionMode) AGORA_DEPRECATED_ATTRIBUTE=0
virtual int enableEncryption (bool enabled, const EncryptionConfig &config)=0
virtual int registerPacketObserver (IPacketObserver *observer)=0
virtual int createDataStream (int *streamId, bool reliable, bool ordered) AGORA_DEPRECATED_ATTRIBUTE=0
virtual int createDataStream (int *streamId, DataStreamConfig &config)=0
virtual int sendStreamMessage (int streamId, const char *data, size_t length)=0
virtual int addPublishStreamUrl (const char *url, bool transcodingEnabled) AGORA_DEPRECATED_ATTRIBUTE=0
virtual int removePublishStreamUrl (const char *url) AGORA_DEPRECATED_ATTRIBUTE=0
virtual int setLiveTranscoding (const LiveTranscoding &transcoding) AGORA_DEPRECATED_ATTRIBUTE=0
virtual int startRtmpStreamWithoutTranscoding (const char *url)=0
virtual int startRtmpStreamWithTranscoding (const char *url, const LiveTranscoding &transcoding)=0
virtual int updateRtmpTranscoding (const LiveTranscoding &transcoding)=0
virtual int stopRtmpStream (const char *url)=0
virtual int addVideoWatermark (const RtcImage &watermark)=0
virtual int addVideoWatermark (const char *watermarkUrl, const WatermarkOptions &options)=0
virtual int clearVideoWatermarks ()=0
virtual int setBeautyEffectOptions (bool enabled, BeautyOptions options)=0
virtual int setLowlightEnhanceOptions (bool enabled, LowLightEnhanceOptions options)=0
virtual int setVideoDenoiserOptions (bool enabled, VideoDenoiserOptions options)=0
virtual int setColorEnhanceOptions (bool enabled, ColorEnhanceOptions options)=0
virtual int enableVirtualBackground (bool enabled, VirtualBackgroundSource backgroundSource)=0
virtual int startChannelMediaRelay (const ChannelMediaRelayConfiguration &configuration)=0
virtual int updateChannelMediaRelay (const ChannelMediaRelayConfiguration &configuration)=0
virtual int pauseAllChannelMediaRelay ()=0
virtual int resumeAllChannelMediaRelay ()=0
virtual int stopChannelMediaRelay ()=0
virtual bool registerEventHandler (IRtcEngineEventHandler *eventHandler)=0
virtual bool unregisterEventHandler (IRtcEngineEventHandler *eventHandler)=0
virtual int sendCustomReportMessage (const char *id, const char *category, const char *event, const char *label, int value)=0
virtual CONNECTION_STATE_TYPE getConnectionState ()=0
virtual int enableRemoteSuperResolution (uid_t userId, bool enable) AGORA_DEPRECATED_ATTRIBUTE=0
virtual int enableRemoteSuperResolution (bool enabled, SR_MODE mode, uid_t userId)=0
virtual int registerMediaMetadataObserver (IMetadataObserver *observer, IMetadataObserver::METADATA_TYPE type)=0
virtual int setParameters (const char *parameters)=0
virtual int setLocalVideoRenderer (IVideoSink *videoSink)=0
virtual int setRemoteVideoRenderer (uid_t uid, IVideoSink *videoSink)=0
virtual int setCameraTorchOn (bool isOn)=0
virtual bool isCameraTorchSupported ()=0
virtual int setCameraZoomFactor (float factor)=0
virtual float getCameraMaxZoomFactor ()=0
virtual bool isCameraZoomSupported ()=0
virtual bool isCameraFocusSupported ()=0
virtual bool isCameraExposurePositionSupported ()=0
virtual bool isCameraAutoFocusFaceModeSupported ()=0
virtual int setCameraFocusPositionInPreview (float positionX, float positionY)=0
virtual int setCameraExposurePosition (float positionXinView, float positionYinView)=0
virtual int setCameraAutoFocusFaceModeEnabled (bool enabled)=0
virtual int takeSnapshot (const char *channel, uid_t uid, const char *filePath)=0

Additional Inherited Members

- Public Types inherited from agora::rtc::IRtcEngine
typedef unsigned int WindowIDType
typedef HWND WindowIDType
- Static Public Member Functions inherited from agora::rtc::IRtcEngine
static AGORA_CPP_API void release (bool sync=false)
- Protected Member Functions inherited from agora::rtc::IRtcEngine
virtual ~IRtcEngine ()

Detailed Description


The IRtcEngine2 class.

Member Function Documentation

◆ createChannel()

virtual IChannel * agora::rtc::IRtcEngine2::createChannel ( const char *  channelId)
pure virtual

Creates and gets an IChannel object.

To join more than one channel, call this method multiple times to create as many IChannel objects as needed, and call the joinChannel method of each created IChannel object.

After joining multiple channels, you can simultaneously subscribe to streams of all the channels, but publish a stream in only one channel at one time.

channelIdThe unique channel name for an Agora RTC session. It must be in the string format and not exceed 64 bytes in length. Supported character scopes are:
  • All lowercase English letters: a to z.
  • All uppercase English letters: A to Z.
  • All numeric characters: 0 to 9.
  • The space character.
  • Punctuation characters and other symbols, including: "!", "#", "$", "%", "&", "(", ")", "+", "-", ":", ";", "<", "=", ".", ">", "?", "@", "[", "]", "^", "_", " {", "}", "|", "~", ",".
  • This parameter does not have a default value. You must set it.
  • Do not set it as the empty string "". Otherwise, the SDK returns ERR_REFUSED (5).
  • The IChannel object, if the method call succeeds.
  • An empty pointer NULL, if the method call fails.
  • ERR_REFUSED(5), if you set channelId as the empty string "".