startRemoteView abstract method
- String userId,
- TRTCVideoStreamType streamType,
- int viewId
Subscribe to remote user's video stream and bind video rendering control
Calling this API allows the SDK to pull the video stream of the specified userId
and render it to the rendering control specified by the view
parameter.
You can set the display mode of the video image through setRemoteRenderParams.
-
If you already know the
userId
of a user who has a video stream in the room, you can directly call startRemoteView to subscribe to the user's video image. -
If you don't know which users in the room are publishing video streams, you can wait for the notification from TRTCCloudListener.onUserVideoAvailable after enterRoom.
Calling this API only starts pulling the video stream, and the image needs to be loaded and buffered at this time. After the buffering is completed, you will receive a notification from TRTCCloudListener.onFirstVideoFrame.
Parameters:
- streamType(TRTCVideoStreamType):
- Video stream type of the
userId
specified for watching:- HD big image: TRTCVideoStreamType.big
- Smooth small image: TRTCVideoStreamType.small (the remote user should enable dual-channel encoding through enableSmallVideoStream for this parameter to take effect)
- Substream image (usually used for screen sharing): TRTCVideoStreamType.sub
- Video stream type of the
- userId(String):
- ID of the specified remote user.
- viewId(int):
- Rendering control that carries the video image.
Note
The following requires your attention:
The SDK supports watching the big image and substream image or small image and substream image of a
userId
at the same time, but does not support watching the big image and small image at the same time.Only when the specified
userId
enables dual-channel encoding through enableSmallVideoStream can the user's small image be viewed.If the small image of the specified
userId
does not exist, the SDK will switch to the big image of the user by default.
Implementation
void startRemoteView(String userId, TRTCVideoStreamType streamType, int viewId);