diff --git a/bricks/audio.js b/bricks/audio.js index 479f672..95fea49 100755 --- a/bricks/audio.js +++ b/bricks/audio.js @@ -230,5 +230,31 @@ bricks.AudioRecorder = class extends bricks.HBox { } } +bricks.SttClinet = class extends bricks.VBox { + /* + { + "upload_url" + } + */ + constructor(opts){ + super(opts); + this.recorder = new bricks.AudioRecorder({ + icon_rate:2, + upload_url:opts.upload_url, + upload_resp:'json' + }); + this.add_widget(this.recorder); + this.result_text = new bricks.Text({ + text:'', + dynsize:true + }); + this.add_widget(this.result_text); + this.recorder.bind('uploaded', this.set_result_text.bind(this)); + } + set_result_text(event){ + var txt = event.params.text; + this.ressult_text.set_text(txt); + } +} bricks.Factory.register('AudioPlayer', bricks.AudioPlayer); bricks.Factory.register('AudioRecorder', bricks.AudioRecorder);