Html5 - Callback when media is ready on iPad wont work
- by Kap
I'm trying to add a callback to a HTML5 audio element on an iPad.
I added an eventlistener to the element, the myOtherThing() starts but there is no sound. If I pause and the play the sound again the audio starts. This works in chrome. Does anyone have an idea how I can do this?
myAudioElement.src = "path_to_file";
addEventListener("canplay", function(){
myAudioElement.play();
myOtherThing.start();
});
SOLVED
Just wanted to share my solution here, just in case someone else needs it. As far as I understand the iPad does not trigger any events without user interactions. So to be able to use "canply", "playing" and all the other events you need to use the built in media controller. Once you press play in that controller, the events gets triggered. After that you can use your custom interface.