dev
This commit is contained in:
parent
ff41131805
commit
12cbcbf22b
@ -69,14 +69,25 @@ function addText(text) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function playAudio(audioUrl) {
|
async function playAudio(audioUrl) {
|
||||||
audio = document.createElement('audio');
|
fetch(audioUrl)
|
||||||
audio.src = audioUrl;
|
.then(response => {
|
||||||
audio.controls = false;
|
if (!response.ok) {
|
||||||
contentDiv.appendChild(audio);
|
throw new Error('Ошибка сети: ' + response.statusText);
|
||||||
audio.play()
|
}
|
||||||
|
return response.blob();
|
||||||
|
})
|
||||||
|
.then(blob => {
|
||||||
|
const url = URL.createObjectURL(blob);
|
||||||
|
const audio = new Audio(url);
|
||||||
|
|
||||||
|
audio.play().catch(error => {
|
||||||
|
console.error('Ошибка при воспроизведении:', error);
|
||||||
|
});
|
||||||
|
|
||||||
await delay(5000);
|
await delay(5000);
|
||||||
audio.pause();
|
audio.pause();
|
||||||
audio.remove();
|
audio.remove();
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function playSpeech(text) {
|
function playSpeech(text) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user