1234567891011121314151617181920212223 |
- // Carregando audios - fetch api e HTMLAudioElement
- function loadAudios() {
- var init = {
- mode: "same-origin", // por padrão é "cors"
- };
- audiosUrl.forEach((url) => {
- fetch(url, init)
- .then(response => response.blob())
- .then(function (myBlob) {
- audios.push(new Audio(URL.createObjectURL(myBlob))); //HTMLAudioElement
- })
- });
- }
- function playAudio() {
- audios[0].play();
- }
- let audios = []
- let audiosUrl = [
- "audio/beep.mp3"
- ];
|