setAudioAlignmentProperty method
- required string streamId,
- required AudioAlignmentMode mode,
@detail api
@hidden internal use only
@author majun.lvhiei
@brief On the listener side, set all subscribed audio streams precisely timely aligned.
@param streamId Stream ID, the remote audio stream used as the benchmark during time alignment. You are recommended to use the audio stream from the lead singer.
You must call this API after receiving onUserPublishStreamAudio{@link #IRTCRoomEventHandler#onUserPublishStreamAudio}.
@param mode Whether to enable the alignment. Disabled by default. See AudioAlignmentMode{@link #AudioAlignmentMode}.
@return
- 0: Success.
- < 0 : Fail. See ReturnStatus{@link #ReturnStatus} for more details
@note
- You must use the function when all participants set ChannelProfile{@link #ChannelProfile} to CHANNEL_PROFILE_CHORUS when joining the room.
- All remote participants must call startAudioMixing to play background music and set syncProgressToRecordFrame of AudioMixingConfigto true.
- If the subscribed audio stream is delayed too much, it may not be precisely aligned.
- The chorus participants must not enable the alignment. If you wish to change the role from listener to participant, you should disable the alignment.
Implementation
Future<int?> setAudioAlignmentProperty(
{required string streamId, required AudioAlignmentMode mode}) async {
$a() => ($instance as $p_a.RTCEngine).setAudioAlignmentProperty(
streamId, t_AudioAlignmentMode.code_to_android(mode));
$i() => ($instance as $p_i.ByteRTCEngine).setAudioAlignmentProperty(
streamId, t_AudioAlignmentMode.code_to_ios(mode));
if (Platform.isAndroid) {
return $a();
} else if (Platform.isIOS) {
return $i();
} else {
throw UnsupportedError(
'Not Support Platform ${Platform.operatingSystem}');
}
}