setVolume method
@detail api
@brief Adjusts the volume of the specified audio mixing, including media file mixing and PCM mixing.
@param volume The ratio of the volume to the original volume in % with overflow protection. The range is [0, 400] and the recommended range is [0, 100].
@param type See AudioMixingType{@link #AudioMixingType}.
@return
- 0: Success.
- < 0 : Fail. See ReturnStatus{@link #ReturnStatus} for more details.
@note Call this API only when audio is mixing.
Implementation
Future<int?> setVolume(int volume, AudioMixingType type) async {
$a() => ($instance as $p_a.IMediaPlayer)
.setVolume(volume, t_AudioMixingType.code_to_android(type));
$i() => ($instance as $p_i.ByteRTCMediaPlayer)
.setVolume(volume, t_AudioMixingType.code_to_ios(type));
if (Platform.isAndroid) {
return $a();
} else if (Platform.isIOS) {
return $i();
} else {
throw UnsupportedError(
'Not Support Platform ${Platform.operatingSystem}');
}
}