This commit is contained in:
yumoqing 2024-03-20 16:01:36 +08:00
parent 517b8f0d4d
commit de18092ab8

View File

@ -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);