diff --git a/bricks/audio.js b/bricks/audio.js index e7bfc7a..5e5a0e1 100755 --- a/bricks/audio.js +++ b/bricks/audio.js @@ -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,7 +103,8 @@ bricks.AudioRecorder = class oops extends bricks.HBox { // document.querySelector(".recpowerx").style.width=powerLevel+"%"; //可视化图形绘制 // wave.input(buffers[buffers.length-1],powerLevel,bufferSampleRate); - this.rec_time.set_text(' ' + formatMs(bufferDuration,1)); + if (this.status == 'recording') + this.rec_time.set_text(' ' + formatMs(bufferDuration,1)); } recOpen(){ @@ -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 = {