setMultiDeviceAVSync method
@detail api
@author wangzhanqiang
@brief Synchronizes published audio and video.
When the same user simultaneously uses separate devices to capture and publish audio and video, there is a possibility that the streams are out of sync due to the network disparity. In this case, you can call this API on the video publisher side and the SDK will automatically line the video stream up according to the timestamp of the audio stream, ensuring that the audio the receiver hears corresponds to the video the receiver watches.
@param audioUserId The ID of audio publisher. You can stop the current A/V synchronization by setting this parameter to null.
@return
- 0: Success. When the A/V synchronization state changes, you will receive rtcRoom:onAVSyncStateChange:{@link #ByteRTCRoomDelegate#rtcRoom:onAVSyncStateChange}.
- < 0 : Fail. Learn more details via rtcRoom:onAVSyncEvent:userId:eventCode:{@link #ByteRTCRoomDelegate#rtcRoom:onAVSyncEvent:userId:eventCode}. More than one pair of audio and video can be synchronized simultaneously in the same RTC room, but you should note that one single audio source cannot be synchronized with multiple video sources at the same time.
@note
- You can call this API anytime before or after entering the room.
- The source user IDs of the audio and video stream to be synchronized must be in the same RTC room.
- If you want to change the audio source, call this API again with a new audioUserId. If you want to change the video source, you need to stop the current synchronization first, then call this API on the new video publisher side.
Implementation
FutureOr<int> setMultiDeviceAVSync(NSString audioUserId) async {
return await nativeCall('setMultiDeviceAVSync:', [audioUserId]);
}