I have two functions in JavaScript
. Its working fine on Windows 7
Chrome
but loadedAudio_chrome
function is not being fired on IPAD
.
function preloadAudio_chrome(url)
{
try
{
var audio = new Audio();
audio.addEventListener('canplaythrough', loadedAudio_chrome, false);
//audio.src = filePath;
} catch (e) {
alert(e.message);
}
}
function loadedAudio_chrome()
{
//alert('not firing this alert on IPAD');
}
You seem to be missing audio.load() from your snippet, try adding that as shown below and it should work.
function preloadAudio_chrome(url)
{
try
{
var audio = new Audio();
audio.addEventListener('canplaythrough', loadedAudio_chrome, false);
// EDIT HERE ADD audio.load();
audio.load();
} catch (e) {
alert(e.message);
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With