publishStreamAudio 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 audio streams in the current room.
@param publish Whether to publish the audio 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 publishStreamVideo{@link #RTCRoom#publishStreamVideo} to start or stop publishing the video stream captured by the camera.
- 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 onUserPublishStreamAudio{@link #IRTCRoomEventHandler#onUserPublishStreamAudio}. Those who successfully received your streams will receive onFirstRemoteAudioFrame{@link #IRTCEngineEventHandler#onFirstRemoteAudioFrame} at the same time.
Implementation
Future<int?> publishStreamAudio(bool publish) async {
$a() => ($instance as $p_a.RTCRoom).publishStreamAudio(publish);
$i() => ($instance as $p_i.ByteRTCRoom).publishStreamAudio(publish);
if (Platform.isAndroid) {
return $a();
} else if (Platform.isIOS) {
return $i();
} else {
throw UnsupportedError(
'Not Support Platform ${Platform.operatingSystem}');
}
}