Agora Java API Reference for Android

Public Member Functions | List of all members
agora::base::IAgoraService Class Referenceabstract

`#include <IAgoraService.h>`

## Public Member Functions
virtual int | initialize (const AgoraServiceConfiguration &config)=0
virtual int | atExit (aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual int | release ()=0
virtual int | setAudioSessionPreset (agora::rtc::AUDIO_SCENARIO_TYPE scenario, aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual int | setAudioSessionConfiguration (const AudioSessionConfiguration &config, aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual int | getAudioSessionConfiguration (AudioSessionConfiguration *config)=0
virtual int | setLogFile (const char *filePath, unsigned int fileSize, aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual int | setLogFilter (unsigned int filters, aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual agora_refptr< rtc::IRtcConnection > | createRtcConnection (const rtc::RtcConnectionConfiguration &cfg)=0
virtual agora_refptr< rtc::IRtmpConnection > | createRtmpConnection (const rtc::RtmpConnectionConfiguration &cfg)=0
virtual agora_refptr< rtc::ILocalAudioTrack > | createLocalAudioTrack ()=0
virtual agora_refptr< rtc::ILocalAudioTrack > | createLocalMixedAudioTrack ()=0
virtual agora_refptr< rtc::ILocalAudioTrack > | createCustomAudioTrack (agora_refptr< rtc::IAudioPcmDataSender > audioSource)=0
virtual agora_refptr< rtc::ILocalAudioTrack > | createDirectCustomAudioTrack (agora_refptr< rtc::IAudioPcmDataSender > audioSource)=0
virtual agora_refptr< rtc::ILocalAudioTrack > | createCustomAudioTrack (agora_refptr< rtc::IAudioPcmDataSender > audioSource, bool enableAec)=0
virtual agora_refptr< rtc::ILocalAudioTrack > | createCustomAudioTrack (agora_refptr< rtc::IRemoteAudioMixerSource > audioSource)=0
virtual agora_refptr< rtc::ILocalAudioTrack > | createCustomAudioTrack (agora_refptr< rtc::IAudioEncodedFrameSender > audioSource, TMixMode mixMode)=0
virtual agora_refptr< rtc::ILocalAudioTrack > | createCustomAudioTrack (agora_refptr< rtc::IMediaPacketSender > source)=0
virtual agora_refptr< rtc::ILocalAudioTrack > | createMediaPlayerAudioTrack (agora_refptr< rtc::IMediaPlayerSource > audioSource)=0
virtual agora_refptr< rtc::ILocalAudioTrack > | createMediaStreamingAudioTrack (agora_refptr< rtc::IMediaStreamingSource > streamingSource)=0
virtual agora_refptr< rtc::ILocalAudioTrack > | createRecordingDeviceAudioTrack (agora_refptr< rtc::IRecordingDeviceSource > audioSource, bool enableAec, bool overlap)=0
virtual agora_refptr< rtc::INGAudioDeviceManager > | createAudioDeviceManager ()=0
virtual agora_refptr< rtc::INGVideoDeviceManager > | createVideoDeviceManager ()=0
virtual agora_refptr< rtc::IMediaNodeFactory > | createMediaNodeFactory ()=0
virtual agora_refptr< rtc::ILocalVideoTrack > | createCameraVideoTrack (agora_refptr< rtc::ICameraCapturer > videoSource, const char *id=OPTIONAL_NULLPTR)=0
virtual agora_refptr< rtc::ILocalVideoTrack > | createMixedVideoTrack (agora_refptr< rtc::IVideoMixerSource > videoSource, const char *id=OPTIONAL_NULLPTR)=0
virtual agora_refptr< rtc::ILocalVideoTrack > | createTranscodedVideoTrack (agora_refptr< rtc::IVideoFrameTransceiver > transceiver, const char *id=OPTIONAL_NULLPTR)=0
virtual agora_refptr< rtc::ILocalVideoTrack > | createCustomVideoTrack (agora_refptr< rtc::IVideoFrameSender > videoSource, const char *id=OPTIONAL_NULLPTR)=0
virtual agora_refptr< rtc::ILocalVideoTrack > | createCustomVideoTrack (agora_refptr< rtc::IVideoEncodedImageSender > videoSource, const rtc::SenderOptions &options, const char *id=OPTIONAL_NULLPTR)=0
virtual agora_refptr< rtc::ILocalVideoTrack > | createScreenCaptureVideoTrack (agora_refptr< rtc::IScreenCapturer > screen, const char *id=OPTIONAL_NULLPTR)=0
virtual agora_refptr< rtc::ILocalAudioTrack > | createScreenCaptureAudioTrack (agora_refptr< rtc::IScreenCapturer > screen)=0
virtual agora_refptr< rtc::ILocalVideoTrack > | createCustomVideoTrack (agora_refptr< rtc::IMediaPacketSender > source, const char *id=OPTIONAL_NULLPTR)=0
virtual agora_refptr< rtc::ILocalVideoTrack > | createMediaPlayerVideoTrack (agora_refptr< rtc::IMediaPlayerSource > videoSource, const char *id=OPTIONAL_NULLPTR)=0
virtual agora_refptr< rtc::ILocalVideoTrack > | createMediaStreamingVideoTrack (agora_refptr< rtc::IMediaStreamingSource > streamingSource, const char *id=OPTIONAL_NULLPTR)=0
virtual agora_refptr< rtc::IRtmpStreamingService > | createRtmpStreamingService (agora_refptr< rtc::IRtcConnection > rtcConnection, const char *appId)=0
virtual agora_refptr< rtc::IMediaRelayService > | createMediaRelayService (agora_refptr< rtc::IRtcConnection > rtcConnection, const char *appId)=0
virtual agora_refptr< rtc::IFileUploaderService > | createFileUploadService (agora_refptr< rtc::IRtcConnection > rtcConnection, const char *appId)=0
virtual rtm::IRtmService * | createRtmService ()=0
virtual int | addExtensionObserver (agora::agora_refptr< agora::rtc::IMediaExtensionObserver > observer, aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual int | removeExtensionObserver (agora::agora_refptr< agora::rtc::IMediaExtensionObserver > observer, aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual agora_refptr< rtc::IAudioDeviceManager > | createAudioDeviceManagerComponent (rtc::IAudioDeviceManagerObserver *observer)=0
virtual agora_refptr< ILocalDataChannel > | createLocalDataChannel (const DataChannelConfig &config)=0
virtual const char * | getExtensionId (const char *provider_name, const char *extension_name)=0
| Get the ID of the registered extension. More...
virtual int | enableExtension (const char *provider_name, const char *extension_name, const char *track_id=NULL, bool auto_enable_on_track=false, aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual int | disableExtension (const char *provider_name, const char *extension_name, const char *track_id=NULL, aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual agora_refptr< base::IAgoraParameter > | getAgoraParameter ()=0
virtual agora_refptr< rtc::IConfigCenter > | getConfigCenter ()=0
virtual agora_refptr< base::ISyncClient > | createSyncClient (const base::SyncConfig &config)=0
virtual int32_t | setLogWriter (agora::commons::ILogWriter *logWriter)=0
virtual agora::commons::ILogWriter * | releaseLogWriter ()=0

## Detailed Description

The IAgoraService class.

`IAgoraService` is the entry point of Agora low-level APIs. Use this interface to create access points to Agora interfaces, including RTC connections and media tracks.

You can create an `IAgoraService` object by calling createAgoraService.

You can configure the `IAgoraService` object for different user scenarios on the global level by using `AgoraServiceConfiguration`.

## Member Function Documentation

## ◆ initialize()

virtual int agora::base::IAgoraService::initialize | ( | const AgoraServiceConfiguration & | config | ) |
| pure virtual

Initializes the AgoraService object.

Parameters

  config | The configuration of the initialization. For details, see AgoraServiceConfiguration.

Returns
  - 0: Success.
  - < 0: Failure.
    - `ERR_INVALID_ARGUMENT`, if `context` in `AgoraServiceConfiguration` is not provided for Android.
    - `ERR_INIT_NET_ENGINE`, if the network engine cannot be initialized. On Windows, the error occurs mostly because the connection to the local port is disabled by the firewall. In this case, turn off the firewall and then turn it on again.

## ◆ atExit()

virtual int agora::base::IAgoraService::atExit | ( | aosl_ref_t | ares = `AOSL_REF_INVALID` | ) |
| pure virtual

Flush log & cache before exit

## ◆ release()

virtual int agora::base::IAgoraService::release | ( |  | ) |
| pure virtual

Releases the AgoraService object.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setAudioSessionPreset()

virtual int agora::base::IAgoraService::setAudioSessionPreset | ( | agora::rtc::AUDIO_SCENARIO_TYPE | scenario,
|  | aosl_ref_t | ares = `AOSL_REF_INVALID`
| ) |  |
| pure virtual

Configures the preset audio scenario.

Parameters

  scenario | The preset audio scenario: AUDIO_SCENARIO_TYPE.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setAudioSessionConfiguration()

virtual int agora::base::IAgoraService::setAudioSessionConfiguration | ( | const AudioSessionConfiguration & | config,
|  | aosl_ref_t | ares = `AOSL_REF_INVALID`
| ) |  |
| pure virtual

Customizes the audio session configuration.

Parameters

  config | The reference to the audio session configuration: AudioSessionConfiguration.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ getAudioSessionConfiguration()

virtual int agora::base::IAgoraService::getAudioSessionConfiguration | ( | AudioSessionConfiguration * | config | ) |
| pure virtual

Gets the audio session configuration.

Parameters

  [out] | config | The pointer to the audio session configuration: AudioSessionConfiguration.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setLogFile()

virtual int agora::base::IAgoraService::setLogFile | ( | const char * | filePath,
|  | unsigned int | fileSize,
|  | aosl_ref_t | ares = `AOSL_REF_INVALID`
| ) |  |
| pure virtual

Sets the path and size of the SDK log files.

The SDK records all the log data during the SDK runtime in two log files, each with a default size of 512 KB. If you set `fileSize` as 1024 KB, the SDK outputs log files with a maximum size of 2 MB. If the total size of the log files exceeds the set value, the new output log overwrites the old output log.

Note
  To ensure that the output log is complete, call this method immediately after calling initialize.

Parameters

  filePath | The pointer to the log file. Ensure that the directory of the log file exists and is writable.
  fileSize | The size of the SDK log file size (Byte), which means fileSize bytes per log file.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setLogFilter()

virtual int agora::base::IAgoraService::setLogFilter | ( | unsigned int | filters,
|  | aosl_ref_t | ares = `AOSL_REF_INVALID`
| ) |  |
| pure virtual

Sets the SDK log output filter.

The log level follows the sequence of OFF, CRITICAL, ERROR, WARNING, INFO, and DEBUG.

Select a level to output the logs in and above the selected level. For example, if you set the log level to WARNING, you can see the logs in the levels of CRITICAL, ERROR, and WARNING.

Parameters

  filters | The log output filter. `LOG_LEVEL_NONE (0x0000)`: Do not output any log file. `LOG_LEVEL_INFO (0x0001)`: (Recommended) Output log files of the INFO level. `LOG_LEVEL_WARN (0x0002)`: Output log files of the WARN level. `LOG_LEVEL_ERROR (0x0004)`: Output log files of the ERROR level. `LOG_LEVEL_FATAL (0x0008)`: Output log files of the FATAL level.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ createRtcConnection()

virtual agora_refptr<rtc::IRtcConnection> agora::base::IAgoraService::createRtcConnection | ( | const rtc::RtcConnectionConfiguration & | cfg | ) |
| pure virtual

Creates an RtcConnection object and returns the pointer.

Parameters

  cfg | The reference to the RTC connection configuration: RtcConnectionConfiguration.

Returns
  - The pointer to IRtcConnection: Success.
  - A null pointer: Failure.

## ◆ createLocalAudioTrack()

virtual agora_refptr<rtc::ILocalAudioTrack> agora::base::IAgoraService::createLocalAudioTrack | ( |  | ) |
| pure virtual

Creates a local audio track object and returns the pointer.

By default, the audio track is created from the selected audio input device, such as the built-in microphone on a mobile device.

Returns
  - The pointer to ILocalAudioTrack: Success.
  - A null pointer: Failure.
  - `INVALID_STATE`, if `enableAudioProcessor` in AgoraServiceConfiguration is set as `false`.

## ◆ createLocalMixedAudioTrack()

virtual agora_refptr<rtc::ILocalAudioTrack> agora::base::IAgoraService::createLocalMixedAudioTrack | ( |  | ) |
| pure virtual

Creates a local mixed audio track object and returns the pointer.

By default, the audio track is created from mix source, which could mixed target track.

Returns
  - The pointer to ILocalAudioTrack: Success.
  - A null pointer: Failure.

## ◆ createCustomAudioTrack() [1/5]

virtual agora_refptr<rtc::ILocalAudioTrack> agora::base::IAgoraService::createCustomAudioTrack | ( | agora_refptr< rtc::IAudioPcmDataSender > | audioSource | ) |
| pure virtual

Creates a local audio track object with a PCM data sender and returns the pointer.

Once created, this track can be used to send PCM audio data.

Parameters

  audioSource | The pointer to the PCM audio data sender: IAudioPcmDataSender.

Returns
  - The pointer to ILocalAudioTrack: Success.
  - A null pointer: Failure.
  - `INVALID_STATE`, if `enableAudioProcessor` in AgoraServiceConfiguration is set as `false`.

## ◆ createDirectCustomAudioTrack()

virtual agora_refptr<rtc::ILocalAudioTrack> agora::base::IAgoraService::createDirectCustomAudioTrack | ( | agora_refptr< rtc::IAudioPcmDataSender > | audioSource | ) |
| pure virtual

Creates a local audio track object with a PCM data sender and returns the pointer. The source is not intended to be mixed with other source.

Once created, this track can be used to send PCM audio data.

Parameters

  audioSource | The pointer to the PCM audio data sender: IAudioPcmDataSender.

Returns
  - The pointer to ILocalAudioTrack: Success.
  - A null pointer: Failure.
  - `INVALID_STATE`, if `enableAudioProcessor` in AgoraServiceConfiguration is set as `false`.

## ◆ createCustomAudioTrack() [2/5]

virtual agora_refptr<rtc::ILocalAudioTrack> agora::base::IAgoraService::createCustomAudioTrack | ( | agora_refptr< rtc::IAudioPcmDataSender > | audioSource,
|  | bool | enableAec
| ) |  |
| pure virtual

Creates a local audio track object with a PCM data sender and returns the pointer.

Once created, this track can be used to send PCM audio data.

Parameters

  audioSource | The pointer to the PCM audio data sender: IAudioPcmDataSender.
  enableAec | Whether enable audio echo cancellation for PCM audio data.

Returns
  - The pointer to ILocalAudioTrack: Success.
  - A null pointer: Failure.
  - `INVALID_STATE`, if `enableAudioProcessor` in AgoraServiceConfiguration is set as `false`.

## ◆ createCustomAudioTrack() [3/5]

virtual agora_refptr<rtc::ILocalAudioTrack> agora::base::IAgoraService::createCustomAudioTrack | ( | agora_refptr< rtc::IRemoteAudioMixerSource > | audioSource | ) |
| pure virtual

Creates a local audio track object with a audio mixer source and returns the pointer.

Once created, this track can be used to send PCM audio data.

Parameters

  audioSource | The pointer to the audio mixer source : IRemoteAudioMixerSource.

Returns
  - The pointer to ILocalAudioTrack, if the method call succeeds.
  - A null pointer, if the method call fails.
  - `INVALID_STATE`, if `enableAudioProcessor` in `AgoraServiceConfiguration` is set as `false`.

## ◆ createCustomAudioTrack() [4/5]

virtual agora_refptr<rtc::ILocalAudioTrack> agora::base::IAgoraService::createCustomAudioTrack | ( | agora_refptr< rtc::IAudioEncodedFrameSender > | audioSource,
|  | TMixMode | mixMode
| ) |  |
| pure virtual

Creates a local audio track object with an encoded audio frame sender and returns the pointer.

Once created, this track can be used to send encoded audio frames, such as Opus frames.

Parameters

  audioSource | The pointer to the encoded audio frame sender: IAudioEncoderFrameSender.
  mixMode | The mixing mode of the encoded audio in the channel: #TMixMode.

Returns
  - The pointer to ILocalAudioTrack: Success.
  - A null pointer: Failure.
    - `INVALID_STATE`, if `enableAudioProcessor` is set as `false` in AgoraServiceConfiguration.

## ◆ createCustomAudioTrack() [5/5]

virtual agora_refptr<rtc::ILocalAudioTrack> agora::base::IAgoraService::createCustomAudioTrack | ( | agora_refptr< rtc::IMediaPacketSender > | source | ) |
| pure virtual

Creates a local audio track object with a media packet sender and returns the pointer.

Once created, this track can be used to send audio packets, such as customized UDP/RTP packets.

Parameters

  source | The pointer to the media packet sender: IMediaPacketSender.

Returns
  - The pointer to ILocalAudioTrack: Success.
  - A null pointer: Failure.
  - `INVALID_STATE`, if `enableAudioProcessor` is set as `false` in AgoraServiceConfiguration.

## ◆ createMediaPlayerAudioTrack()

virtual agora_refptr<rtc::ILocalAudioTrack> agora::base::IAgoraService::createMediaPlayerAudioTrack | ( | agora_refptr< rtc::IMediaPlayerSource > | audioSource | ) |
| pure virtual

Creates a local audio track object with an IMediaPlayerSource object and returns the pointer.

Once created, this track can be used to send PCM audio data decoded from a media player.

Parameters

  audioSource | The pointer to the player source. See IMediaPlayerSource.

Returns
  - The pointer to ILocalAudioTrack: Success.
  - A null pointer: Failure.
  - `INVALID_STATE`, if `enableAudioProcessor` is set as `false` in AgoraServiceConfiguration.

## ◆ createMediaStreamingAudioTrack()

virtual agora_refptr<rtc::ILocalAudioTrack> agora::base::IAgoraService::createMediaStreamingAudioTrack | ( | agora_refptr< rtc::IMediaStreamingSource > | streamingSource | ) |
| pure virtual

Creates a local audio track object with an IMediaStreamingSource object and returns the pointer.

Once created, this track can be used to send encoded audio data which demuxed from a media streaming.

Parameters

  streamingSource | The pointer to the streaming source. See IMediaStreamingSource.

Returns
  - The pointer to ILocalAudioTrack: Success.
  - A null pointer: Failure.
  - `INVALID_STATE`, if `enableAudioProcessor` is set as `false` in AgoraServiceConfiguration.

## ◆ createRecordingDeviceAudioTrack()

virtual agora_refptr<rtc::ILocalAudioTrack> agora::base::IAgoraService::createRecordingDeviceAudioTrack | ( | agora_refptr< rtc::IRecordingDeviceSource > | audioSource,
|  | bool | enableAec,
|  | bool | overlap
| ) |  |
| pure virtual

Creates a local audio track object with the recording device source and returns the pointer.

Once created, this track can be used to send audio data got from a recording device.

Parameters

  audioSource | The pointer to the recording device source. See IRecordingDeviceSource.
  enableAec | Whether enable audio echo cancellation for loopback recording. If loopback recording device is a virtual sound card, it should be false, or it should be true.
  overlap | Whether overlap playout signal.

Returns
  - The pointer to ILocalAudioTrack: Success.
  - A null pointer: Failure.

## ◆ createAudioDeviceManager()

virtual agora_refptr<rtc::INGAudioDeviceManager> agora::base::IAgoraService::createAudioDeviceManager | ( |  | ) |
| pure virtual

Creates an audio device manager object and returns the pointer.

Returns
  - The pointer to INGAudioDeviceManager: Success.
  - A null pointer: Failure.

## ◆ createVideoDeviceManager()

virtual agora_refptr<rtc::INGVideoDeviceManager> agora::base::IAgoraService::createVideoDeviceManager | ( |  | ) |
| pure virtual

Creates a video device manager object and returns the pointer.

Returns
  - The pointer to INGVideoDeviceManager: Success.
  - A null pointer: Failure.

## ◆ createMediaNodeFactory()

virtual agora_refptr<rtc::IMediaNodeFactory> agora::base::IAgoraService::createMediaNodeFactory | ( |  | ) |
| pure virtual

Creates a media node factory object and returns the pointer.

Returns
  - The pointer to IMediaNodeFactory: Success.
  - A null pointer: Failure.

## ◆ createCameraVideoTrack()

virtual agora_refptr<rtc::ILocalVideoTrack> agora::base::IAgoraService::createCameraVideoTrack | ( | agora_refptr< rtc::ICameraCapturer > | videoSource,
|  | const char * | id = `OPTIONAL_NULLPTR`
| ) |  |
| pure virtual

Creates a local video track object with a camera capturer and returns the pointer.

Once created, this track can be used to send video data captured by the camera.

Parameters

  videoSource | The pointer to the camera capturer: ICameraCapturer.

Returns
  - The pointer to ILocalVideoTrack: Success.
  - A null pointer: Failure.

## ◆ createMixedVideoTrack()

virtual agora_refptr<rtc::ILocalVideoTrack> agora::base::IAgoraService::createMixedVideoTrack | ( | agora_refptr< rtc::IVideoMixerSource > | videoSource,
|  | const char * | id = `OPTIONAL_NULLPTR`
| ) |  |
| pure virtual

Creates a local video track object with a video mixer and returns the pointer.

Once created, this track can be used to send video data processed by the video mixer.

Parameters

  videoSource | The pointer to the video mixer. See IVideoMixerSource.

Returns
  - The pointer to ILocalVideoTrack: Success.
  - A null pointer: Failure.

## ◆ createTranscodedVideoTrack()

virtual agora_refptr<rtc::ILocalVideoTrack> agora::base::IAgoraService::createTranscodedVideoTrack | ( | agora_refptr< rtc::IVideoFrameTransceiver > | transceiver,
|  | const char * | id = `OPTIONAL_NULLPTR`
| ) |  |
| pure virtual

Creates a local video track object with a video frame transceiver and returns the pointer.

Once created, this track can be used to send video data processed by the transceiver.

Parameters

  transceiver | The pointer to the video transceiver. See IVideoFrameTransceiver.

Returns
  - The pointer to ILocalVideoTrack: Success.
  - A null pointer: Failure.

## ◆ createCustomVideoTrack() [1/3]

virtual agora_refptr<rtc::ILocalVideoTrack> agora::base::IAgoraService::createCustomVideoTrack | ( | agora_refptr< rtc::IVideoFrameSender > | videoSource,
|  | const char * | id = `OPTIONAL_NULLPTR`
| ) |  |
| pure virtual

Creates a local video track object with a customized video source and returns the pointer.

Once created, this track can be used to send video data from a customized source.

Parameters

  videoSource | The pointer to the customized video frame sender: IVideoFrameSender.

Returns
  - The pointer to ILocalVideoTrack: Success.
  - A null pointer: Failure.

## ◆ createCustomVideoTrack() [2/3]

virtual agora_refptr<rtc::ILocalVideoTrack> agora::base::IAgoraService::createCustomVideoTrack | ( | agora_refptr< rtc::IVideoEncodedImageSender > | videoSource,
|  | const rtc::SenderOptions & | options,
|  | const char * | id = `OPTIONAL_NULLPTR`
| ) |  |
| pure virtual

Creates a local video track object with an encoded video image sender and returns the pointer.

Once created, this track can be used to send encoded video images, such as H.264 or VP8 frames.

Parameters

  videoSource | The pointer to the encoded video frame sender. See IVideoEncodedImageSender.
  options | The configuration for creating video encoded image track.

Returns
  - The pointer to ILocalVideoTrack: Success.
  - A null pointer: Failure.

## ◆ createScreenCaptureVideoTrack()

virtual agora_refptr<rtc::ILocalVideoTrack> agora::base::IAgoraService::createScreenCaptureVideoTrack | ( | agora_refptr< rtc::IScreenCapturer > | screen,
|  | const char * | id = `OPTIONAL_NULLPTR`
| ) |  |
| pure virtual

Creates a local video track object with a screen capture source extension and returns the pointer.

Once created, this track can be used to work with the screen capture extension.

Parameters

  screen | The pointer to the screen capture source.

Returns
  - The pointer to ILocalVideoTrack: Success.
  - A null pointer: Failure.

## ◆ createScreenCaptureAudioTrack()

virtual agora_refptr<rtc::ILocalAudioTrack> agora::base::IAgoraService::createScreenCaptureAudioTrack | ( | agora_refptr< rtc::IScreenCapturer > | screen | ) |
| pure virtual

Creates a local audio track object with a screen capture source extension and returns the pointer.

Once created, this track can be used to work with the screen capture extension.

Parameters

  screen | The pointer to the screen capture source.

Returns
  - The pointer to ILocalAudioTrack: Success.
  - A null pointer: Failure.

## ◆ createCustomVideoTrack() [3/3]

virtual agora_refptr<rtc::ILocalVideoTrack> agora::base::IAgoraService::createCustomVideoTrack | ( | agora_refptr< rtc::IMediaPacketSender > | source,
|  | const char * | id = `OPTIONAL_NULLPTR`
| ) |  |
| pure virtual

Creates a local video track object with a media packet sender and returns the pointer.

Once created, this track can be used to send video packets, such as customized UDP/RTP packets.

Parameters

  source | The pointer to the media packet sender: IMediaPacketSender.

Returns
  - The pointer to ILocalVideoTrack: Success.
  - A null pointer: Failure.

## ◆ createMediaPlayerVideoTrack()

virtual agora_refptr<rtc::ILocalVideoTrack> agora::base::IAgoraService::createMediaPlayerVideoTrack | ( | agora_refptr< rtc::IMediaPlayerSource > | videoSource,
|  | const char * | id = `OPTIONAL_NULLPTR`
| ) |  |
| pure virtual

Creates a local video track object with an IMediaPlayerSource object and returns the pointer.

Once created, this track can be used to send YUV frames decoded from a player.

Parameters

  videoSource | The pointer to the player source. See IMediaPlayerSource.

Returns
  - The pointer to ILocalAudioTrack: Success.
  - A null pointer: Failure.

## ◆ createMediaStreamingVideoTrack()

virtual agora_refptr<rtc::ILocalVideoTrack> agora::base::IAgoraService::createMediaStreamingVideoTrack | ( | agora_refptr< rtc::IMediaStreamingSource > | streamingSource,
|  | const char * | id = `OPTIONAL_NULLPTR`
| ) |  |
| pure virtual

Creates a local video track object with an IMediaStreamingSource object and returns the pointer.

Once created, this track can be used to send H264 frames which demuxed from a streaming.

Parameters

  streamingSource | The pointer to the player source. See IMediaStreamingSource.

Returns
  - The pointer to ILocalAudioTrack: Success.
  - A null pointer: Failure.

## ◆ createRtmpStreamingService()

virtual agora_refptr<rtc::IRtmpStreamingService> agora::base::IAgoraService::createRtmpStreamingService | ( | agora_refptr< rtc::IRtcConnection > | rtcConnection,
|  | const char * | appId
| ) |  |
| pure virtual

Creates an RTMP streaming service object and returns the pointer.

Parameters

  rtcConnection | The pointer to IRtcConnection.
  appId | The App ID of the live streaming service.

Returns
  - The pointer to IRtmpStreamingService: Success.
  - A null pointer: Failure.

## ◆ createMediaRelayService()

virtual agora_refptr<rtc::IMediaRelayService> agora::base::IAgoraService::createMediaRelayService | ( | agora_refptr< rtc::IRtcConnection > | rtcConnection,
|  | const char * | appId
| ) |  |
| pure virtual

Creates an Media Relay service object and returns the pointer.

Parameters

  rtcConnection | The pointer to IRtcConnection.
  appId | The App ID of the media relay service.

Returns
  - The pointer to IMediaRelayService, if the method call succeeds.
  - A null pointer, if the method call fails.

## ◆ createFileUploadService()

virtual agora_refptr<rtc::IFileUploaderService> agora::base::IAgoraService::createFileUploadService | ( | agora_refptr< rtc::IRtcConnection > | rtcConnection,
|  | const char * | appId
| ) |  |
| pure virtual

Creates an file upload object and returns the pointer.

Parameters

  rtcConnection | The pointer to IRtcConnection.
  appId | The App ID of the media relay service.

Returns
  - The pointer to IFileUploaderService, if the method call succeeds.
  - A null pointer, if the method call fails.

## ◆ createRtmService()

virtual rtm::IRtmService* agora::base::IAgoraService::createRtmService | ( |  | ) |
| pure virtual

Creates an RTM servive object and returns the pointer.

Returns
  - The pointer to IRtmService: Success.
  - A null pointer: Failure.

## ◆ createAudioDeviceManagerComponent()

virtual agora_refptr<rtc::IAudioDeviceManager> agora::base::IAgoraService::createAudioDeviceManagerComponent | ( | rtc::IAudioDeviceManagerObserver * | observer | ) |
| pure virtual

Creates an audio device manager and returns the pointer.

Returns
  - The pointer to IAudioDeviceManager: Success.
  - A null pointer: Failure.

## ◆ createLocalDataChannel()

virtual agora_refptr<ILocalDataChannel> agora::base::IAgoraService::createLocalDataChannel | ( | const DataChannelConfig & | config | ) |
| pure virtual

Creates an data channel and returns the pointer.

Returns
  - The pointer to ILocalDataChannel: Success.
  - A null pointer: Failure.

## ◆ getExtensionId()

virtual const char* agora::base::IAgoraService::getExtensionId | ( | const char * | provider_name,
|  | const char * | extension_name
| ) |  |
| pure virtual

Get the ID of the registered extension.

Parameters

  provider_name | The pointer to provider name string (null-terminated)
  extension_name | The pointer to extension name string (null-terminated)

Returns
  - Pointer to the extension id string (null-terminated). The pointer will be valid during service's lifetime

## ◆ enableExtension()

virtual int agora::base::IAgoraService::enableExtension | ( | const char * | provider_name,
|  | const char * | extension_name,
|  | const char * | track_id = `NULL`,
|  | bool | auto_enable_on_track = `false`,
|  | aosl_ref_t | ares = `AOSL_REF_INVALID`
| ) |  |
| pure virtual

Enable extension. If the extension is enabled, the track loads the extension automatically.

Parameters

  provider_name | name for provider, e.g. agora.io.
  extension_name | name for extension, e.g. agora.beauty.
  track_id | id for the track, OPTIONAL_NULLPTR means effective on all tracks
  auto_enable_on_track | if the extension is automatically open on track.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ disableExtension()

virtual int agora::base::IAgoraService::disableExtension | ( | const char * | provider_name,
|  | const char * | extension_name,
|  | const char * | track_id = `NULL`,
|  | aosl_ref_t | ares = `AOSL_REF_INVALID`
| ) |  |
| pure virtual

Disable extension.

Parameters

  provider_name | name for provider, e.g. agora.io.
  extension_name | name for extension, e.g. agora.beauty.
  track_id | id for the track, OPTIONAL_NULLPTR means effective on all tracks

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ getAgoraParameter()

virtual agora_refptr<base::IAgoraParameter> agora::base::IAgoraService::getAgoraParameter | ( |  | ) |
| pure virtual

Gets the IAgoraParameter object.

Since
  4.3.0

Returns
  - The pointer to the IAgoraParameter object.
  - A null pointer: Failure.

## ◆ getConfigCenter()

virtual agora_refptr<rtc::IConfigCenter> agora::base::IAgoraService::getConfigCenter | ( |  | ) |
| pure virtual

Get the IConfigCenter object and return the pointer.

Returns
  - The pointer to IConfigCenter: Success.
  - A null pointer: Failure.

## ◆ createSyncClient()

virtual agora_refptr<base::ISyncClient> agora::base::IAgoraService::createSyncClient | ( | const base::SyncConfig & | config | ) |
| pure virtual

Get the ISyncClient object and return the pointer.

Returns
  - The pointer to ISyncClient: Success.
  - A null pointer: Failure.

## ◆ setLogWriter()

virtual int32_t agora::base::IAgoraService::setLogWriter | ( | agora::commons::ILogWriter * | logWriter | ) |
| pure virtual

Set the logWriter for the sdk log.

Parameters

  logWriter | the log writer

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ releaseLogWriter()

virtual agora::commons::ILogWriter* agora::base::IAgoraService::releaseLogWriter | ( |  | ) |
| pure virtual

Release logWriter for the sdk log.

Returns
  -The pointer to agora::commons::ILogWriter
  - A null pointer: Failure.