Interesed full load of file with the subsequent possibility of its playing.
How to implement full preload of sounds and melodies in javascript
?
P.S.: Three I mentioned the word "full".
Interesed full load of file with the subsequent possibility of its playing.
How to implement full preload of sounds and melodies in javascript
?
P.S.: Three I mentioned the word "full".
you can use HTMLAudioElement https://developer.mozilla.org/en-US/docs/Web/API/HTMLAudioElement
var audio = new Audio('audio_file.mp3');
audio.play();
UPDATE
there is a callback event "canplaythrough"
var audio = new Audio();
audio.addEventListener('canplaythrough', audio.play , false);
or
use this library: http://goldfirestudios.com/blog/104/howler.js-Modern-Web-Audio-Javascript-Library
var sound = new Howl({
urls: ['sound.mp3', 'sound.ogg']
}).play();