subscribeWTNVideoStream method

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

@detail api @valid since 3.60. 自 3.60 起,此接口替代了 startPlayPublicStreamstopPlayPublicStream 方法来订阅/取消订阅指定 WTN 视频流,如果你使用了这两个方法,请迁移至此接口。 @author hanchenchen @brief 订阅/取消订阅指定 WTN 视频流
无论用户是否在房间内,都可以调用本接口订阅/取消订阅指定的 WTN 视频流。 @param streamId WTN 流 ID,如果指定流暂未发布,则本地客户端将在其开始发布后接收到流数据。 @param subscribe 是否订阅 WTN 流
- true:订阅 - false:取消订阅 @return - 0: 成功。同时将收到 onWTNVideoSubscribeStateChanged{@link #IWTNStreamEventHandler#onWTNVideoSubscribeStateChanged} 回调。 - !0: 失败。当参数不合法或参数为空,调用失败。 @note - 一个客户端最多同时播放 5 路 WTN 流,请及时调用 subscribeWTNVideoStream{@link #IWTNStream#subscribeWTNVideoStream}/subscribeWTNAudioStream{@link #IWTNStream#subscribeWTNAudioStream} 取消订阅 WTN 流,避免订阅的 WTN 流数量超限。 - 在调用本接口之前,建议先绑定渲染视图。 - 调用 setWTNRemoteVideoCanvas{@link #IWTNStream#setWTNRemoteVideoCanvas} 绑定内部渲染视图 - 调用 setWTNRemoteVideoSink{@link #IWTNStream#setWTNRemoteVideoSink} 绑定自定义渲染视图 - 调用本接口后,可以通过 onWTNFirstRemoteVideoFrameDecoded{@link #IWTNStreamEventHandler#onWTNFirstRemoteVideoFrameDecoded} 回调 WTN 视频流的首帧解码情况。 - 调用本接口后,可以通过 onWTNSEIMessageReceived{@link #IWTNStreamEventHandler#onWTNSEIMessageReceived} 回调 WTN 流中包含的 SEI 信息。 @order 0

Implementation

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

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