Phonegap Android HTML5 Video issue (error 2147483648)

Phonegap Android HTML5 Video issue (error 2147483648)

I’m writing this to hopefully help some of the thousands of people out there having an issue getting videos to play using Phonegap and Android. I don’t exactly know what the problem is, my best guess is that for some reason the WebView is treating the URL as a local path and attempting to load it from the file system, which eventually leads to an unknown error being returned (error 2147483648). I suspect this because when I intercept the URL requests from the device, it never calls the video URL.

I tried many ways to resolve this:

  1. Open the video directly in an iframe and not the video tag
  2. Open the video in an InAppBrowser
  3. Open the video using a HTML5 JS plugin like VideoJS or JPlayer
  4. Open the video using the native video player (https://github.com/macdonst/VideoPlayer)
    1. It should be noted, that the only reason this didn’t work for me is because the script actually returned an Intent error on all my devices and I gave up trying to fix it.

Eventually what worked is this:

  1. Open an iFrame that loads your a video.html file with an empty body
  2. Inject the video tag in to the iFrame body after the iFrame has completely loaded
  3. Done.

This solution makes no sense, but it works reliably on every device for me.

 

Extract from my project:

 

video.html

 

 Dave

About David Parlevliet

Dave is long time developer with a passion toward teaching. He divides his time between his wife, her cat and his projects. He recently started using twitter so make sure to follow him!