publishStreamVideo method
@detail api
@valid since 3.60. Since version 3.60, this interface replaces the publishStream, unpublishStream, publishScreen and unpublishScreen methods for the following functions. If you have upgraded to version 3.60 or above and are still using these two methods, please migrate to this interface.
@brief Publishes or stops publishing video streams.
@param publish Whether to publish the video stream.
- true: Publish.
- false: Stop publishing.
@return
- 0: Success.
- < 0 : Fail. See ReturnStatus{@link #ReturnStatus} for more details
@note
- You don't need to call this API if you set it to Auto-publish when calling joinRoom{@link #RTCRoom#joinRoom}.
- An invisible user cannot publish media streams. Call setUserVisibility{@link #RTCRoom#setUserVisibility} to change your visibility in the room.
- Call publishStreamAudio{@link #RTCRoom#publishStreamAudio} to start or stop publishing the audio stream captured by the microphone.
- Call startForwardStreamToRooms{@link #RTCRoom#startForwardStreamToRooms} to forward the published streams to the other rooms.
- After you call this API, the other users in the room will receive onUserPublishStreamVideo{@link #IRTCRoomEventHandler#onUserPublishStreamVideo}. Those who successfully received your streams will receive onFirstRemoteVideoFrameDecoded{@link #IRTCEngineEventHandler#onFirstRemoteVideoFrameDecoded} at the same time.
Implementation
Future<int?> publishStreamVideo(bool publish) async {
$a() => ($instance as $p_a.RTCRoom).publishStreamVideo(publish);
$i() => ($instance as $p_i.ByteRTCRoom).publishStreamVideo(publish);
if (Platform.isAndroid) {
return $a();
} else if (Platform.isIOS) {
return $i();
} else {
throw UnsupportedError(
'Not Support Platform ${Platform.operatingSystem}');
}
}