subscribeWTNVideoStream method
@detail api
@valid since 3.60. Since version 3.60, this interface replaces the startPlayPublicStream: and stopPlayPublicStream: methods for subscribing to and unsubscribing from WTN video streams. If you are using these methods, please migrate to this interface.
@author hanchenchen
@brief Subscribe/ unsubscribe WTN video stream
A user can call this method to subscribe or unsubscribe a WTN stream whether he/she has joined the room or not.
@param streamId ID of the WTN stream. If the stream has not been published then, the local client will receive the WTN stream once it starts publishing.
@param subscribe Whether to subscribe to the WTN stream.
- true: Subscribe
- false: Unsubscribe
@return
- 0: Success. You will also be informed by onWTNAudioSubscribeStateChanged:state:reason:{@link #ByteRTCWTNStreamDelegate#onWTNAudioSubscribeStateChanged:state:reason}.
- !0: Failure because of invalid parameter or empty parameters.
@note
A client can play up to 5 WTN streams simultaneously. Please call subscribeWTNVideoStream:subscribe:{@link #ByteRTCWTNStream#subscribeWTNVideoStream:subscribe}/subscribeWTNAudioStream:subscribe:{@link #ByteRTCWTNStream#subscribeWTNAudioStream:subscribe} in time to cancel the subscription to WTN streams to avoid exceeding the limit of subscribed WTN streams.
- We recommend you bind a view for the WTN stream before calling this API.
- Internal renderer: By calling setWTNRemoteVideoCanvas:withCanvas:{@link #ByteRTCWTNStream#setWTNRemoteVideoCanvas:withCanvas}.
- Custom renderer: By calling setWTNRemoteVideoSink:withSink:withConfig:{@link #ByteRTCWTNStream#setWTNRemoteVideoSink:withSink:withConfig}.
- After calling this API, the local user will be informed once the first frame has been decoded successfully by onWTNFirstRemoteVideoFrameDecoded:withFrameInfo:{@link #ByteRTCWTNStreamDelegate#onWTNFirstRemoteVideoFrameDecoded:withFrameInfo}.
- If the WTN stream contains SEI information, the local user will be informed by onWTNSEIMessageReceived:andChannelId:andMessage:{@link #ByteRTCWTNStreamDelegate#onWTNSEIMessageReceived:andChannelId:andMessage}.
Implementation
FutureOr<int> subscribeWTNVideoStream(
NSString streamId, bool subscribe) async {
return await nativeCall(
'subscribeWTNVideoStream:subscribe:', [streamId, subscribe]);
}