Public Member Functions | |
boolean | onInitialize (IVideoFrameConsumer consumer) |
boolean | onStart () |
void | onStop () |
void | onDispose () |
int | getBufferType () |
The IVideoSource interface.
Defines a set of protocols to implement the custom video source and pass it to the underlying media engine to replace the default video source.
By default, when enabling real-time communications, the Agora SDK enables the default video input device (built-in camera) to start video streaming. The IVideoSource interface defines a set of protocols to create customized video source objects and pass them to the media engine to replace the default camera source so that you can take ownership of the video source and manipulate it.
Once you have implemented this interface, the Agora Media Engine will automatically release its ownership of the current video input device and pass it on to you, so that you can use the same video input device to capture the video stream.
boolean io.agora.rtc.mediaio.IVideoSource.onInitialize | ( | IVideoFrameConsumer | consumer | ) |
Initializes the video source.
This callback initializes the video source. You can enable the camera or initialize the video source and then pass one of the following return values to inform the media engine whether the video source is ready.
consumer | The IVideoFrameConsumer object which the media engine passes back. You need to reserve this object and pass the video frame to the media engine through this object once the video source is initialized. See the following contents for the definition of IVideoFrameConsumer. |
boolean io.agora.rtc.mediaio.IVideoSource.onStart | ( | ) |
Enables the video source.
This callback is triggered when the underlying media engine is ready to start video streaming. You should start the video source to capture the video frame. Once the frame is ready, use the IVideoFrameConsumer to consume the video frame.
void io.agora.rtc.mediaio.IVideoSource.onStop | ( | ) |
Stops the video source.
This callback is triggered when the media engine stops streaming. You should then stop capturing the video frame and consuming it. After this method, the video frames will be discarded by engine.
void io.agora.rtc.mediaio.IVideoSource.onDispose | ( | ) |
Releases the video source.
This callback is triggered when the IVideoFrameConsumer is released by the media engine. You can now release the video source as well as the IVideoFrameConsumer.
int io.agora.rtc.mediaio.IVideoSource.getBufferType | ( | ) |
Gets the buffer type.
This callback gets the buffer type of the video frame when it is being initialized. You need to specify one buffer type and then pass it to the media engine.