
iOS double-tap to start playing video
I realize similar questions have been asked before, but I don't see an answer or resolution that quite fixes the issue I'm seeing, so I'm asking again. Sorry if there *is* a proper solution and I missed it. The relevant JS code is below.
With the line "myplayer.play()" present (code below), the video autoplays properly in a desktop browser. However, iOS is a different story. I know that you cannot autoplay a video on iOS, but JWPlayer's behavior still looks broken to me. Here's what I see: when the player loads, I see a spinner where the "play" button normally is. That spinner remains until I tap the player, at which point the spinner disappears, and is replaced by the standard play button. Tapping that play button starts the video. So that means *two* taps are needed to stat a video on iOS: one to clear the spinner, then one to start the video. Clearly, this is broken behavior.
If I remove the "myplayer.play()" line, then the player loads on iOS with the play button, and a single tap starts the video. This is as it should be.
Obviously, I'd like videos to autoplay on the desktop, which means I need the "myplayer.play()" line, but that line breaks things in iOS.
What is the fix? I'm using the cloud-based player, so I'm running whatever the latest version of JWPlayer is, which I think is 6.11 as of today.
Thanks,
Ben
jQuery(document).ready( function (jQuery) {
var myplayer, myplaylist = [];
myplaylist.push ({
mediaid: 'video1',
sources: [
{file: 'path/to/video.mp4'
}
]
});
myplayer = jwplayer('videoplayer').setup({
width: '100%',
aspectratio:'16:9',
autostart: 'false',
playlist: myplaylist
});
myplayer.play();
});