This commit is contained in:
yumoqing 2024-03-19 16:35:06 +08:00
parent 1793498b3f
commit 1d9228342b
3 changed files with 3 additions and 9 deletions

View File

@ -76,7 +76,6 @@ bricks.AudioRecorder = class oops extends bricks.HBox {
this.URL = window.URL||webkitURL; this.URL = window.URL||webkitURL;
this.rec = null; this.rec = null;
this.wave = null; this.wave = null;
this.status = null;
this.mic_opened = false; this.mic_opened = false;
this.add_widget(this.rec_btn); this.add_widget(this.rec_btn);
this.add_widget(this.rec_time); this.add_widget(this.rec_time);
@ -89,11 +88,9 @@ bricks.AudioRecorder = class oops extends bricks.HBox {
if(this.rec_btn.url == this.start_icon){ if(this.rec_btn.url == this.start_icon){
this.rec_btn.set_url(this.stop_icon); this.rec_btn.set_url(this.stop_icon);
this.start_recording(); this.start_recording();
this.status = 'recording';
} else { } else {
this.rec_btn.set_url(this.start_icon); this.rec_btn.set_url(this.start_icon);
this.stop_recording(); this.stop_recording();
this.status = 'stoped';
} }
} }
on_process(buffers,powerLevel, on_process(buffers,powerLevel,
@ -103,8 +100,7 @@ bricks.AudioRecorder = class oops extends bricks.HBox {
// document.querySelector(".recpowerx").style.width=powerLevel+"%"; // document.querySelector(".recpowerx").style.width=powerLevel+"%";
//可视化图形绘制 //可视化图形绘制
// wave.input(buffers[buffers.length-1],powerLevel,bufferSampleRate); // wave.input(buffers[buffers.length-1],powerLevel,bufferSampleRate);
if (this.status == 'recording') this.rec_time.set_text(' ' + formatMs(bufferDuration,1));
this.rec_time.set_text(' ' + formatMs(bufferDuration,1));
} }
recOpen(){ recOpen(){
@ -165,7 +161,7 @@ bricks.AudioRecorder = class oops extends bricks.HBox {
bricks.debug("5JuL::未打开录音"); bricks.debug("5JuL::未打开录音");
return; return;
}; };
this.pause_recording(); // this.pause_recording();
this.rec.stop(function(blob,duration){ this.rec.stop(function(blob,duration){
var localURL = this.URL.createObjectURL(blob); var localURL = this.URL.createObjectURL(blob);
var d = { var d = {
@ -180,6 +176,7 @@ bricks.AudioRecorder = class oops extends bricks.HBox {
}.bind(this),function(msg){ }.bind(this),function(msg){
bricks.debug("kGZO::录音失败:"); bricks.debug("kGZO::录音失败:");
}); });
this.recClose();
} }
upload = async function(){ upload = async function(){
if(!this.recordData){ if(!this.recordData){

View File

@ -28,12 +28,10 @@ bricks.Conform = class extends bricks.BMessage {
this.message_w.add_widget(w); this.message_w.add_widget(w);
} }
conform_hndl(event){ conform_hndl(event){
console.log(' --- conform event handling ...');
this.dismiss(); this.dismiss();
this.dispatch('conform'); this.dispatch('conform');
} }
discard_hndl(event){ discard_hndl(event){
console.log(' --- discard event handling ...');
this.dismiss(); this.dismiss();
} }
} }

View File

@ -56,7 +56,6 @@ bricks.IconBar = class extends bricks.HBox {
return w; return w;
} }
regen_event(desc, event){ regen_event(desc, event){
console.log('regen_event desc=', desc);
this.dispatch(desc.name, desc); this.dispatch(desc.name, desc);
this.dispatch('command', desc); this.dispatch('command', desc);
event.stopPropagation(); event.stopPropagation();