This commit is contained in:
yumoqing 2024-03-20 16:07:45 +08:00
parent de18092ab8
commit 4a924f91c9

View File

@ -59,7 +59,6 @@ bricks.AudioRecorder = class extends bricks.HBox {
{ {
"upload_url": "upload_url":
"icon_rate": "icon_rate":
"upload_resp":"text", or "json", or "bin"
} }
we need this module: we need this module:
https://gitee.com/xiangyuecn/Recorder https://gitee.com/xiangyuecn/Recorder
@ -197,18 +196,7 @@ bricks.AudioRecorder = class extends bricks.HBox {
params:form params:form
}); });
bricks.debug('ret=', ret); bricks.debug('ret=', ret);
if (!this.upload_resp){ this.dispatch('uploaded', ret)
this.upload_resp = 'text';
}
data = null;
if (this.upload_resp == 'text'){
data = await ret.text();
} else if (this.upload_resp == 'json'){
data = await ret.json();
} else if (this.upload_resp == 'bin'){
data = await ret.bin();
}
this.dispatch('uploaded', data)
} }
download(){ download(){
if(!this.recordData){ if(!this.recordData){
@ -258,3 +246,4 @@ bricks.SttClinet = class extends bricks.VBox {
} }
bricks.Factory.register('AudioPlayer', bricks.AudioPlayer); bricks.Factory.register('AudioPlayer', bricks.AudioPlayer);
bricks.Factory.register('AudioRecorder', bricks.AudioRecorder); bricks.Factory.register('AudioRecorder', bricks.AudioRecorder);
bricks.Factory.register('SttClient', bricks.SttClient);