setPlaybackSpeed method

Future<int?> setPlaybackSpeed(
  1. int speed
)

@detail api @brief 设置播放速度 @param speed 播放速度与原始文件速度的比例,单位:%,取值范围为 [50,200],默认值为 100。 @return - 0: 调用成功。 - < 0 : 调用失败。查看 ReturnStatus{@link #ReturnStatus} 获得更多错误说明 @note - 如果在起播前调用此接口,设置的参数值将被缓存,在起播后生效。 - 此方法对音频文件可用,不支持 PCM 数据。

Implementation

Future<int?> setPlaybackSpeed(int speed) async {
  $a() => ($instance as $p_a.IMediaPlayer).setPlaybackSpeed(speed);
  $i() => ($instance as $p_i.ByteRTCMediaPlayer).setPlaybackSpeed(speed);

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