RegisterVideoFrameObserver

Registers a raw video frame observer object.

Details

If you want to observe raw video frames (such as YUV or RGBA format), Agora recommends that you implement one IVideoFrameObserver class with this method.

When calling this method to register a video observer, you can register callbacks in the IVideoFrameObserver class as needed. After you successfully register the video frame observer, the SDK triggers the registered callbacks each time a video frame is received.

If you want to obtain the original video data of some remote users (referred to as group A) and the encoded video data of other remote users (referred to as group B), you can refer to the following steps:
  1. Call RegisterVideoFrameObserver to register the raw video frame observer before joining the channel.
  2. Call RegisterVideoEncodedFrameObserver to register the encoded video frame observer before joining the channel.
  3. After joining the channel, get the user IDs of group B users through FOnUserJoined, and then call SetRemoteVideoSubscriptionOptions to set the encodedFrameOnly of this group of users to true.
  4. Call MuteAllRemoteVideoStreams(false)to start receiving the video streams of all remote users. Then:
    • The raw video data of group A users can be obtained through the callback in IVideoFrameObserver, and the SDK renders the data by default.
    • The encoded video data of group B users can be obtained through the callback in IVideoEncodedFrameObserver.
Attention:
  • Ensure that you call this method before joining a channel.
  • When handling the video data returned in the callbacks, pay attention to the changes in the width and height parameters, which may be adapted under the following circumstances:
    • When network conditions deteriorate, the video resolution decreases incrementally.
    • If the user adjusts the video profile, the resolution of the video returned in the callbacks also changes.

Parameters

observer
The observer instance. See IVideoFrameObserver. To release the instance, set the value as NULL.

Returns

  • 0: Success.
  • < 0: Failure.