
How To include JW Player in Android App
Hi Longtailvideo Support Team,
I currently do some experiments on how to build an Android App with video playback capabilities. My test platform is a HTC One X with Android 4.x ICS.
I use the PhoneGap/Cordova project in combination with jQuery Mobile to build the app. My primary objective is that the video playback should not only work on Android 4.x ICS with native HTML5 video support but also on older versions with a Flash video plugin so I got the idea to simply try the JW player with this scenario.
Apart from some minor video playback issues, this idea works good when I test it beforehand in the Mobile Safari on my HTC X Android device where the JW player.swf is loaded from a webserver. However, when I put the player.swf and jwplayer.js to the local resource storage of the app, compile and start the app, the player.swf doesn't load.
My code looks similar to
jwplayer("video").setup({
flashplayer: "jwplayer/player.swf",
provider: "rtmp",
streamer: "rtmp://www.blafoo.com/",
file: "video.mp4",
events: {
onReady: notifyReady,
onError: notifyError
}
});
Although my debugging possibilities are limited within the App, it seems that the jwplayer.js embedder can be found and works normally as expected. However, neither the onReady event nor the onError event is raised, the video area on the screen simply stays blank.
I assume that it might be related to the way on how local resources are handled within android apps. If I understand it correctly, all files are handled as local file system requests, so my player file e.g. will be loaded from
file:///android_asset/www/jwplayer/player.swf
Do you already have some experiences related to this scenario? Is it possible that the file:// prefix in android apps raises a problem? Actually, I do not want to load the player.swf from a remote server everytime a user starts watching a video on his mobile device when I can also be stored directly within the app (the App should have enouth security privileges to access and load these local file resources)
Thanks in advance
Andre