setVolume method

Future<int?> setVolume(
  1. int effectId,
  2. int volume
)

@detail api @brief 调节指定音效的音量大小,包括音效文件和 PCM 音频。 @param effectId 音效 ID @param volume 播放音量相对原音量的比值。单位为 %。范围为 [0, 400],建议范围是 [0, 100]。带溢出保护。 @return - 0: 调用成功。 - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 @note 仅在调用 start{@link #IAudioEffectPlayer#start} 后调用此接口。

Implementation

Future<int?> setVolume(int effectId, int volume) async {
  $a() => ($instance as $p_a.IAudioEffectPlayer).setVolume(effectId, volume);
  $i() => ($instance as $p_i.ByteRTCAudioEffectPlayer)
      .setVolume(effectId, volume);

  if (Platform.isAndroid) {
    return $a();
  } else if (Platform.isIOS) {
    return $i();
  } else {
    throw UnsupportedError(
        'Not Support Platform ${Platform.operatingSystem}');
  }
}