HarmonyOS 怎么获取当前录音的音量?

代码:

// 开始录制对应的流程
async startRecordingProcess() {
  if (this.avRecorder != undefined) {
    await this.avRecorder.release();
    this.avRecorder = undefined;
  }
  // 1.创建录制实例
  this.avRecorder = await media.createAVRecorder();
  this.setAudioRecorderCallback();
  // 2.获取录制文件fd赋予avConfig里的url;参考FilePicker文档
  this.avConfig = this.createNewAudioFile()
  // 3.配置录制参数完成准备工作
  await this.avRecorder.prepare(this.avConfig.config);
  // 4.开始录制
  await this.avRecorder.start();
}
阅读 573
1 个回答

但是AVRecorder不可以监听收到音频的音量大小,如果想获取音量的大小,只能使用AudioCapturer。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进