参考代码:
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
}
目前没有这个能力,可以尝试自行实现录制的时候才开闪光灯的,通过setFlashMode只有常亮模式,录像只有常亮。