I want to play video
and audio
in autoplay mode, When both are ready to play.
I'm using this code.
var video = false;
var audio = false;
video.addEventListener('canplay',function(){
video = true;
playall();
});
audio.addEventListener('canplay',function(){
audio = true;
playall();
});
playall(){
if(video && audio){
console.log('playing start....');
video.play();
audio.play();
}
}
This code is working fine in desktop browsers. But when I try it on mobile device it is not working.
Here is a link where you can see it live how its working.
Video Link