Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
H

Html5Video

> 编程语言
Open source

A Phonegap plugin that allows playback of local video files using html 5 video tags

100 stars0 likes1 views
WebsiteGitHub

About

A Phonegap plugin that allows playback of local video files using html 5 video tags

Cordova Html5Video Plugin

Description

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.

Limitations

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.

Install

cordova plugin add https://github.com/jaeger25/Html5Video.git

For more help on installing Cordova plugins, please read the official documentation

HTML

Create any video tags withing your html pages as normal, but:

  1. Give each video tag a unique ID.
  2. The video tags should be empty (i.e no tags inside)
  3. Add any poster image files to your www folder
  4. Autoplay is not enabled, but controlled via JS instead

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:

javascript
window.plugins.html5Video.initialize({
      "video1" : "video1file.mp4"
  }, finished)

Initialize video1 with anonymous function (usefull for playing a video at statup):

javascript
window.plugins.html5Video.initialize({
      "video1" : "video1file.mp4"
  }, function initializeIsFinished() {
  window.plugins.html5Video.play("video1")
})

Playing a video

Anytime you wish to play a video, call:

javascript
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:

javascript
window.plugins.html5Video.play("video1")

Play video1 and call function finished:

javascript
window.plugins.html5Video.play("video1", finished).

Play video1 with anonymous function:

javascript
window.plugins.html5Video.play("video1", function videoIsFinished() {
  console.log("Video is finished")
})

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Java

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言