This commit is contained in:
yumoqing 2024-03-19 15:07:17 +08:00
parent da18bb96d8
commit 6e2514a57d

View File

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