A Phonegap plugin that allows playback of local video files using html 5 video tags
A Phonegap plugin that allows playback of local video files using html 5 video tags
This plugin enables the use of normal HTML5 tags for local video - otherwise not functional in Cordova for Android. If you are looking to simply play videos in full screen started by JS, try the VideoPlayer plugin for Phonegap
Android Webview (which Cordova is based upon) limits access to local files (such as videos) and prohibits reading them, both via relative files and file:/// URIs. Cordova Html5Video Plugin solves this by giving each of you video a android.resource:// path and updating your `` tags accordingly.
For Android only. Tested on Android API 15-19.
For API >= 19, a workaround is employed to copy the video files over to your application's data directory, as world-readable.
WARNING: this is potentially insecure - other apps will be able to read your videos! However it is the only way to get around Chrome's strict limitations on content:// URLs. See Issue #20 for details.
cordova plugin add https://github.com/jaeger25/Html5Video.git
For more help on installing Cordova plugins, please read the official documentation
Create any video tags withing your html pages as normal, but:
Example:
…javascript window.plugins.html5Video.initialize( { "id":"path", ... } [, callback] )
Where callback is optional and is triggered when initialization finished (at the end)
Examples:
Initialization for video1 and video2 with no callback:
```javascript
window.plugins.html5Video.initialize({
"video1" : "video1file.mp4",
"video2" : "video2file.mp4"
})Initialize video1 and call function finished:
window.plugins.html5Video.initialize({
"video1" : "video1file.mp4"
}, finished)Initialize video1 with anonymous function (usefull for playing a video at statup):
window.plugins.html5Video.initialize({
"video1" : "video1file.mp4"
}, function initializeIsFinished() {
window.plugins.html5Video.play("video1")
})Anytime you wish to play a video, call:
window.plugins.html5Video.play("video1" [, callback ])Where callback is optional and is triggered when the video is finished (at the end)
Examples:
Play video1 with no callback:
window.plugins.html5Video.play("video1")Play video1 and call function finished:
window.plugins.html5Video.play("video1", finished).Play video1 with anonymous function:
window.plugins.html5Video.play("video1", function videoIsFinished() {
console.log("Video is finished")
})No open issues yet, or sync has not completed.