HarmonyOS 录像设置闪光灯没有反应?

参考代码:

async startVideo(): Promise<void> {
  if (!this.videoOutput || !this.avRecorder) {
    return
  }
// 不生效,手动调试过是支持闪光灯模式的,这里直接设置
  this.videoSession?.setFlashMode(camera.FlashMode.FLASH_MODE_OPEN);
  this.videoOutput.start(async (err: BusinessError) => {
    if (err) {
      console.error(`start Failed to start the video output ${err.message}`);
      return;
    }
    console.error('start Callback invoked to indicate the video output start success.');
  });
  try {
    await this.avRecorder.start();
  } catch (error) {
    let err = error as BusinessError;
    console.error(`start avRecorder start error: ${JSON.stringify(err)}`);
  }
    this.hasStartRecord.state = true
}
阅读 416
1 个回答

目前没有这个能力,可以尝试自行实现录制的时候才开闪光灯的,通过setFlashMode只有常亮模式,录像只有常亮。

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