This commit is contained in:
yumoqing 2025-09-29 18:26:42 +08:00
parent 9c8b5935fe
commit 19465f85e8

View File

@ -16,7 +16,7 @@ bricks.MediaRecorder = class extends bricks.Popup {
tip: 'start or stop record', tip: 'start or stop record',
rate: 2 rate: 2
}); });
this.timepass = new bricks.Text({text:'', cheight: 10}); this.timepass = new bricks.Text({text:'00:00:00', cheight: 10});
var filler = new bricks.Filler({}); var filler = new bricks.Filler({});
var cancel = new bricks.Svg({ var cancel = new bricks.Svg({
url: bricks_resource('imgs/delete.svg'), url: bricks_resource('imgs/delete.svg'),
@ -38,11 +38,11 @@ bricks.MediaRecorder = class extends bricks.Popup {
console.log('toggle_record called'); console.log('toggle_record called');
if (this.record_status == 'standby'){ if (this.record_status == 'standby'){
this.start_recorder(); this.start_recorder();
this.toggle_record.url = bricks_resource('imgs/stop_recording.svg'); this.toggle_record.set_url(bricks_resource('imgs/stop_recording.svg'));
this.record_status = 'recording'; this.record_status = 'recording';
} else { } else {
this.stop_recorder(); this.stop_recorder();
this.toggle_record.url = bricks_resource('imgs/start_recording.svg'); this.toggle_record.set_url(bricks_resource('imgs/start_recording.svg'));
this.record_status = 'standby'; this.record_status = 'standby';
} }
} }
@ -86,8 +86,8 @@ bricks.MediaRecorder = class extends bricks.Popup {
stop_recorder(){ stop_recorder(){
this.normal_stop = true; this.normal_stop = true;
this.time_diff = bricks.timeDiff(this.start_time); this.time_diff = bricks.timeDiff(this.start_time);
this.mediaRecorder.stop();
this.timepass.set_text(this.time_diff); this.timepass.set_text(this.time_diff);
this.mediaRecorder.stop();
this.mediaRecorder = null; this.mediaRecorder = null;
this.close_recorder(); this.close_recorder();
console.log("Recording stopped."); console.log("Recording stopped.");