setMultiDeviceAVSync abstract method
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.
Pass in the user ID of the audio publisher via audioUid
.
You can stop the current A/V synchronization by setting this parameter to null.
Return value:
0
: Success.<0
: Failure. See ReturnStatus for the reason.
Notes:
- You can call this API whether the user is in a room or not.
- The source user IDs of the audio and video stream to be synchronized must be in the same RTC room.
- When the A/V synchronization state changes, you will receive RTCRoomEventHandler.onAVSyncStateChange.
- 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.
- If you want to change the audio source, call this API again with a new
audioUid
. 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
Future<int?> setMultiDeviceAVSync(String audioUid);