What are the limits of "user initiated" playback events on html5 mobile video player

It seems to be a common complaint that mobile devices won't automatically play video or audio. According to Apple's developer library, it is specifically disabled:

In Safari on iOS (for all devices including iPad), where the user can be on the cellular network and charge per unit of data, preloading and autoplay are disabled. No data is loaded until the user initiates it. This means that the JavaScript play () and load () methods are also inactive until the user starts playing, unless the play () or load () method is called by user action. In other words, the custom play button works, but the onLoad = "play ()" event doesn't.

What is allowed for direct user action to trigger a replay event. My problem is that I have video thumbnails that, when clicked, load the video element into place and should play after loading them. On mobile, the user needs to double click to make the video play, which is not very good. I'm upset because my user actually triggers the game action, but there are several other events that happen in between. I started testing another user triggered event to see what the scope or limits of that apple is causing "direct user action".

I found that this code triggered a play event:

$(".clickElement").click(function(){
    $("video").get(0).play();
});

      

until that happened:

$(".clickElement").click(function(){
    setTimeout(function(){
        $("video").get(0).play();
    },0);
});

      

the same was for different timeouts and when setInterval was used instead.

My question is, what / how does apple define direct user action? Obviously, timeouts and intervals are not straightforward enough. Is there a way to fire an event "directly" from the user and allow enough time for my video element to enter?

+3
javascript jquery android ios video


source to share


No one has answered this question yet

Check out similar questions:

sixteen
Prevent HTML5 video from loading on mobile devices - videojs
fourteen
What's play event on html5 video element?
eleven
Mp4 video in html5 video library not playing in mobile chrome and mobile safari
2
HTML5 video not playing on android chrome
1
Jwplayer 6: html5 full screen when video was clicked to play
1
Loading HTML5 video on iPad via onclick event bound to div
1
Youtube Javascript API not allowing to control playback on mobile devices even when launched via user input
0
Mobile audio playback when clicked by user
0
Apple / Safari releases background video on mobile
0
User actions required on every call to play () for html5 video on mobile



All Articles
Loading...
X
Show
Funny
Dev
Pics