startForwardStreamToRooms method
@detail api
@author shenpengliang
@brief Start relaying media stream across rooms.
After calling joinRoom{@link #RTCRoom#joinRoom}, you can call this method to publish the media stream to multiple rooms that applies to scenarios such as an online talent contest and so on.
@param forwardStreamInfos Information of the rooms where you want to relay the media stream to. Refer to ForwardStreamInfo{@link #ForwardStreamInfo} for more information.
@return
- 0: Success.
- < 0: Failure. See ReturnStatus{@link #ReturnStatus} for more details.
@note
- Call this method will trigger onForwardStreamStateChanged{@link #IRTCRoomEventHandler#onForwardStreamStateChanged}.
- After calling this method, listen the events from each room during the relaying by registering onForwardStreamEvent{@link #IRTCRoomEventHandler#onForwardStreamEvent}.
- Once the relaying begins, the other users in the room will receive callback of onUserJoined{@link #IRTCRoomEventHandler#onUserJoined}, onUserPublishStreamVideo{@link #IRTCRoomEventHandler#onUserPublishStreamVideo}, onUserPublishStreamAudio{@link #IRTCRoomEventHandler#onUserPublishStreamAudio}.
- Call updateForwardStreamToRooms{@link #RTCRoom#updateForwardStreamToRooms} to add or remove the designated room(s) after calling this method.
- Call stopForwardStreamToRooms{@link #RTCRoom#stopForwardStreamToRooms} to stop relaying to all rooms after calling this method.
- Call pauseForwardStreamToAllRooms{@link #RTCRoom#pauseForwardStreamToAllRooms} to pause relaying to all rooms after calling this method.
Implementation
Future<int?> startForwardStreamToRooms(
List<ForwardStreamInfo> forwardStreamInfos) async {
$a() =>
($instance as $p_a.RTCRoom).startForwardStreamToRooms(forwardStreamInfos
.map(($item) => unpackObject<$p_a.ForwardStreamInfo>($item))
.toList());
$i() => ($instance as $p_i.ByteRTCRoom).startForwardStreamToRooms(
forwardStreamInfos
.map(($item) =>
unpackObject<$p_i.ByteRTCForwardStreamConfiguration>($item))
.toList());
if (Platform.isAndroid) {
return $a();
} else if (Platform.isIOS) {
return $i();
} else {
throw UnsupportedError(
'Not Support Platform ${Platform.operatingSystem}');
}
}