This commit is contained in:
yumoqing 2025-09-29 21:11:57 +08:00
parent 7f8b1903c2
commit 5872713075

View File

@ -162,10 +162,7 @@ bricks.SysVideoRecorder = class extends bricks.MediaRecorder {
this.imgw = new bricks.Image({width: '100%'}); this.imgw = new bricks.Image({width: '100%'});
this.preview.add_widget(this.imgw); this.preview.add_widget(this.imgw);
this.toggle_record.disabled(false); this.toggle_record.disabled(false);
} this.pic_task = schedule_once(this.show_picture.bind(this), this.task_period);
tick_task(){
super.tick_task();
this.show_picture();
} }
async show_picture(){ async show_picture(){
if (this.task_period == 0){ if (this.task_period == 0){
@ -174,9 +171,16 @@ bricks.SysVideoRecorder = class extends bricks.MediaRecorder {
const blob = await this.imageCapture.takePhoto(); const blob = await this.imageCapture.takePhoto();
this.dataurl = URL.createObjectURL(blob); this.dataurl = URL.createObjectURL(blob);
this.imgw.set_url(this.dataurl); this.imgw.set_url(this.dataurl);
this.task = schedule_once(this.show_picture.bind(this), this.pic_task = schedule_once(this.show_picture.bind(this),
this.task_period); this.task_period);
} }
close_recorder(){
super.close_recorder();
if (this.pic_task){
this.pic_task.cancel();
this.pic_task = null;
}
}
} }
bricks.SysCamera= class extends bricks.SysVideoRecorder { bricks.SysCamera= class extends bricks.SysVideoRecorder {
switch_record(){ switch_record(){