See you next Friday.
Friday, November 25, 2011
Books I've Read This Week
Monday, November 21, 2011
Video Player Plugin for PhoneGap Android
One of the more annoying problems when using an Android WebView is that the <video/> tag is not well supported. In fact it is pretty much broken. To that end I spent some time writing a VideoPlayer plugin to help work around the issue. As of the weekend I put in a fix making playing YouTube videos easier so I figured I'd share it with all of you.
Installation of the plugin is pretty simple:
1. To install the plugin, move www/video.js to your project's www folder and include a reference to it in your html file after phonegap.{ver}.js.
<script type="text/javascript" charset="utf-8" src="phonegap.js"></script>
<script type="text/javascript" charset="utf-8" src="video.js"></script>
2. Create a directory within your project called "src/com/phonegap/plugins/video" and copy "src/com/phonegap/plugins/video/VideoPlayer.java" into it.
3. In your res/xml/plugins.xml file add the following line:
<plugin name="VideoPlayer" value="com.phonegap.plugins.video.VideoPlayer"/>
Once installed you will be able to play a video by calling:
1. The file:// protocol to play something native to the device such as:
Sadly at this point in time the VideoPlayer does not support playing videos from your android asset directory. That is an enhancement for a later date.
So, there you go a pretty simple and easy to use plugin which can get you unstuck if you really need to play a video in your Android PhoneGap application. Lemme know you feedback.
Installation of the plugin is pretty simple:
1. To install the plugin, move www/video.js to your project's www folder and include a reference to it in your html file after phonegap.{ver}.js.
<script type="text/javascript" charset="utf-8" src="phonegap.js"></script>
<script type="text/javascript" charset="utf-8" src="video.js"></script>
2. Create a directory within your project called "src/com/phonegap/plugins/video" and copy "src/com/phonegap/plugins/video/VideoPlayer.java" into it.
3. In your res/xml/plugins.xml file add the following line:
<plugin name="VideoPlayer" value="com.phonegap.plugins.video.VideoPlayer"/>
Once installed you will be able to play a video by calling:
window.plugins.videoPlayer.play(url);The url parameter can be one of three types:
1. The file:// protocol to play something native to the device such as:
window.plugins.videoPlayer.play("file:///sdcard/MyMovie.mp4");2. The http:// protocol to play something on the internet such as:
window.plugins.videoPlayer.play("http://path.to.my/file.mp4");3. The http:// protocol pointing to a video on YouTube such as:
window.plugins.videoPlayer.play("http://www.youtube.com/watch?v=E0UV5i5jY50");As long as your url has "youtube.com" and contains the video ID (i.e. the v parameter) the VideoPlayer should be able to start the YouTube app on your phone to play the video without any additional user interaction. However, if the phone does not have the YouTube app you are out of luck. In the future I may add a check for this that will ask the user to install the YouTube app first.
Sadly at this point in time the VideoPlayer does not support playing videos from your android asset directory. That is an enhancement for a later date.
So, there you go a pretty simple and easy to use plugin which can get you unstuck if you really need to play a video in your Android PhoneGap application. Lemme know you feedback.
Friday, November 18, 2011
Books I've Read This Week
After two weeks of travel and attending conferences I came down with a case of con crud and I've been sick for a week. Consequently most of my reading time went to sleeping instead. Although I did get in some quick comic book hits.
See you next Friday.
See you next Friday.
Friday, November 11, 2011
Books I've Read This Week
The books have some really engaging characters and if you don't fall in love with the kids Alph and Vinnie then apparently you don't like smart mouth artful dodger types. |
See you next Friday.
Friday, November 4, 2011
Books I've Read This Week
![]() |
See you next Friday.
Subscribe to:
Posts (Atom)