bugfix
This commit is contained in:
parent
cfab1946ba
commit
d68536e330
@ -280,3 +280,24 @@ var objcopy = function(obj){
|
||||
}
|
||||
return o;
|
||||
}
|
||||
|
||||
var bricks.playResponseAudio = async function(response, target){
|
||||
var widget = null;
|
||||
if (response.status != 200){
|
||||
console.log('playResponseAudio(): response.status != 200', response.status);
|
||||
return;
|
||||
}
|
||||
if (typeof target == typeof ''){
|
||||
widget = bricks.getWidgetById(target);
|
||||
} else {
|
||||
widget = bricks.widgetBuild(target);
|
||||
}
|
||||
if (! widget){
|
||||
console.log('playResponseAudio():', target, 'can not found or build a widget');
|
||||
return;
|
||||
}
|
||||
const blob = await response.blob();
|
||||
const url = URL.createObjectURL(blob);
|
||||
widget.set_url(url);
|
||||
widget.play();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user