Documentation
Interactive Live Streaming Standard (Legacy)
API Reference
Agora C++ API Reference for All Platforms
Agora C++ API Reference for All Platforms
◆ release()
virtual void agora::media::IMediaEngine::release |
( |
| ) |
|
|
pure virtual |
◆ registerAudioFrameObserver()
virtual int agora::media::IMediaEngine::registerAudioFrameObserver |
( |
IAudioFrameObserver * |
observer | ) |
|
|
pure virtual |
Registers an audio frame observer object.
This method is used to register an audio frame observer object (register a callback). This method is required to register callbacks when the engine is required to provide an onRecordAudioFrame or onPlaybackAudioFrame callback.
- Parameters
-
observer | Audio frame observer object instance. If NULL is passed in, the registration is canceled. |
- Returns
- 0: Success.
- < 0: Failure.
◆ registerVideoFrameObserver()
virtual int agora::media::IMediaEngine::registerVideoFrameObserver |
( |
IVideoFrameObserver * |
observer | ) |
|
|
pure virtual |
Registers a video frame observer object.
You need to implement the IVideoFrameObserver class in this method, and register the following callbacks according to your scenarios:
- onCaptureVideoFrame: Occurs each time the SDK receives a video frame captured by the local camera.
- onRenderVideoFrame: Occurs each time the SDK receives a video frame sent by the remote user.
- getVideoFormatPreference: Occurs each time the SDK receives a video frame and prompts you to set the video format. YUV420 is the default video format. If you want to receive other video formats, register this callback in the IVideoFrameObserver class.
- getRotationApplied: Occurs each time the SDK receives a video frame and prompts you whether or not to rotate the captured video according to the rotation member in the VideoFrame class. This callback applies to RGBA video data only.
- getMirrorApplied: Occurs each time the SDK receives a video frame and prompts you whether or not to mirror the captured video. This callback applies to RGBA video data only.
After you successfully register the video frame observer, the SDK triggers the registered callbacks each time a video frame is received.
- Parameters
-
observer | Video frame observer object instance. If NULL is passed in, the registration is canceled. |
- Returns
- 0: Success.
- < 0: Failure.
◆ registerVideoRenderFactory()
◆ pushAudioFrame() [1/2]
◆ pushAudioFrame() [2/2]
Pushes the external audio frame.
- Parameters
-
- Returns
- 0: Success.
- < 0: Failure.
◆ pullAudioFrame()
Pulls the remote audio data.
Before calling this method, call the setExternalAudioSink(enabled: true) method to enable and set the external audio sink.
After a successful method call, the app pulls the decoded and mixed audio data for playback.
- Note
- Once you call the pullAudioFrame method successfully, the app will not retrieve any audio data from the onPlaybackAudioFrame callback.
- The difference between the onPlaybackAudioFrame callback and the pullAudioFrame method is as follows:
onPlaybackAudioFrame
: The SDK sends the audio data to the app once every 10 ms. Any delay in processing the audio frames may result in audio jitter.
pullAudioFrame
: The app pulls the remote audio data. After setting the audio data parameters, the SDK adjusts the frame buffer and avoids problems caused by jitter in the external audio playback.
- Parameters
-
frame | Pointers to the audio frame. See: AudioFrame. |
- Returns
- 0: Success.
- < 0: Failure.
◆ setExternalVideoSource()
virtual int agora::media::IMediaEngine::setExternalVideoSource |
( |
bool |
enable, |
|
|
bool |
useTexture |
|
) |
| |
|
pure virtual |
Configures the external video source.
- Parameters
-
enable | Sets whether to use the external video source:
- true: Use the external video source.
- false: (Default) Do not use the external video source.
|
useTexture | Sets whether to use texture as an input:
- true: Use texture as an input.
- false: (Default) Do not use texture as an input.
|
- Returns
- 0: Success.
- < 0: Failure.
◆ pushVideoFrame()
Pushes the video frame using the ExternalVideoFrame and passes the video frame to the Agora SDK.
- Parameters
-
- Note
- In the Communication profile, this method does not support video frames in the Texture format.
- Returns
- 0: Success.
- < 0: Failure.