publishStreamAudio method
@detail api
@valid since 3.60. Since version 3.60, this interface replaces the publishStream and unpublishStream 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 media streams captured by the local microphone in the current room.
@param publish Whether to publish the media stream.
- true: Publish.
- false: Stop publishing.
@return
- 0: Success.
- < 0 : Fail. See ByteRTCReturnStatus{@link #ByteRTCReturnStatus} for more details
@note
- You don't need to call this API if you set it to Auto-publish when calling joinRoom:userInfo:userVisibility:roomConfig:{@link #ByteRTCRoom#joinRoom:userInfo:userVisibility:roomConfig}.
- An invisible user cannot publish media streams. Call setUserVisibility:{@link #ByteRTCRoom#setUserVisibility} to change your visibility in the room.
- Call publishStreamVideo:{@link #ByteRTCRoom#publishStreamVideo} to start or stop publishing the video stream captured by the camera.
- Call startForwardStreamToRooms:{@link #ByteRTCRoom#startForwardStreamToRooms} to forward the published streams to the other rooms.
- After you call this API, the other users in the room will receive rtcRoom:onUserPublishStreamAudio:info:isPublish:{@link #ByteRTCRoomDelegate#rtcRoom:onUserPublishStreamAudio:info:isPublish}. Those who successfully received your streams will receive rtcEngine:onFirstRemoteAudioFrame:info:{@link #ByteRTCEngineDelegate#rtcEngine:onFirstRemoteAudioFrame:info} at the same time.
Implementation
FutureOr<int> publishStreamAudio(BOOL publish) async {
return await nativeCall('publishStreamAudio:', [publish]);
}