1
<html>
<head>

    <style>
    </style>

<script>
$(document).ready(function(){
playVid();
$('#NextBut').hide();
$('#PrevBut').hide();
});
</script>

</head>
<body> 
<video width="600" onended="myFunction()"  id="myVideo">
 <source src="DubImages/Malaysia ad.mp4" type="video/mp4">
  </video>
<script>
var vid = document.getElementById("myVideo"); 

function playVid() { 
    vid.play(); 
} 
function myFunction() {
   setInterval(function(){ NextPage(true); }, 1000);
 setInterval(function(){ $('#NextBut').show(); }, 1000);
}
</script>
</body>
</html>

This code working in a desktop browser but in mobile, it's not working, please help. playVid() I am calling once document load complete cross checks my code is correct or wrong. the function is not working.

Catalyst
  • 1,018
  • 2
  • 12
  • 19
rachayya
  • 13
  • 2
  • are you use jquery ? try with vid[0].play(); – user8455694 Aug 23 '17 at 21:17
  • 2
    I don't think you can, I believe playing video requires the user to interact with some sort of mouse click for it to become valid. But from what I can gather this only has to be done once, after this you can then control video fully. It's to prevent pages pumping video to mobile devices without the users initiating it. IOW: If say you place a Button that say start video, it will most likely work. – Keith Aug 23 '17 at 21:20
  • 1
    please paste your full html, Script tag loading jquery is missing in your html – amit wadhwani Aug 23 '17 at 21:20
  • 1
    Most (if not all) mobile browsers are preventing onload auto play of audio and video. – Louys Patrice Bessette Aug 23 '17 at 21:20
  • 1
    Possible duplicate of [Can you autoplay HTML5 videos on the iPad?](https://stackoverflow.com/questions/12496144/can-you-autoplay-html5-videos-on-the-ipad) – Louys Patrice Bessette Aug 23 '17 at 22:07

0 Answers0