subscribeStreamVideo method

Future<int?> subscribeStreamVideo({
  1. required string streamId,
  2. required bool subscribe,
})

@detail api @valid since 3.60. Since version 3.60, this interface replaces the subscribeStream, unsubscribeStream, subscribeScreen and unsubscribeScreen methods for the below functions. If you have upgraded to version 3.60 or later and are still using these methods, please migrate to this interface. @brief Subscribes to or unsubscribes from the specific remote video streams captured by the camera. @param streamId The ID of the target remote video stream. @param subscribe Whether to subscribe to the video stream.
- true: Subscribe. - false: Unsubscribe. @return - 0: Success. - < 0 : Fail. See ReturnStatus{@link #ReturnStatus} for more details. @note - If you have already subscribed to the remote stream (manually or automatically) when you call this method, the subscription configuration will be updated based on the parameters passed in this call. - You must call onUserPublishStreamVideo{@link #IRTCRoomEventHandler#onUserPublishStreamVideo} callback to get the current remote camera stream information in the room, and then call this method to subscribe to the remote media streams. - After you call this method, you will receive onVideoSubscribeStateChanged{@link #IRTCRoomEventHandler#onVideoSubscribeStateChanged} notification method call results. - After you successfully subscribe to the remote video stream, the subscription relationship will continue until you call subscribeStreamVideo{@link #RTCRoom#subscribeStreamVideo} to unsubscribe from it or the local user leaves the room. - Any other exceptions will be included in onVideoSubscribeStateChanged{@link #IRTCRoomEventHandler#onVideoSubscribeStateChanged} callback notification.

Implementation

Future<int?> subscribeStreamVideo(
    {required string streamId, required bool subscribe}) async {
  $a() =>
      ($instance as $p_a.RTCRoom).subscribeStreamVideo(streamId, subscribe);
  $i() => ($instance as $p_i.ByteRTCRoom)
      .subscribeStreamVideo(streamId, subscribe);

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