onFirstVideoFrame property

(void Function(String userId, TRTCVideoStreamType streamType, int width, int height)?) onFirstVideoFrame
final

The SDK Started Rendering the First Video Frame of the Local or a Remote User

The SDK returns this event callback when it starts rendering your first video frame or that of a remote user. The userId in the callback can help you determine whether the frame is yours or a remote user’s.

  • If userId is empty, it indicates that the SDK has started rendering your first video frame. The precondition is that you have called startLocalPreview or startScreenCapture.

  • If userId is not empty, it indicates that the SDK has started rendering the first video frame of a remote user. The precondition is that you have called startRemoteView to subscribe to the user’s video.

  • Parameters:

    • height(int):
      • Video height.
    • streamType(TRTCVideoStreamType):
      • Video stream type. The primary stream (Main) is usually used for camera images, and the substream (Sub) for screen sharing images.
    • userId(String):
      • The user ID of the local or a remote user. If it is empty, it indicates that the first local video frame is available; if it is not empty, it indicates that the first video frame of a remote user is available.
    • width(int):
      • Video width.

Note

  1. The callback of the first local video frame being rendered is triggered only after you call startLocalPreview or startScreenCapture.

  2. The callback of the first video frame of a remote user being rendered is triggered only after you call startRemoteView or startRemoteSubStreamView.

Implementation

final void Function(String userId, TRTCVideoStreamType streamType, int width, int height)? onFirstVideoFrame;