Video
A flexible modern video js plugin.
Introduction
Installation
NPM
npm i @pluginjs/video
Yarn
yarn add @pluginjs/video
Dependencies
Getting Started
Include
Webpack && Rollup:
ECMAScript Modules
import video from "@pluginjs/video"
CommonJS
require("@pluginjs/video")
CDN:
Development:
<script src="/path/to/video.js"></script>
<link rel="stylesheet" href="/path/to/video.css">
Production:
<script src="/path/to/video.min.js"></script>
<link rel="stylesheet" href="/path/to/video.min.css">
Initialize
HTML:
<body>
<div class="element"></div>
</body>
JS:
Pj.Video('.element', options);
$('.element').plugin('Video', options);
API
Options:
Options are called on video instances through the video options itself.
You can also save the instances to variable for further use.
Example
$('.element').plugin('Video', {
template: "foo"
})
or use dataset
<div class="element" data-template="foo"></div>
<script>
$('.element').plugin('Video')
</script>
Name | Description | Default |
---|
"template" | Main structure template | function() {...} |
"templates" | Template blocks | {} |
"url" | Video url | `` |
"id" | Video id | `` |
"type" | Different video sources, such as HTML5 Youtube Vimeo | `` |
"autoplay" | Whether to play automatically when loading video | true |
"loop" | Whether to loop the video | true |
"controls" | Whether to show the video controller | false |
"poster" | Whether to display the poster | `` |
Events:
Events are called on video instances through the video events itself.
You can also save the instances to variable for further use.
Name | Description |
---|
"ready" | Gets fired when plugin is ready |
"destroy" | Gets fired when plugin is destroy |
"load" | Gets fired when video is loading |
"loaded" | Gets fired when video is loaded |
"play" | Gets fired when video is play |
"pause" | Gets fired when video is pause |
"stop" | Gets fired when video is stop |
"playend" | Gets fired when video is playend |
"playerr" | Gets fired when video is playerr |
example:
$video.plugin('Video', {
onReady: function() {
}
})
$video.on(
'video:ready',
function(){
}
)
Methods:
Methods are called on video instances through the video method itself.
You can also save the instances to variable for further use.
Name | Description |
---|
"enable" | Enabled plugin if plugin is disabled |
"disable" | Disable plugin |
"destroy" | Destroy plugin |
"pause" | Pause video |
"load" | Load video |
"play" | Play video |
"stop" | Stop video |
"volume" | Set the video volume |
example:
$video.plugin('Video', value)
$video.plugin('Video', value, "foo")
$video.plugin('Video', value, "foo", "bar")
Classes:
Name | Description | Default |
---|
"NAMESPACE" | Declare plugin namespace | pj-video |
"THEME" | Declare plugin theme | {namespace}--{theme} |
"POSTER" | Declare plugin poster | {namespace}-poster |
Browser support
Tested on all major browsers.
 |  |  |  |  |  |
---|
Latest ✓ | Latest ✓ | Latest ✓ | Latest ✓ | >=10 ✓ | Latest ✓ |
As a jQuery plugin, you also need to see the jQuery Browser Support.
Contributing
See Contribution.md.
Changelog
To see the list of recent changes, see Releases section.
Version
Version: 0.2.1
Copyright and license
Copyright (C) 2017 Creation Studio Limited.
Licensed under the GPL-v3 license.