subscribeWTNAudioStream method

Future<int?> subscribeWTNAudioStream(
  1. string streamId,
  2. bool subscribe
)

@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. @author hanchenchen @brief Subscribe/unsubscribe the 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 onWTNAudioSubscribeStateChanged{@link #IWTNStreamEventHandler#onWTNAudioSubscribeStateChanged}. - !0: Failure because of invalid parameter or empty parameters. @note - A client can play up to 5 WTN streams simultaneously. Please call subscribeWTNVideoStream{@link #IWTNStream#subscribeWTNVideoStream}/subscribeWTNAudioStream{@link #IWTNStream#subscribeWTNAudioStream} 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{@link #IWTNStream#setWTNRemoteVideoCanvas} or - Custom renderer: By calling setWTNRemoteVideoSink{@link #IWTNStream#setWTNRemoteVideoSink} - After calling this API, you will be informed once the first frame has been decoded successfully by onWTNFirstRemoteAudioFrame{@link #IWTNStreamEventHandler#onWTNFirstRemoteAudioFrame}. - If the WTN stream contains SEI information, you will be informed by onWTNSEIMessageReceived{@link #IWTNStreamEventHandler#onWTNSEIMessageReceived}. @order 1

Implementation

Future<int?> subscribeWTNAudioStream(string streamId, bool subscribe) async {
  $a() => ($instance as $p_a.IWTNStream)
      .subscribeWTNAudioStream(streamId, subscribe);
  $i() => ($instance as $p_i.ByteRTCWTNStream)
      .subscribeWTNAudioStream(streamId, subscribe);

  if (Platform.isAndroid) {
    return $a();
  } else if (Platform.isIOS) {
    return $i();
  } else {
    throw UnsupportedError(
        'Not Support Platform ${Platform.operatingSystem}');
  }
}