a432511 a432511 - 1 month ago 17
iOS Question

Phonegap iOS HTML5 Video Opens Player

I am using Phonegap with a very simple landing page:

<div>
<video playsinline autoplay muted loop id='bgvid'>
<source src='vid/localvid.mp4' type='video/mp4'>
</video>
</div>


The intent is to have the video playing in the background with some content overlayed on top. The video does indeed start playing, but on iOS it launches the native full screen video player rather than playing it in the div itself.

Any idea how to keep it from launching the native video player?

Thanks!

Answer

It actually takes two things and it DOES work on the iPhone:

Add this to config.xml <preference name="AllowInlineMediaPlayback" value="true" />

And in the HTML you must include webkit-playsinline

<video webkit-playsinline playsinline autoplay muted loop><source src='vid/vid.mp4' type='video/mp4'></video>