subscribeWTNAudioStream method

FutureOr<int> subscribeWTNAudioStream(
  1. NSString streamId,
  2. bool subscribe
)

@author hanchenchen @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 audio streams. If you are using these methods, please migrate to this interface. @brief Subscribes to/unsubscribes from the specified WTN audio stream.
A user can call this method to subscribe 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 onWTNVideoSubscribeStateChanged:state:reason:{@link #ByteRTCWTNStreamDelegate#onWTNVideoSubscribeStateChanged: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 to bind a view for the WTN stream before calling this API to subscribe a WTN stream. - Internal renderer: By calling setWTNRemoteVideoCanvas:withCanvas:{@link #ByteRTCWTNStream#setWTNRemoteVideoCanvas:withCanvas} or - Custom renderer: By calling setWTNRemoteVideoSink:withSink:withConfig:{@link #ByteRTCWTNStream#setWTNRemoteVideoSink:withSink:withConfig} - After calling this API, you will be informed once the first frame has been decoded successfully by onWTNFirstRemoteAudioFrame:{@link #ByteRTCWTNStreamDelegate#onWTNFirstRemoteAudioFrame}. - If the WTN stream contains SEI information, you will be informed by onWTNSEIMessageReceived:andChannelId:andMessage:{@link #ByteRTCWTNStreamDelegate#onWTNSEIMessageReceived:andChannelId:andMessage}. @order 1

Implementation

FutureOr<int> subscribeWTNAudioStream(
    NSString streamId, bool subscribe) async {
  return await nativeCall(
      'subscribeWTNAudioStream:subscribe:', [streamId, subscribe]);
}