subscribeStreamAudio method
@detail api
@valid since 3.60. Since version 3.60, this interface replaces the subscribeStream:mediaStreamType: and unsubscribeStream:mediaStreamType: 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 specific remote audio streams captured by the local microphone.
@param streamId The ID of the target remote audio stream.
@param subscribe Whether to subscribe to the audio stream.
- true: Subscribe.
- false: Unsubscribe.
@return API call result:
- 0: Success.
- <0: Failure. See ByteRTCReturnStatus{@link #ByteRTCReturnStatus} for specific reasons.
@note
- Calling this API to update the subscribe configuration when the user has subscribed the remote user either by calling this API or by auto-subscribe.
- You must first get the remote stream information through rtcRoom:onUserPublishStreamAudio:info:isPublish:{@link #ByteRTCRoomDelegate#rtcRoom:onUserPublishStreamAudio:info:isPublish} before calling this API to subscribe to streams accordingly.
- After calling this API, you will be informed of the calling result with rtcRoom:onAudioSubscribeStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onAudioSubscribeStateChanged:info:state:reason}.
- Once the local user subscribes to the stream of a remote user, the subscription to the remote user will sustain until the local user leaves the room or unsubscribe from it by calling subscribeStreamAudio:subscribe:{@link #ByteRTCRoom#subscribeStreamAudio:subscribe}.
- Any other exceptions will be included in rtcRoom:onAudioSubscribeStateChanged:info:state:reason:{@link #ByteRTCRoomDelegate#rtcRoom:onAudioSubscribeStateChanged:info:state:reason}.
Implementation
FutureOr<int> subscribeStreamAudio(NSString streamId, BOOL subscribe) async {
return await nativeCall(
'subscribeStreamAudio:subscribe:', [streamId, subscribe]);
}