setVolume method

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

@detail api @brief Adjusts the volume level of a specified audio effect, including audio effect file and PCM effect. @param effectId Audio effect ID @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]. @return - 0: Success. - < 0 : Fail. See ReturnStatus{@link #ReturnStatus} for more details. @note Call this API after 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}');
  }
}