Public Types | |
typedef unsigned int | WindowIDType |
typedef HWND | WindowIDType |
Public Member Functions | |
virtual int | initialize (const RtcEngineContext &context)=0 |
virtual void | release (bool sync=false)=0 |
virtual int | setChannelProfile (CHANNEL_PROFILE_TYPE profile)=0 |
virtual int | setClientRole (CLIENT_ROLE_TYPE role)=0 |
virtual int | joinChannel (const char *token, const char *channelId, const char *info, uid_t uid)=0 |
virtual int | leaveChannel ()=0 |
virtual int | renewToken (const char *token)=0 |
virtual int | queryInterface (INTERFACE_ID_TYPE iid, void **inter)=0 |
virtual int | startEchoTest ()=0 |
virtual int | startEchoTest (int intervalInSeconds)=0 |
virtual int | stopEchoTest ()=0 |
virtual int | enableVideo ()=0 |
virtual int | disableVideo ()=0 |
virtual int | setVideoProfile (VIDEO_PROFILE_TYPE profile, bool swapWidthAndHeight)=0 |
virtual int | setVideoEncoderConfiguration (const VideoEncoderConfiguration &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 | startScreenCaptureByDisplayId (unsigned int displayId, const Rectangle ®ionRect, const ScreenCaptureParameters &captureParams)=0 |
virtual int | startScreenCaptureByScreenRect (const Rectangle &screenRect, const Rectangle ®ionRect, const ScreenCaptureParameters &captureParams)=0 |
virtual int | startScreenCaptureByWindowId (view_t windowId, const Rectangle ®ionRect, const ScreenCaptureParameters &captureParams)=0 |
virtual int | setScreenCaptureContentHint (VideoContentHint contentHint)=0 |
virtual int | updateScreenCaptureParameters (const ScreenCaptureParameters &captureParams)=0 |
virtual int | updateScreenCaptureRegion (const Rectangle ®ionRect)=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 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)=0 |
virtual int | setEncryptionMode (const char *encryptionMode)=0 |
virtual int | registerPacketObserver (IPacketObserver *observer)=0 |
virtual int | createDataStream (int *streamId, bool reliable, bool ordered)=0 |
virtual int | sendStreamMessage (int streamId, const char *data, size_t length)=0 |
virtual int | addPublishStreamUrl (const char *url, bool transcodingEnabled)=0 |
virtual int | removePublishStreamUrl (const char *url)=0 |
virtual int | setLiveTranscoding (const LiveTranscoding &transcoding)=0 |
virtual int | configPublisher (const PublisherConfiguration &config)=0 |
virtual int | setVideoCompositingLayout (const VideoCompositingLayout &sei)=0 |
virtual int | clearVideoCompositingLayout ()=0 |
virtual int | addVideoWatermark (const RtcImage &watermark)=0 |
virtual int | clearVideoWatermarks ()=0 |
virtual int | setBeautyEffectOptions (bool enabled, BeautyOptions options)=0 |
virtual int | addInjectStreamUrl (const char *url, const InjectStreamConfig &config)=0 |
virtual int | removeInjectStreamUrl (const char *url)=0 |
virtual bool | registerEventHandler (IRtcEngineEventHandler *eventHandler)=0 |
virtual bool | unregisterEventHandler (IRtcEngineEventHandler *eventHandler)=0 |
virtual CONNECTION_STATE_TYPE | getConnectionState ()=0 |
Protected Member Functions | |
virtual | ~IRtcEngine () |
IRtcEngine is the base interface class of the Agora SDK that provides the main Agora SDK methods invoked by your application.
Enable the Agora SDK's communication functionality through the creation of an IRtcEngine object, then call the methods of this object.
typedef unsigned int agora::rtc::IRtcEngine::WindowIDType |
typedef HWND agora::rtc::IRtcEngine::WindowIDType |
|
inlineprotectedvirtual |
|
pure virtual |
Initializes the Agora SDK service.
After calling the createAgoraRtcEngine() method to create an IRtcEngine object, call this method to initialize the Agora SDK service before calling any method. After initialization, the service is set to voice mode by default. Use the issued Agora App ID in RtcEngineContext.
context | Pointer to the RTC engine context. See RtcEngineContext. |
|
pure virtual |
Releases all IRtcEngine resources.
sync |
|
|
pure virtual |
Sets the channel profile.
The SDK needs to know the application scenario to set the appropriate channel profile to apply different optimization methods.
profile | Sets the channel profile. See CHANNEL_PROFILE_TYPE. |
|
pure virtual |
Sets the role of the user, such as a host or an audience (default), before joining a channel in a live broadcast.
This method can be used to switch the user role in a live broadcast after the user joins a channel.
role | Sets the role of the user. See CLIENT_ROLE_TYPE. |
|
pure virtual |
Allows a user to join a channel.
Users in the same channel can talk to each other, and multiple users in the same channel can start a group chat. Users with different App IDs cannot call each other.
You must call the leaveChannel method to exit the current call before entering another channel.
uid
. If you set uid
as 0, the system automatically assigns a uid
. token | Pointer to the token generated by the application server. In most circumstances, a static App ID suffices. For added security, use a Channel Key.
|
channelId | Pointer to the unique channel name for the Agora RTC session in the string format smaller than 64 bytes. Supported characters:
|
info | (Optional) Pointer to additional information about the channel. This parameter can be set to NULL or contain channel related information. Other users in the channel will not receive this message. |
uid | (Optional) User ID. A 32-bit unsigned integer with a value ranging from 1 to 232-1. The uid must be unique. If a uid is not assigned (or set to 0), the SDK assigns and returns a uid in the onJoinChannelSuccess callback. Your application must record and maintain the returned uid since the SDK does not do so. |
|
pure virtual |
Allows a user to leave a channel, such as hanging up or exiting a call.
After joining a channel, the user must call the leaveChannel method to end the call before joining another channel.
This method returns 0 if the user leaves the channel and releases all resources related to the call.
This method call is asynchronous, and the user has not left the channel when the method call returns. Once the user leaves the channel, the SDK triggers the onLeaveChannel callback.
|
pure virtual |
Gets a new token when the current token expires after a period of time.
The token expires after a period of time once the token schema is enabled when:
The application should call this method to get the new token. Failure to do so will result in the SDK disconnecting from the server.
token | Pointer to the new token. |
|
pure virtual |
Retrieves the pointer to the device manager object.
iid | ID of the interface. |
inter | Pointer to the DeviceManager object. |
|
pure virtual |
DEPRECATED Starts an audio call test.
This method is deprecated as of v2.4.0.
This method starts an audio call test to check whether the audio devices (for example, headset and speaker) and the network connection are working properly.
To conduct the test:
|
pure virtual |
Starts an audio call test.
This method starts an audio call test to determine whether the audio devices (for example, headset and speaker) and the network connection are working properly.
In the audio call test, you record your voice. If the recording plays back within the set time interval, the audio devices and the network connection are working properly.
intervalInSeconds | The time interval (s) between when you speak and when the recording plays back. |
|
pure virtual |
Stops the audio call test.
|
pure virtual |
Enables the video module.
Call this method either before joining a channel or during a call. If this method is called before joining a channel, the call starts in the video mode. If this method is called during an audio call, the audio mode switches to the video mode. To disable the video module, call the disableVideo method.
|
pure virtual |
Disables the video module.
This method can be called before joining a channel or during a call. If this method is called before joining a channel, the call starts in audio mode. If this method is called during a video call, the video mode switches to the audio mode. To enable the video module, call the enableVideo method.
|
pure virtual |
DEPRECATED Sets the video profile.
This method is deprecated as of v2.3. Use the setVideoEncoderConfiguration method instead.
Each video profile includes a set of parameters, such as the resolution, frame rate, and bitrate. If the camera device does not support the specified resolution, the SDK automatically chooses a suitable camera resolution, keeping the encoder resolution specified by the setVideoProfile method.
profile | Sets the video profile. See VIDEO_PROFILE_TYPE. |
swapWidthAndHeight | Sets whether to swap the width and height of the video stream:
|
|
pure virtual |
Sets the video encoder configuration.
Each video encoder configuration corresponds to a set of video parameters, including the resolution, frame rate, bitrate, and video orientation.
The parameters specified in this method are the maximum values under ideal network conditions. If the video engine cannot render the video using the specified parameters due to poor network conditions, the parameters further down the list are considered until a successful configuration is found.
config | Sets the local video encoder configuration. See VideoEncoderConfiguration. |
|
pure virtual |
Sets the local video view and configures the video display settings on the local machine.
The application calls this method to bind each video window (view) of the local video streams and configures the video display settings. Call this method after initialization to configure the local video display settings before joining a channel. The binding is still valid after the user leaves the channel, which means that the window still displays. To unbind the view, set the view in VideoCanvas to NULL.
canvas | Pointer to the local video view and settings. See VideoCanvas. |
|
pure virtual |
Sets the remote video view.
This method binds the remote user to the video display window (sets the view for the remote user by the specified uid in VideoCanvas).
The application specifies the uid of the remote video in this method before the remote user joins the channel.
If the remote uid is unknown to the application, set it after the application receives the onUserJoined callback.
If the Video Recording function is enabled, the Video Recording Service joins the channel as a dummy client, causing other clients to also receive the onUserJoined callback. Do not bind the dummy client to the application view because the dummy client does not send any video streams. If your application does not recognize the dummy client, bind the remote user to the view when the SDK triggers the onFirstRemoteVideoDecoded callback.
To unbind the remote user from the view, set the view in VideoCanvas to NULL. Once the remote user leaves the channel, the SDK unbinds the remote user.
canvas | Pointer to the remote video view and settings. See VideoCanvas. |
|
pure virtual |
Starts the local video preview before joining the channel.
Before calling this method, you must:
|
pure virtual |
Prioritizes a remote user's stream.
Use this method with the setRemoteSubscribeFallbackOption method. If the fallback function is enabled for a subscribed stream, the SDK ensures the high-priority user gets the best possible stream quality.
userPriority
as high for one user only.uid | The ID of the remote user. |
userPriority | Sets the priority of the remote user. See PRIORITY_TYPE. |
|
pure virtual |
Stops the local video preview and disables video.
|
pure virtual |
Enables the audio module.
The audio mode is enabled by default.
|
pure virtual |
Disables/Re-enables the local audio function.
The audio function is enabled by default. This method disables or re-enables the local audio function, that is, to stop or restart local audio capturing.
This method does not affect receiving or playing the remote audio streams.
The SDK triggers the onMicrophoneEnabled callback once the local audio function is disabled or enabled.
enabled | Sets whether to disable/re-enable the local audio function:
|
|
pure virtual |
Disables the audio module.
|
pure virtual |
Sets the audio parameters and application scenarios.
profile | Sets the sample rate, bitrate, encoding mode, and the number of channels. See AUDIO_PROFILE_TYPE. |
scenario | Sets the audio application scenario. See AUDIO_SCENARIO_TYPE. |
|
pure virtual |
Shares the whole or part of a screen by specifying the display ID.
displayId | The display ID of the screen to be shared. This parameter specifies which screen you want to share. For information on how to get the displayId, see [Share the Screen]. |
regionRect | (Optional) Sets the relative location of the region to the screen. NIL means sharing the whole screen. See Rectangle. 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 | Sets the screen sharing encoding parameters. See ScreenCaptureParameters. |
|
pure virtual |
Shares the whole or part of a screen by specifying the screen rect.
screenRect | Sets the relative location of the screen to the virtual screen. For information on how to get screenRect, see [Share the Screen]. |
regionRect | (Optional) Sets the relative location of the region to the screen. NULL means sharing the whole screen. See Rectangle. 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 | Sets the screen sharing encoding parameters. See ScreenCaptureParameters. |
|
pure virtual |
Shares the whole or part of a window by specifying the window ID.
windowId | The ID of the window to be shared. For information on how to get the windowId, see [Share the Window]. |
regionRect | (Optional) The relative location of the region to the window. NULL/NIL means sharing the whole window. See Rectangle. 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 | Window sharing encoding parameters. See ScreenCaptureParameters. |
|
pure virtual |
Sets the content hint for screen sharing.
A content hint suggests the type of the content being shared, so that the SDK applies different optimization algorithm to different types of content.
contentHint | Sets the content hint for screen sharing. See VideoContentHint. |
|
pure virtual |
Updates the screen sharing parameters.
captureParams | Sets the screen sharing encoding parameters. See ScreenCaptureParameters. |
|
pure virtual |
Updates the screen sharing region.
regionRect | Sets the relative location of the region to the screen or window. NULL means sharing the whole screen or window. See Rectangle. 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. |
|
pure virtual |
Stop screen sharing.
|
pure virtual |
DEPRECATED Starts screen sharing.
This method is deprecated as of v2.4.0. See the following methods instead:
This method shares the whole screen, specified window, or specified region:
windowId
as 0 and rect
as NULL.windowId
as a value other than 0. Each window has a windowId
that is not 0.windowId
as 0 and rect
not as NULL. In this case, you can share the specified region, for example by dragging the mouse or implementing your own logic.windowId | Sets the screen sharing area. See WindowIDType. |
captureFreq | (Mandatory) The captured frame rate. The value ranges between 1 fps and 15 fps. |
rect | Specifies the screen-sharing region. rect is valid when windowsId is set as 0. When rect is set as NULL, the whole screen is shared. |
bitrate | The captured bitrate. |
|
pure virtual |
DEPRECATED Updates the screen capture region.
rect | Specifies the required region inside the screen or window. |
|
pure virtual |
Retrieves the current call ID.
When a user joins a channel on a client, a callId
is generated to identify the call from the client. Feedback methods, such as rate and complain, must be called after the call ends to submit feedback to the SDK.
The rate and complain methods require the callId
parameter retrieved from the getCallId method during a call. callId
is passed as an argument into the rate and complain methods after the call ends.
callId | Pointer to the current call ID. |
|
pure virtual |
Allows a user to rate a call after the call ends.
callId | Pointer to the ID of the call, retrieved from the getCallId method. |
rating | Rating of the call. The value is between 1 (lowest score) and 5 (highest score). If you set a value out of this range, the ERR_INVALID_ARGUMENT (2) error returns. |
description | (Optional) Pointer to the description of the rating, with a string length of less than 800 bytes. |
|
pure virtual |
Allows a user to complain about the call quality after a call ends.
callId | Pointer to the ID of the call, retrieved from the getCallId method. |
description | (Optional) Pointer to the description of the complaint, with a string length of less than 800 bytes. |
|
pure virtual |
Retrieves the SDK version number.
build | Pointer to the build number. |
|
pure virtual |
Enables the network connection quality test.
This method tests the quality of the users’ network connections and is disabled by default.
Before a user joins a channel or before an audience switches to a host, call this method to check the uplink network quality.
This method consumes additional network traffic, and hence may affect communication quality.
Call the disableLastmileTest method to disable this test after receiving the onLastmileQuality callback, and before joining a channel.
|
pure virtual |
Disables the network connection quality test.
|
pure virtual |
Starts the last-mile network probe test.
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 this method to check the uplink network quality before users join a channel or before an audience switches to a host. Once this method is enabled, the SDK returns the following callbacks:
config | Sets the configurations of the last-mile network probe test. See LastmileProbeConfig. |
|
pure virtual |
Stops the last-mile network probe test.
|
pure virtual |
Retrieves the warning or error description.
|
pure virtual |
Enables built-in encryption with an encryption password before users join a channel.
All users in a channel must use the same encryption password. The encryption password is automatically cleared once a user leaves the channel.
If an encryption password is not specified, the encryption functionality will be disabled.
secret | Pointer to the encryption password. |
|
pure virtual |
Sets the built-in encryption mode.
The Agora SDK supports built-in encryption, which is set to the aes-128-xts
mode by default. Call this method to use other encryption modes.
All users in the same channel must use the same encryption mode and password.
Refer to the information related to the AES encryption algorithm on the differences between the encryption modes.
encryptionMode | Pointer to the set encryption mode:
|
|
pure virtual |
Registers a packet observer.
The Agora SDK allows your application to register a packet observer to receive callbacks for voice or video packet transmission.
observer | Pointer to the registered packet observer. See IPacketObserver. |
|
pure virtual |
Creates a data stream.
Each user can have up to five simultaneous data streams in a channel.
reliable
and ordered
parameters to true or false. Do not set one as true and the other as false.streamId | Pointer to the ID of the created data stream. |
reliable | Sets whether or not the recipients are guaranteed to receive the data stream from the sender within five seconds:
|
ordered | Sets whether or not the recipients receive the data stream in the sent order:
|
|
pure virtual |
Sends data stream messages to all users in a channel.
The SDK has the following restrictions on this method:
streamId | ID of the sent data stream, returned in the createDataStream method. |
data | Pointer to the sent data. |
length | Length of the sent data. |
|
pure virtual |
Adds a stream RTMP URL address, to which the host publishes the stream. (CDN live only.)
The host publishes the stream to the specified CDN live RTMP address. The corresponding callback is: onStreamPublished.
url | Pointer to the RTMP URL address, to which the host publishes the stream. |
transcodingEnabled | Sets whether transcoding is enabled/disabled:
|
|
pure virtual |
Removes a stream RTMP URL address. (CDN live only.)
This method removes the RTMP URL address (added by the addPublishStreamUrl method) from a CDN live stream.
url | Pointer to the RTMP URL address to be removed. |
|
pure virtual |
Sets the video layout and audio settings for CDN live. (CDN live only.)
transcoding | Sets the CDN live audio/video transcoding settings. See LiveTranscoding. |
|
pure virtual |
DEPRECATED Configures the CDN live stream before the user joins a channel.
This method is deprecated. We recommend using the following methods instead:
config | Pointer to the CDN live streaming settings. See PublisherConfiguration. |
|
pure virtual |
DEPRECATED Sets the picture-in-picture layouts for CDN live broadcasts. (CDN live only.)
sei | Pointer to the video compositing layout. See VideoCompositingLayout. |
|
pure virtual |
DEPRECATED Removes the picture-in-picture layout settings created by the setVideoCompositingLayout method. (CDN live only.)
|
pure virtual |
Adds a watermark image to the local video or CDN live stream.
This method adds a PNG watermark image to the local video stream for the recording device, channel audience, and CDN live audience to view and capture.
To add the PNG file to the CDN live publishing stream, see the setLiveTranscoding method.
watermark | Pointer to the watermark image to be added to the local video stream. See RtcImage. |
|
pure virtual |
Removes the watermark image from the video stream added by the addVideoWatermark method.
|
pure virtual |
Supports Android and iOS only! Enables/Disables image enhancement and sets the options.
enabled | Sets whether or not to enable image enhancement:
|
options | Sets the image enhancement option. See BeautyOptions. |
|
pure virtual |
Adds a voice or video stream URL address to a live broadcast.
uid
of 666, and the onUserJoined and onFirstRemoteVideoFrame callbacks are triggered.url | Pointer to the URL address to be added to the ongoing live broadcast. Valid protocols are RTMP, HLS, and FLV.
|
config | Pointer to the InjectStreamConfig object that contains the configuration of the added voice or video stream. |
|
pure virtual |
Removes the voice or video stream URL address from a live broadcast.
This method removes the URL address (added by the addInjectStreamUrl method) from the live broadcast.
url | Pointer to the URL address of the added stream to be removed. |
|
pure virtual |
|
pure virtual |
|
pure virtual |
Gets the connection state of the SDK.