2012-10-22


Well if you've followed the saga of getting the video tag to work properly in the WebView on Android then you've read my post about why I created the VideoPlayer plugin and it's enhancement. Well in the upcoming PhoneGap 2.2.0 we will have better, but not perfect, support for the video tag thanks to work by Steren Giannini.

In Android 4.x you only need to set the hardwareAccelerated attribute to true in order to get true in-line video tag support on Android.

Unfortunately, in earlier versions of Android this doesn't fix the problem. So instead code has been added to the core of PhoneGap to detect the video tag and handle it better. Sadly, we are unable to play the video in-line but when a users taps on a video tag a full screen video player will be launched. In order to get back to the main app the user need only hit the back button to return to main app screen.

There are a few caveats though. The video tag will only support a single source so it will need to look something like this:

Additionally the source url can refer to a video on the internet using the http:// protocol or a local file using the file:// protocol. At this time videos in the assets directory are not support so something like file:///android_asset/www/video.mp4 will not work.

So again, it's not perfect but it is better than nothing. If you are getting tripped up with one of the caveats I described above the VideoPlayer plugin still works.

Show more