VideoFrameObserver
The IVideoFrameObserver class.
You can call registerVideoFrameObserver to register or unregister an VideoFrameObserver object.
onCaptureVideoFrame
Occurs each time the SDK receives a video frame captured by local devices.
final void Function(VideoSourceType sourceType, VideoFrame videoFrame)? onCaptureVideoFrame;
You can get raw video data collected by the local device through this callback.
Applicable scenarios
- Get information about the locally collected video data before it is processed by the SDK. For example, the original width, height, frame rate of the video frame, etc.
Trigger timing
After the successful registration of the video data observer, each time the SDK captures a video frame.
Restrictions
- The video data you get here is the raw video data, that is, video data that has not undergone preprocessing such as watermarking, cropping, and rotation.
- If the video data type you get is RGBA, the SDK does not support processing the data of the alpha channel.
- Due to framework limitations, this callback does not support sending processed video data back to the SDK.
Parameters
- sourceType
- Video source types, including cameras, screens, or media player. See VideoSourceType.
- videoFrame
- The video frame. See VideoFrame.Note: The default value of the video frame data format obtained through this callback is as follows:
- Android: I420
- iOS: I420
- macOS: I420
- Windows: YUV420
onPreEncodeVideoFrame
Occurs each time the SDK receives a video frame before encoding.
final void Function(VideoFrame videoFrame)? onPreEncodeVideoFrame;
After you successfully register the video frame observer, the SDK triggers this callback each time it receives a video frame. In this callback, you can get the video data before encoding and then process the data according to your particular scenarios.
- Due to framework limitations, this callback does not support sending processed video data back to the SDK.
- The video data that this callback gets has been preprocessed, with its content cropped and rotated, and the image enhanced.
Parameters
- sourceType
-
The type of the video source. See VideoSourceType.
- videoFrame
- The video frame. See VideoFrame.Note: The default value of the video frame data format obtained through this callback is as follows:
- Android: I420
- iOS: I420
- macOS: I420
- Windows: YUV420
onRenderVideoFrame
Occurs each time the SDK receives a video frame sent by the remote user.
final void Function(String channelId, int remoteUid, VideoFrame videoFrame)? onRenderVideoFrame;
After you successfully register the video frame observer, the SDK triggers this callback each time it receives a video frame. In this callback, you can get the video data sent from the remote end before rendering, and then process it according to the particular scenarios.
- If the video data type you get is RGBA, the SDK does not support processing the data of the alpha channel.
- Due to framework limitations, this callback does not support sending processed video data back to the SDK.
Parameters
- remoteUid
- The user ID of the remote user who sends the current video frame.
- videoFrame
- The video frame. See VideoFrame.Note: The default value of the video frame data format obtained through this callback is as follows:
- Android: I420
- iOS: I420
- macOS: I420
- Windows: YUV420
- channelId
- The channel ID.