在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:jaeger25/Html5Video开源软件地址:https://github.com/jaeger25/Html5Video开源编程语言:Java 73.5%开源软件介绍:Cordova Html5Video PluginDescriptionThis plugin enables the use of normal HTML5 Android Webview (which Cordova is based upon) limits access to local files (such as videos) and prohibits reading them, both via relative files and LimitationsFor 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. Install
For more help on installing Cordova plugins, please read the official documentation HTMLCreate any video tags withing your html pages as normal, but:
Example:
The next changes should be done inside your ProjectName/platforms/android folder Enable Hardware Acceleration in AndroidManifest.xmlAndroid Webview disables video for none-hardware accelerated applications. Thus, make sure your manifest tag in AndroidManifest.xml contains:
Consult the official Android documentation if you require more help. This is enabled by default in newer versions of cordova. Move video filesCreate a folder called raw inside the res folder (
If your file doesn't meet the above requirements Client-side code (javascript)After deviceReady callback from Cordova, initialize your videos with: 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: 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")
}) Playing a videoAnytime 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")
}) |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论