1

For the life of me, I cannot get any video to play using the HTML5 video tag in the android webview using phonegap 3.4. I realize that there are many questions regarding HTML5 video in the android webview, but most of the answers are old and refer to older versions of phonegap.

I've tried using the plugin here:

https://github.com/dawsonloudon/VideoPlayer

but I'm new to phonegap and I can't get the plugin working. I'm not sure where to put the .java file or how to reference it in the project.

Can anyone who has gotten this plugin to work help me set up my project? (i.e. where does the .java file go and how do I reference it?)

jugg1es
  • 1,560
  • 18
  • 33
  • Are you using the cordova command line client? – Dawson Loudon Apr 23 '14 at 19:48
  • yea, can i simply use cordova plugin add https://github.com/dawsonloudon/VideoPlayer? – jugg1es Apr 23 '14 at 20:07
  • oh that appears to have worked – jugg1es Apr 23 '14 at 20:09
  • how do I specify the ` – jugg1es Apr 23 '14 at 20:11
  • Instead of using a ` – Dawson Loudon Apr 23 '14 at 20:14
  • I need way more control than that... my app is a single-page app that uses video within the interface itself. The video can't take up the entire screen and must be able to play without the user interacting with the video control. It has to be controllable via javascript entirely. – jugg1es Apr 23 '14 at 20:17
  • Sorry, sounds like this plugin won't work. – Dawson Loudon Apr 23 '14 at 20:25
  • ok, if I modify your plugin to support injection into an HTML5 video tag, are you interested in having me post the changes to your github? – jugg1es Apr 23 '14 at 20:27
  • yes! That would be great. I'll submit it to phonegap build as a revision as well. Post issues on the repo if you need any help or have any questions. – Dawson Loudon Apr 23 '14 at 20:36

1 Answers1

1

I have ditched all the video plugin stuff as it really was not helping me out at all. You can keep the video tag. Just try using this reference using your package name:

src="android.resource://com.oest.freshwater/raw/caddisfly"

Move the video files into a new directory called "raw" that sits inside the platforms->Android->res folder. You will notice on the link above, the extension of the file (.mp4) is omitted. It is very important NOT to add the extension in the source.

Don't bother trying to get it work in emulator, it will just crash most of the time. Make sure you include a reference to a poster image as the html video player will not display a thumbnail of the video at all.

I should definitely give credit to @Prasanta Barman in their stackoverflow post at Loading video failed on html5 phonegap as this is where I got my solution from.

Community
  • 1
  • 1
Ryan Coolwebs
  • 1,611
  • 5
  • 22
  • 44