Answer the question
In order to leave comments, you need to log in
How to play download to start audio?
<audio id="audio-player" controls
:src="response"
type="audio/wav"
style="max-width: 100%;">
Ваш браузер не поддерживает тег audio!
</audio>
methods: test() {
...
var v = this;
this.connection.onmessage = function(event) {
v.show_response = true;
v.spinner_visible = false;
try {
var data = JSON.parse(event.data)
var q = new Buffer.from(new String(data.audio_bytes).toString(), 'base64');//
const blob = new Blob(
[new Uint8Array(q)],
{type: 'audio/wav'});
const url = URL.createObjectURL(blob);
console.log(url);
v.response = url;
const audio = document.getElementById('audio-player');
audio.load();
} catch (ex) {
console.log(ex);
}
}
...}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question