This commit is contained in:
yumoqing 2026-02-27 14:43:20 +08:00
parent a5365d5842
commit 127c00bfd3

View File

@ -244,12 +244,16 @@ bricks.SysVideoRecorder = class extends bricks.MediaRecorder {
this.fps_task = schedule_interval(this.show_picture.bind(this), this.fps_period); this.fps_task = schedule_interval(this.show_picture.bind(this), this.fps_period);
} }
async show_picture(){ async show_picture(){
var blob = await this.imageCapture.takePhoto(); try {
this.dataurl = URL.createObjectURL(blob); var blob = await this.imageCapture.takePhoto();
this.imgfile = new File([blob], this.dataurl = URL.createObjectURL(blob);
'image.jpg', this.imgfile = new File([blob],
{ type: 'image/jpeg' }); 'image.jpg',
this.imgw.set_url(this.dataurl); { type: 'image/jpeg' });
this.imgw.set_url(this.dataurl);
} catch(e){
console.error(e);
}
} }
close_recorder(){ close_recorder(){
super.close_recorder(); super.close_recorder();