Compare commits
64 Commits
Author | SHA1 | Date | |
---|---|---|---|
86b2f61b56 | |||
130fb78b4c | |||
3718ec69ba | |||
4610f4a8c9 | |||
a8062354ec | |||
aac0a5a3a9 | |||
92b9e3400b | |||
bea513f5dd | |||
9d109bf02d | |||
fc45ab48c9 | |||
58e9b02405 | |||
b578fb4840 | |||
f18d9589eb | |||
35c6ec9461 | |||
56d9730d0a | |||
6e18bc8b31 | |||
81756a1af9 | |||
05e1ab1165 | |||
a0ddc5e6eb | |||
dc40b1f93a | |||
d7cc29f2fb | |||
0505e49038 | |||
6ff1e47341 | |||
e72a91de6e | |||
52ec4c012d | |||
ae89c92ab6 | |||
57ad124ce8 | |||
a85d45d2e5 | |||
a6f57fc034 | |||
04c9653b86 | |||
b8cdc71001 | |||
277ebf0fd1 | |||
7682d998e7 | |||
05b9b9a831 | |||
eee699cec6 | |||
3c9e9862d8 | |||
39dc651a9d | |||
4effda125a | |||
bf9de231d8 | |||
ef12332505 | |||
1b735f1727 | |||
7f7ecf852e | |||
931672895f | |||
0952bc8239 | |||
7e7508ca82 | |||
095d100ba4 | |||
c61fad51c1 | |||
7b11c6803d | |||
9b75436380 | |||
be19b72719 | |||
2fdcc18356 | |||
6425a33ccd | |||
12c5dbd290 | |||
cb591dac0c | |||
4c1cdea56e | |||
80cfabbaf9 | |||
c7d28b09c0 | |||
161dd48312 | |||
383515c1b7 | |||
98792168e4 | |||
01437a4a38 | |||
03ed86f5c2 | |||
24bc415faf | |||
152e94f229 |
@ -8,11 +8,11 @@
|
|||||||
"node" : false,
|
"node" : false,
|
||||||
"rhino" : false,
|
"rhino" : false,
|
||||||
"couch" : false,
|
"couch" : false,
|
||||||
"wsh" : true, // Windows Scripting Host.
|
"wsh" : false, // Windows Scripting Host.
|
||||||
"jquery" : false,
|
"jquery" : false,
|
||||||
|
|
||||||
// Development.
|
// Development.
|
||||||
"debug" : false, // Allow debugger statements e.g. browser breakpoints.
|
"debug" : true, // Allow debugger statements e.g. browser breakpoints.
|
||||||
"devel" : true, // Allow developments statements e.g. `console.log();`.
|
"devel" : true, // Allow developments statements e.g. `console.log();`.
|
||||||
|
|
||||||
// ECMAScript 5.
|
// ECMAScript 5.
|
||||||
@ -25,7 +25,7 @@
|
|||||||
"bitwise" : false, // Prohibit bitwise operators (&, |, ^, etc.).
|
"bitwise" : false, // Prohibit bitwise operators (&, |, ^, etc.).
|
||||||
"boss" : false, // Tolerate assignments inside if, for & while. Usually conditions & loops are for comparison, not assignments.
|
"boss" : false, // Tolerate assignments inside if, for & while. Usually conditions & loops are for comparison, not assignments.
|
||||||
"curly" : true, // Require {} for every new block or scope.
|
"curly" : true, // Require {} for every new block or scope.
|
||||||
"eqeqeq" : false, // Require triple equals i.e. `===`.
|
"eqeqeq" : true, // Require triple equals i.e. `===`.
|
||||||
"eqnull" : false, // Tolerate use of `== null`.
|
"eqnull" : false, // Tolerate use of `== null`.
|
||||||
"evil" : false, // Tolerate use of `eval`.
|
"evil" : false, // Tolerate use of `eval`.
|
||||||
"expr" : false, // Tolerate `ExpressionStatement` as Programs.
|
"expr" : false, // Tolerate `ExpressionStatement` as Programs.
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
"main": [
|
"main": [
|
||||||
"dist/plyr.css",
|
"dist/plyr.css",
|
||||||
"dist/plyr.js",
|
"dist/plyr.js",
|
||||||
"dist/sprite.svg",
|
"dist/plyr.svg",
|
||||||
"src/less/plyr.less",
|
"src/less/plyr.less",
|
||||||
"src/scss/plyr.scss",
|
"src/scss/plyr.scss",
|
||||||
"src/js/plyr.js"
|
"src/js/plyr.js"
|
||||||
|
89
changelog.md
89
changelog.md
@ -1,11 +1,96 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
# v2.0.0
|
||||||
|
This version contains several potential ***breaking changes***:
|
||||||
|
|
||||||
|
- `setup()` has been reverted to pre v1.8.0 behaviour; meaning it will return the *instance* rather than the *element*. This is because the reference to the instance is no longer added to the original element (see below).
|
||||||
|
- The reference to the `plyr` instance is now added to the media element rather than original container. This is because if a container with multiple children was passed to `setup()` the references to all instances would have been added to the container, creating issues. I would recommend using the return value from `setup()` or the new `get()` method to access the instance.
|
||||||
|
- Players will always be wrapped in their own div now - this makes `setup()` and `destroy()` cleaner. This *may* break any custom styling based on DOM position.
|
||||||
|
- Players no longer seek to 0 on 'ended' - this is to fix a bug with Microsoft Edge as it triggers 'ended' on media change for whatever reason. They'll never change ;-)
|
||||||
|
|
||||||
|
And some other changes and bug fixes:
|
||||||
|
|
||||||
|
- New `get()` method on the global plyr object to get all instances inside a container
|
||||||
|
- New API methods:
|
||||||
|
- `getOriginal()` to get the original, *unmodified* element plyr was setup on (`<video>`, `<audio>` or empty `<div>` for YouTube and Vimeo)
|
||||||
|
- `getContainer()` to get the players outer wrapper element
|
||||||
|
- `getMedia()` to get the players media element (`<video>`, `<audio>` or empty `<div>` for YouTube and Vimeo)
|
||||||
|
- `getEmbed()` to access the YouTube or Vimeo API directly
|
||||||
|
- `getType()` to get the type of the player
|
||||||
|
- `isReady()` to determine if an instance has completed setup and necessary APIs are loaded (for YouTube / Vimeo)
|
||||||
|
- `on()` to provide an easy way to listen to events
|
||||||
|
- `stop()` to, you guessed it, stop the player
|
||||||
|
- `destroy()` now works correctly for YouTube and Vimeo (fixes #272)
|
||||||
|
- New `destroyed` event when `destroy()` has completed (original element is passed as event.target)
|
||||||
|
- Default volume is now 10 (max) rather than 5
|
||||||
|
- Sprite is only loaded once (fixes #259)
|
||||||
|
- Fixes for Vimeo post message bugs on source change or destroy (fixes #318)
|
||||||
|
- Save caption state in storage (fixes #311)
|
||||||
|
- Added keyboard shortcuts to the current focused player (with `keyboardShortcuts` boolean option to disable) (fixes #309)
|
||||||
|
- Fix for captions bug (fixes #332)
|
||||||
|
- Change to AMD (fixes #298)
|
||||||
|
|
||||||
|
## v1.8.12
|
||||||
|
- Vimeo keyboard focus fix (Fixes #317)
|
||||||
|
- Fix for Vimeo on basic support devices
|
||||||
|
|
||||||
|
## v1.8.11
|
||||||
|
- Fix for keyboard navigation on Vimeo (Fixes #317)
|
||||||
|
- Fix for bug introduced in v1.8.9 related to additional controls
|
||||||
|
- Vimeo API upgrade
|
||||||
|
- Fix for YouTube bug introduced in v1.8.9
|
||||||
|
- Added support for passing array to .setup() (Fixes #319)
|
||||||
|
|
||||||
|
## v1.8.10
|
||||||
|
- Fix for seek issues introduced in v1.8.9
|
||||||
|
|
||||||
|
## v1.8.9
|
||||||
|
- Fix for fullscreen not being defined (Fixes #295)
|
||||||
|
- Fix for multiline captions (Fixes #314)
|
||||||
|
- Clean up of type checks and fix for `restart()` (Fixes #315)
|
||||||
|
- Fix for `MEDIA_ERR_SRC_NOT_SUPPORTED` when calling `.source()` API method
|
||||||
|
|
||||||
|
## v1.8.8
|
||||||
|
- Added getCurrentTime API method (fixes #292)
|
||||||
|
- Fix for !hideControls on touch devices (fixes #303)
|
||||||
|
|
||||||
|
## v1.8.7
|
||||||
|
- Line height fix
|
||||||
|
|
||||||
|
## v1.8.6
|
||||||
|
- Reverted font size change
|
||||||
|
|
||||||
|
## v1.8.5
|
||||||
|
- Fixed overflow issues (fixes #286)
|
||||||
|
|
||||||
|
## v1.8.4
|
||||||
|
- Fix for large play button on small videos
|
||||||
|
|
||||||
|
## v1.8.3
|
||||||
|
- Disabled iPad support for YouTube and Vimeo due to iOS limitations with iFrame playback
|
||||||
|
- Fixed IE11 icon loading (fixes #269)
|
||||||
|
- Updated screenshot (fixes #281)
|
||||||
|
- Added WordPress plugin (fixes #239)
|
||||||
|
- Added Neos plugin
|
||||||
|
- Added HLS, Shaka and dash.js examples (see #235 for more)
|
||||||
|
- Improvements for controls hiding and showing on touch devices
|
||||||
|
|
||||||
|
## v1.8.2
|
||||||
|
- Fixed event bubbling
|
||||||
|
|
||||||
|
## v1.8.1
|
||||||
|
- Fixed inaccurate log message
|
||||||
|
|
||||||
|
# v1.8.0
|
||||||
|
- ***(Important)*** `setup()` now returns the element Plyr was setup on rather than the `plyr` object. This means `var player = plyr.setup()[0];` would now be `var player = plyr.setup()[0].plyr;`. This improves support for React and other virtual dom frameworks as mentioned in #254
|
||||||
|
- Fixed using a relative URL for `iconUrl` in IE (fixes #269)
|
||||||
|
|
||||||
# v1.7.0
|
# v1.7.0
|
||||||
- SASS cleanup (fixes #265)
|
- SASS cleanup (fixes #265)
|
||||||
- Docs tidy up to help quick start (fixes #253)
|
- Docs tidy up to help quick start (fixes #253)
|
||||||
- Fix for issues with data attribute options passing (fixes #257)
|
- Fix for issues with data attribute options passing (fixes #257)
|
||||||
- Removed the requirement for a wrapper div to setup Plyr and removed the dependency on the `plyr` classname as a JS hook. By default it will now look for `<video>`, `<audio>` and `[data-type]` elements. If you are just calling `setup()` with a `<div class="plyr">` you may want to give it a good test after upgrading. You can probably remove the wrapper div. The reason behind this is to make setup easier for newcomers and prevent the styling being used on unsupported players (because the plyr classname was used as a CSS and JS hook - which isn't ideal)
|
- ***(Important)*** Removed the requirement for a wrapper div to setup Plyr and removed the dependency on the `plyr` classname as a JS hook. By default it will now look for `<video>`, `<audio>` and `[data-type]` elements. If you are just calling `setup()` with a `<div class="plyr">` you may want to give it a good test after upgrading. You can probably remove the wrapper div. The reason behind this is to make setup easier for newcomers and prevent the styling being used on unsupported players (because the plyr classname was used as a CSS and JS hook - which isn't ideal)
|
||||||
- Renamed the 'docs' folder to `demo` to avoid confusion. The readme is the docs after all.
|
- Renamed the 'docs' folder to `demo` to avoid confusion - the readme is the docs after all
|
||||||
|
|
||||||
## v1.6.20
|
## v1.6.20
|
||||||
- Fix for multiple sprites being requested (fixes #259)
|
- Fix for multiple sprites being requested (fixes #259)
|
||||||
|
2
demo/dist/demo.css
vendored
2
demo/dist/demo.css
vendored
File diff suppressed because one or more lines are too long
@ -79,7 +79,7 @@
|
|||||||
<script src="dist/demo.js"></script>
|
<script src="dist/demo.js"></script>
|
||||||
|
|
||||||
<!-- Rangetouch to fix <input type="range"> on touch devices (see https://rangetouch.com) -->
|
<!-- Rangetouch to fix <input type="range"> on touch devices (see https://rangetouch.com) -->
|
||||||
<script src="https://cdn.rangetouch.com/0.0.9/rangetouch.js"></script>
|
<script src="https://cdn.rangetouch.com/0.0.9/rangetouch.js" async></script>
|
||||||
|
|
||||||
<!-- Sharing libary (https://shr.one) -->
|
<!-- Sharing libary (https://shr.one) -->
|
||||||
<script src="https://cdn.shr.one/0.1.9/shr.js"></script>
|
<script src="https://cdn.shr.one/0.1.9/shr.js"></script>
|
||||||
|
@ -6,9 +6,10 @@
|
|||||||
|
|
||||||
/*global plyr*/
|
/*global plyr*/
|
||||||
|
|
||||||
|
|
||||||
// General functions
|
// General functions
|
||||||
;(function() {
|
;(function() {
|
||||||
|
//document.body.addEventListener('ready', function(event) { console.log(event); });
|
||||||
|
|
||||||
// Setup the player
|
// Setup the player
|
||||||
var instances = plyr.setup({
|
var instances = plyr.setup({
|
||||||
debug: true,
|
debug: true,
|
||||||
|
@ -39,9 +39,10 @@ header {
|
|||||||
|
|
||||||
// Sections
|
// Sections
|
||||||
section {
|
section {
|
||||||
padding-bottom: @padding-base;
|
max-width: @example-width-video;
|
||||||
|
margin: 0 auto @padding-base;
|
||||||
|
|
||||||
@media (min-width: @screen-sm) {
|
@media (min-width: @screen-sm) {
|
||||||
padding-bottom: (@padding-base * 2);
|
margin-bottom: (@padding-base * 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,11 +2,6 @@
|
|||||||
// Examples
|
// Examples
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
|
|
||||||
section {
|
|
||||||
margin: 0 auto @padding-base;
|
|
||||||
max-width: @example-width-video;
|
|
||||||
}
|
|
||||||
|
|
||||||
// For non supported browsers
|
// For non supported browsers
|
||||||
video {
|
video {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
@ -21,7 +16,7 @@ video {
|
|||||||
.plyr--audio {
|
.plyr--audio {
|
||||||
max-width: @example-width-audio;
|
max-width: @example-width-audio;
|
||||||
}
|
}
|
||||||
.plyr--video::after {
|
.plyr__video-wrapper::after {
|
||||||
content: "";
|
content: "";
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
2
dist/plyr.css
vendored
2
dist/plyr.css
vendored
File diff suppressed because one or more lines are too long
4
dist/plyr.js
vendored
4
dist/plyr.js
vendored
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "plyr",
|
"name": "plyr",
|
||||||
"version": "1.7.0",
|
"version": "2.0.0",
|
||||||
"description": "A simple, accessible and customizable HTML5, YouTube and Vimeo media player",
|
"description": "A simple, accessible and customizable HTML5, YouTube and Vimeo media player",
|
||||||
"homepage": "http://plyr.io",
|
"homepage": "http://plyr.io",
|
||||||
"main": "src/js/plyr.js",
|
"main": "src/js/plyr.js",
|
||||||
@ -27,7 +27,11 @@
|
|||||||
"keywords": [
|
"keywords": [
|
||||||
"HTML5 Video",
|
"HTML5 Video",
|
||||||
"HTML5 Audio",
|
"HTML5 Audio",
|
||||||
"Media Player"
|
"Media Player",
|
||||||
|
"DASH",
|
||||||
|
"Shaka",
|
||||||
|
"WordPress",
|
||||||
|
"HLS"
|
||||||
],
|
],
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
245
readme.md
245
readme.md
@ -3,7 +3,7 @@ A simple, accessible and customizable HTML5, YouTube and Vimeo media player.
|
|||||||
|
|
||||||
[Checkout the demo](https://plyr.io)
|
[Checkout the demo](https://plyr.io)
|
||||||
|
|
||||||
[](https://plyr.io)
|
[](https://plyr.io)
|
||||||
|
|
||||||
## Why?
|
## Why?
|
||||||
We wanted a lightweight, accessible and customizable media player that supports [*modern*](#browser-support) browsers. Sure, there are many other players out there but we wanted to keep things simple, using the right elements for the job.
|
We wanted a lightweight, accessible and customizable media player that supports [*modern*](#browser-support) browsers. Sure, there are many other players out there but we wanted to keep things simple, using the right elements for the job.
|
||||||
@ -13,15 +13,16 @@ We wanted a lightweight, accessible and customizable media player that supports
|
|||||||
- **Lightweight** - under 10KB minified and gzipped
|
- **Lightweight** - under 10KB minified and gzipped
|
||||||
- **[Customisable](#html)** - make the player look how you want with the markup you want
|
- **[Customisable](#html)** - make the player look how you want with the markup you want
|
||||||
- **Semantic** - uses the *right* elements. `<input type="range">` for volume and `<progress>` for progress and well, `<button>`s for buttons. There's no `<span>` or `<a href="#">` button hacks
|
- **Semantic** - uses the *right* elements. `<input type="range">` for volume and `<progress>` for progress and well, `<button>`s for buttons. There's no `<span>` or `<a href="#">` button hacks
|
||||||
- **Responsive** - as you'd expect these days
|
- **Responsive** - works with any screen size
|
||||||
- **HTML Video & Audio** - support for both formats
|
- **HTML Video & Audio** - support for both formats
|
||||||
- **[Embedded Video](#embeds)** - support for YouTube and Vimeo video playback
|
- **[Embedded Video](#embeds)** - support for YouTube and Vimeo video playback
|
||||||
|
- **[Streaming](#streaming)** - support for hls.js, Shaka and dash.js streaming playback
|
||||||
- **[API](#api)** - toggle playback, volume, seeking, and more
|
- **[API](#api)** - toggle playback, volume, seeking, and more
|
||||||
- **[Universal events](#events)** - no messing around with Vimeo and YouTube APIs, all events are universal across formats
|
- **[Events](#events)** - no messing around with Vimeo and YouTube APIs, all events are standardized across formats
|
||||||
- **[Fullscreen](#fullscreen)** - supports native fullscreen with fallback to "full window" modes
|
- **[Fullscreen](#fullscreen)** - supports native fullscreen with fallback to "full window" modes
|
||||||
- **i18n support** - support for internationalization of controls
|
- **i18n support** - support for internationalization of controls
|
||||||
- **No dependencies** - written in "vanilla" JavaScript, no jQuery required
|
- **No dependencies** - written in "vanilla" JavaScript, no jQuery required
|
||||||
- **SASS and LESS provided** - If you like _these_ over plain CSS
|
- **SASS and LESS** - to include in your build processes
|
||||||
|
|
||||||
Oh and yes, it works with Bootstrap.
|
Oh and yes, it works with Bootstrap.
|
||||||
|
|
||||||
@ -29,8 +30,8 @@ Oh and yes, it works with Bootstrap.
|
|||||||
Check out the [changelog](changelog.md) to see what's new with Plyr.
|
Check out the [changelog](changelog.md) to see what's new with Plyr.
|
||||||
|
|
||||||
## Planned Development
|
## Planned Development
|
||||||
- Streaming
|
|
||||||
- Playback speed
|
- Playback speed
|
||||||
|
- Quality selection
|
||||||
- Playlists
|
- Playlists
|
||||||
- Multiple language captions (with selection)
|
- Multiple language captions (with selection)
|
||||||
- Audio captions
|
- Audio captions
|
||||||
@ -38,7 +39,19 @@ Check out the [changelog](changelog.md) to see what's new with Plyr.
|
|||||||
|
|
||||||
If you have any cool ideas or features, please let me know by [creating an issue](https://github.com/Selz/plyr/issues/new) or, of course, forking and sending a pull request.
|
If you have any cool ideas or features, please let me know by [creating an issue](https://github.com/Selz/plyr/issues/new) or, of course, forking and sending a pull request.
|
||||||
|
|
||||||
|
## CMS plugins
|
||||||
|
|
||||||
|
### [WordPress](https://wordpress.org/plugins/plyr/)
|
||||||
|
Created and maintained by Ryan Anthony Drake ([@iamryandrake](https://github.com/iamryandrake))
|
||||||
|
|
||||||
|
### [Neos](https://packagist.org/packages/jonnitto/plyr)
|
||||||
|
Created and maintained by Jon Uhlmann ([@jonnitto](https://github.com/jonnitto))
|
||||||
|
|
||||||
|
### [Kirby](https://github.com/dpschen/kirby-plyrtag)
|
||||||
|
Created and maintained by Dominik Pschenitschni ([@dpschen](https://github.com/dpschen))
|
||||||
|
|
||||||
## Using package managers
|
## Using package managers
|
||||||
|
You can grab the source using one of the following package managers.
|
||||||
|
|
||||||
### npm
|
### npm
|
||||||
```
|
```
|
||||||
@ -61,15 +74,13 @@ ember addon:install ember-cli-plyr
|
|||||||
```
|
```
|
||||||
More info is on [npm](https://www.npmjs.com/package/ember-cli-plyr) and [GitHub](https://github.com/louisrudner/ember-cli-plyr)
|
More info is on [npm](https://www.npmjs.com/package/ember-cli-plyr) and [GitHub](https://github.com/louisrudner/ember-cli-plyr)
|
||||||
|
|
||||||
|
|
||||||
## Quick setup
|
## Quick setup
|
||||||
Here's a quick run through on getting up and running.
|
Here's a quick run through on getting up and running.
|
||||||
|
|
||||||
### HTML
|
### HTML
|
||||||
Plyr extends upon the standard HTML5 markup so that's all you need for those types.
|
Plyr extends upon the standard HTML5 markup so that's all you need for those types. More info on advanced HTML markup can be found under [initialising](#initialising).
|
||||||
|
|
||||||
#### HTML5 Video
|
#### HTML5 Video
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<video poster="/path/to/poster.jpg" controls>
|
<video poster="/path/to/poster.jpg" controls>
|
||||||
<source src="/path/to/video.mp4" type="video/mp4">
|
<source src="/path/to/video.mp4" type="video/mp4">
|
||||||
@ -80,7 +91,6 @@ Plyr extends upon the standard HTML5 markup so that's all you need for those typ
|
|||||||
```
|
```
|
||||||
|
|
||||||
#### HTML5 Audio
|
#### HTML5 Audio
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<audio controls>
|
<audio controls>
|
||||||
<source src="/path/to/audio.mp3" type="audio/mp3">
|
<source src="/path/to/audio.mp3" type="audio/mp3">
|
||||||
@ -91,19 +101,17 @@ Plyr extends upon the standard HTML5 markup so that's all you need for those typ
|
|||||||
For YouTube and Vimeo, Plyr uses the standard YouTube API markup (an empty `<div>`):
|
For YouTube and Vimeo, Plyr uses the standard YouTube API markup (an empty `<div>`):
|
||||||
|
|
||||||
#### YouTube embed
|
#### YouTube embed
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<div data-type="youtube" data-video-id="bTqVqk7FSmY"></div>
|
<div data-type="youtube" data-video-id="bTqVqk7FSmY"></div>
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Vimeo embed
|
#### Vimeo embed
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<div data-type="vimeo" data-video-id="143418951"></div>
|
<div data-type="vimeo" data-video-id="143418951"></div>
|
||||||
```
|
```
|
||||||
|
|
||||||
### JavaScript
|
### JavaScript
|
||||||
Include the `plyr.js` script before the closing `</body>` tag and then call `plyr.setup()`. More info on `setup()` can be found under [#initialising](initialising).
|
Include the `plyr.js` script before the closing `</body>` tag and then call `plyr.setup()`. More info on `setup()` can be found under [initialising](#initialising).
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<script src="path/to/plyr.js"></script>
|
<script src="path/to/plyr.js"></script>
|
||||||
@ -113,7 +121,7 @@ Include the `plyr.js` script before the closing `</body>` tag and then call `ply
|
|||||||
If you want to use our CDN for the JavaScript, you can use the following:
|
If you want to use our CDN for the JavaScript, you can use the following:
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<script src="https://cdn.plyr.io/1.7.0/plyr.js"></script>
|
<script src="https://cdn.plyr.io/2.0.0/plyr.js"></script>
|
||||||
```
|
```
|
||||||
|
|
||||||
### CSS
|
### CSS
|
||||||
@ -126,16 +134,18 @@ Include the `plyr.css` stylsheet into your `<head>`
|
|||||||
If you want to use our CDN for the default CSS, you can use the following:
|
If you want to use our CDN for the default CSS, you can use the following:
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<link rel="stylesheet" href="https://cdn.plyr.io/1.7.0/plyr.css">
|
<link rel="stylesheet" href="https://cdn.plyr.io/2.0.0/plyr.css">
|
||||||
```
|
```
|
||||||
|
|
||||||
### SVG Sprite
|
### SVG Sprite
|
||||||
The SVG sprite is loaded automatically from our CDN. To change this, see the [#options](Options) below. For reference, the CDN hosted SVG sprite can be found at `https://cdn.plyr.io/1.7.0/plyr.svg`.
|
The SVG sprite is loaded automatically from our CDN. To change this, see the [options](#Options) below. For reference, the CDN hosted SVG sprite can be found at `https://cdn.plyr.io/2.0.0/plyr.svg`.
|
||||||
|
|
||||||
## Advanced
|
## Advanced
|
||||||
|
|
||||||
### LESS & SASS/SCSS
|
### LESS & SASS/SCSS
|
||||||
You can use `plyr.less` or `plyr.scss` file included in `/src` as part of your build and change variables to suit your design. The HTML markup uses the BEM methodology with `plyr` as the block, e.g. `.plyr__controls`. You can change the class hooks in the options to match any custom CSS you write. Check out the JavaScript source for more on this.
|
You can use `plyr.less` or `plyr.scss` file included in `/src` as part of your build and change variables to suit your design. The LESS and SASS require you to use the [autoprefixer](https://www.npmjs.com/package/gulp-autoprefixer) plugin (you should already) as all declerations use the W3C definitions - e.g. `appearance: none;` will be prefixed to `-webkit-appearance: none;` by autoprefixer.
|
||||||
|
|
||||||
|
The HTML markup uses the BEM methodology with `plyr` as the block, e.g. `.plyr__controls`. You can change the class hooks in the options to match any custom CSS you write. Check out the JavaScript source for more on this.
|
||||||
|
|
||||||
### SVG
|
### SVG
|
||||||
The icons used in the Plyr controls are loaded in an SVG sprite. The sprite is automatically loaded from our CDN by default. If you already have an icon build system in place, you can include the source plyr icons (see `/src/sprite` for source icons).
|
The icons used in the Plyr controls are loaded in an SVG sprite. The sprite is automatically loaded from our CDN by default. If you already have an icon build system in place, you can include the source plyr icons (see `/src/sprite` for source icons).
|
||||||
@ -162,9 +172,7 @@ WebVTT captions are supported. To add a caption track, check the HTML example ab
|
|||||||
|
|
||||||
#### Initialising
|
#### Initialising
|
||||||
|
|
||||||
By default, Plyr looks for all `<video>`, `<audio>` and `[data-type]` elements and initialises on any found. You can specify other options, including a different selector hook below. The container classname will be added to the specified element(s) if it is not already present (for the CSS).
|
By default, `setup()` will find all `<video>`, `<audio>` and `[data-type]` elements with the document and initialises on any found. Each target media element found will be wrapped in a `<div>` for styling and setup individually. You can specify a variety of arguments to `setup()` to use, including a different NodeList, HTMLElement, Array of HTMLElements or string selector as below:
|
||||||
|
|
||||||
You can initialize the player a few other ways:
|
|
||||||
|
|
||||||
Passing a [NodeList](https://developer.mozilla.org/en-US/docs/Web/API/NodeList):
|
Passing a [NodeList](https://developer.mozilla.org/en-US/docs/Web/API/NodeList):
|
||||||
```javascript
|
```javascript
|
||||||
@ -176,22 +184,32 @@ Passing a [HTMLElement](https://developer.mozilla.org/en/docs/Web/API/HTMLElemen
|
|||||||
plyr.setup(document.querySelector('.js-player'), options);
|
plyr.setup(document.querySelector('.js-player'), options);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Passing an [Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) of [HTMLElement](https://developer.mozilla.org/en/docs/Web/API/HTMLElement)s:
|
||||||
|
```javascript
|
||||||
|
plyr.setup([
|
||||||
|
document.querySelector('.js-player-1'),
|
||||||
|
document.querySelector('.js-player-2')
|
||||||
|
], options);
|
||||||
|
```
|
||||||
|
|
||||||
Passing a [string selector](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll):
|
Passing a [string selector](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll):
|
||||||
```javascript
|
```javascript
|
||||||
plyr.setup('.js-player', options);
|
plyr.setup('.js-player', options);
|
||||||
```
|
```
|
||||||
This can be the target `<video>`, `<audio>` or `[data-type]` elements or a container element.
|
|
||||||
|
The NodeList, HTMLElement or string selector can be the target `<video>`, `<audio>` or `[data-type]` (for embeds) element itself or a container element.
|
||||||
|
|
||||||
Passing just the options object:
|
Passing just the options object:
|
||||||
```javascript
|
```javascript
|
||||||
plyr.setup(options);
|
plyr.setup(options);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
`setup()` will return an array of *instances* that can be used with the [API](#api) methods. See the [API](#api) section for more info.
|
||||||
|
|
||||||
#### RangeTouch
|
#### RangeTouch
|
||||||
Some touch browsers (particularly Mobile Safari on iOS) seem to have issues with `<input type="range">` elements whereby touching the track to set the value doesn't work and sliding the thumb can be tricky. To combat this, I've created [RangeTouch](https://rangetouch.com) which I'd recommend including in your solution. It's a tiny script with a nice benefit for users on touch devices.
|
Some touch browsers (particularly Mobile Safari on iOS) seem to have issues with `<input type="range">` elements whereby touching the track to set the value doesn't work and sliding the thumb can be tricky. To combat this, I've created [RangeTouch](https://rangetouch.com) which I'd recommend including in your solution. It's a tiny script with a nice benefit for users on touch devices.
|
||||||
|
|
||||||
#### Options
|
#### Options
|
||||||
|
|
||||||
Options must be passed as an object to the `setup()` method as above or as JSON in `data-plyr` attribute on each of your target elements:
|
Options must be passed as an object to the `setup()` method as above or as JSON in `data-plyr` attribute on each of your target elements:
|
||||||
|
|
||||||
```html
|
```html
|
||||||
@ -300,6 +318,12 @@ Note the single quotes encapsulating the JSON and double quotes on the object ke
|
|||||||
<td><code>false</code></td>
|
<td><code>false</code></td>
|
||||||
<td>This will restore and *reload* HTML5 video once playback is complete. Note: depending on the browser caching, this may result in the video downloading again (or parts of it). Use with caution.</td>
|
<td>This will restore and *reload* HTML5 video once playback is complete. Note: depending on the browser caching, this may result in the video downloading again (or parts of it). Use with caution.</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><code>keyboardShortcuts</code></td>
|
||||||
|
<td>Boolean</td>
|
||||||
|
<td><code>true</code></td>
|
||||||
|
<td>Enable <a href="#shortcuts">keyboard shortcuts</a></td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><code>tooltips</code></td>
|
<td><code>tooltips</code></td>
|
||||||
<td>Object</td>
|
<td>Object</td>
|
||||||
@ -396,27 +420,36 @@ Note the single quotes encapsulating the JSON and double quotes on the object ke
|
|||||||
|
|
||||||
## API
|
## API
|
||||||
|
|
||||||
#### Fetching the plyr instance
|
### Instance
|
||||||
A `plyr` object is added to any element that Plyr is initialized on. You can then control the player by accessing methods in the `plyr` object.
|
|
||||||
|
|
||||||
There are two ways to access the instance, firstly you re-query the element container you used for setup (e.g. `.js-player`) like so:
|
The easiest way to access the plyr instances is to store the return value from your call to `setup()`:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
var player = document.querySelector('.js-player').plyr;
|
var players = plyr.setup('.js-player');
|
||||||
```
|
```
|
||||||
|
|
||||||
The other method is using the return value from the call to `setup()`. An array of instances is returned so you need to use an index:
|
This will return an array of all instances that were setup. Another way is to use `plyr.get()` to get all instances within a given container, for example:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
var player = plyr.setup('.js-player')[0];
|
var players = plyr.get('.js-player');
|
||||||
```
|
```
|
||||||
|
|
||||||
This will return an array of plyr instances setup, so you need to specify the index of the instance you want. This is less useful if you are setting up multiple instances. You can listen for the `setup` [event](#events) documented below which will return each instance one by one, as they are setup (in the `plyr` key of the event object).
|
If no argument is passed, it will find all instances in the current document. This will return an array of all instances that were found in the given selector.
|
||||||
|
|
||||||
Once you have your instance, you can use the API methods below on it. For example to pause it:
|
A final option is to access the instance through the event handlers:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
player.pause();
|
instance.on('ready', function(event) {
|
||||||
|
var instance = event.detail.plyr;
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### Methods
|
||||||
|
|
||||||
|
Once you have your instances, you can use the API methods below on it. For example to pause the first player:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
players[0].pause();
|
||||||
```
|
```
|
||||||
|
|
||||||
Here's a list of the methods supported:
|
Here's a list of the methods supported:
|
||||||
@ -430,6 +463,36 @@ Here's a list of the methods supported:
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td><code>getContainer()</code></td>
|
||||||
|
<td>—</td>
|
||||||
|
<td>Get the players outer container element that is automatically injected.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><code>getMedia()</code></td>
|
||||||
|
<td>—</td>
|
||||||
|
<td>Get the media element (<code>>video<</code>, <code>>audio<</code> or <code>>div<</code> for YouTube or Vimeo).</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><code>getEmbed()</code></td>
|
||||||
|
<td>—</td>
|
||||||
|
<td>Get the [embed](#embed) API to access those methods - either YouTube or Vimeo.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><code>getType()</code></td>
|
||||||
|
<td>—</td>
|
||||||
|
<td>Get the type - 'video', 'audio', 'youtube' or 'vimeo'.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><code>isReady()</code></td>
|
||||||
|
<td>—</td>
|
||||||
|
<td>Determine if the player is loaded and UI ready - this is because HTML5 is ready instantly but YouTube and Vimeo can take some time to load their APIs.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><code>on()</code></td>
|
||||||
|
<td>String, Function</td>
|
||||||
|
<td>Watch for an event (first argument) and run a callback function (second argument). This saves you doing your own <code>addEventListner</code> code.</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><code>play()</code></td>
|
<td><code>play()</code></td>
|
||||||
<td>—</td>
|
<td>—</td>
|
||||||
@ -440,6 +503,11 @@ Here's a list of the methods supported:
|
|||||||
<td>—</td>
|
<td>—</td>
|
||||||
<td>Pauses the media</td>
|
<td>Pauses the media</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><code>stop()</code></td>
|
||||||
|
<td>—</td>
|
||||||
|
<td>Stops the media</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><code>restart()</code></td>
|
<td><code>restart()</code></td>
|
||||||
<td>—</td>
|
<td>—</td>
|
||||||
@ -519,18 +587,17 @@ Here's a list of the methods supported:
|
|||||||
<tr>
|
<tr>
|
||||||
<td><code>destroy()</code></td>
|
<td><code>destroy()</code></td>
|
||||||
<td>—</td>
|
<td>—</td>
|
||||||
<td>Destroys the plyr UI and any media event listeners, effectively restoring to the previous state before <code>setup()</code> was called.</td>
|
<td>Restores the original element, reversing the effects of <code>setup()</code>.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><code>restore()</code></td>
|
<td><code>getCurrentTime()</code></td>
|
||||||
<td>—</td>
|
<td>—</td>
|
||||||
<td>Reverses the effects of the <code>destroy()</code> method, restoring the UI and listeners.</td>
|
<td>Will return a float with the current time in seconds.</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
#### .source() method
|
#### .source() method
|
||||||
|
|
||||||
This allows changing the plyr source and type on the fly.
|
This allows changing the plyr source and type on the fly.
|
||||||
|
|
||||||
Video example:
|
Video example:
|
||||||
@ -620,7 +687,7 @@ Some more details on the object parameters
|
|||||||
<tr>
|
<tr>
|
||||||
<td><code>title</code></td>
|
<td><code>title</code></td>
|
||||||
<td>String</td>
|
<td>String</td>
|
||||||
<td>Title of the new media. Used for the aria labelling.</td>
|
<td>Title of the new media. Used for the `aria-label` attribute on the play button, and outer container.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><code>sources</code></td>
|
<td><code>sources</code></td>
|
||||||
@ -640,10 +707,16 @@ Some more details on the object parameters
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
||||||
## Events
|
## Events
|
||||||
|
You can listen for events on the target element you setup Plyr on (see example under the table). Some events only apply to HTML5 audio and video. Using your reference to the instance, you can use the `on()` API method or `addEventListener()`. Access to the API can be obtained this way through the `event.detail.plyr` property. Here's an example:
|
||||||
|
|
||||||
You can listen for events on the target element you setup Plyr on (see example under the table). Some events only apply to HTML5 audio and video.
|
```javascript
|
||||||
|
instance.on('ready', function(event) {
|
||||||
|
var instance = event.detail.plyr;
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
These events also bubble up the DOM. The event target will be the container element.
|
||||||
|
|
||||||
<table class="table" width="100%">
|
<table class="table" width="100%">
|
||||||
<thead>
|
<thead>
|
||||||
@ -654,6 +727,16 @@ You can listen for events on the target element you setup Plyr on (see example u
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td><code>setup</code></td>
|
||||||
|
<td></td>
|
||||||
|
<td>When an initial setup has completed</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><code>ready</code></td>
|
||||||
|
<td></td>
|
||||||
|
<td>Triggered when the instance is ready for API use and external APIs are ready (YouTube and Vimeo).</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><code>canplay</code></td>
|
<td><code>canplay</code></td>
|
||||||
<td>✔</td>
|
<td>✔</td>
|
||||||
@ -765,52 +848,84 @@ You can listen for events on the target element you setup Plyr on (see example u
|
|||||||
<td>Captions toggled off</td>
|
<td>Captions toggled off</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><code>ready</code></td>
|
<td><code>destroyed</code></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td>Triggered when initial setup is done or a source change has occurred.</td>
|
<td>When an instance is destroyed. The original element that replaced the container will be returned to your handler as the event target.</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
Details borrowed from: [https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Media_events](https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Media_events)
|
Details borrowed from: [https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Media_events](https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Media_events)
|
||||||
|
|
||||||
Here's an example of binding an event listener:
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
document.querySelector('.js-plyr').addEventListener('ready', function(event) {
|
|
||||||
var player = event.target.plyr;
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
## Embeds
|
## Embeds
|
||||||
|
|
||||||
YouTube and Vimeo are currently supported and function much like a HTML5 video. Check the relevant documentation sections for any differences.
|
YouTube and Vimeo are currently supported and function much like a HTML5 video. Check the relevant documentation sections for any differences.
|
||||||
|
|
||||||
Plyr references a custom version of the Vimeo Froogaloop API as Vimeo have neglected to maintain the library and there were bugs with their version. You don't need to worry about including your own versions of the Vimeo or YouTube JavaScript APIs.
|
Plyr references a custom version of the Vimeo Froogaloop API as Vimeo have neglected to maintain the library and there were bugs with their version. You don't need to worry about including your own versions of the Vimeo or YouTube JavaScript APIs.
|
||||||
|
|
||||||
The native API's can be accessed through the `embed` property of the plyr object. For example:
|
The embed third party API's can be accessed through the `getEmbed()` API method.
|
||||||
|
|
||||||
```javascript
|
|
||||||
document.querySelector('.js-plyr').addEventListener('ready', function(event) {
|
|
||||||
var player = event.target.plyr;
|
|
||||||
|
|
||||||
// YouTube
|
|
||||||
console.log(player.embed.getVideoData());
|
|
||||||
|
|
||||||
// Vimeo
|
|
||||||
console.log(player.embed.api('getColor'));
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
More info on the respective API's here:
|
More info on the respective API's here:
|
||||||
[YouTube API Reference](https://developers.google.com/youtube/js_api_reference)
|
|
||||||
[Vimeo API Reference](https://developer.vimeo.com/player/js-api#reference)
|
- [YouTube API Reference](https://developers.google.com/youtube/js_api_reference)
|
||||||
|
- [Vimeo API Reference](https://developer.vimeo.com/player/js-api#reference)
|
||||||
|
|
||||||
*Please note*: not all API methods may work 100%. Your mileage may vary. It's better to use the universal plyr API where possible.
|
*Please note*: not all API methods may work 100%. Your mileage may vary. It's better to use the universal plyr API where possible.
|
||||||
|
|
||||||
## Fullscreen
|
## Shortcuts
|
||||||
|
By default, a focused player will bind the following keyboard shortcuts:
|
||||||
|
|
||||||
Fullscreen in Plyr is supported for all browsers that [currently support it](http://caniuse.com/#feat=fullscreen). If you're using the default CSS, you can also use a "full browser" mode which will use the full browser window by adding the `plyr-fullscreen` class to your container.
|
<table class="table" width="100%">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th width="25%">Key</th>
|
||||||
|
<th width="75%">Action</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td><code>0</code> to <code>9</code></td>
|
||||||
|
<td>Seek from 0 to 90% respectively</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><code>space</code> or <code>K</code></td>
|
||||||
|
<td>Toggle playback</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><code>→</code></td>
|
||||||
|
<td>Seek forward by the <code>seekTime</code> option</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><code>↑</code></td>
|
||||||
|
<td>Increase volume</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><code>↓</code></td>
|
||||||
|
<td>Decrease volume</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><code>M</code></td>
|
||||||
|
<td>Toggle mute</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><code>F</code></td>
|
||||||
|
<td>Toggle fullscreen</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><code>C</code></td>
|
||||||
|
<td>Toggle captions</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
## Streaming
|
||||||
|
Because Plyr is an extension of the standard HTML5 video and audio elements, third party streaming plugins can be used with Plyr. Massive thanks to Matias Russitto ([@russitto](https://github.com/russitto)) for working on this. Here's a few examples:
|
||||||
|
|
||||||
|
- Using [hls.js](https://github.com/dailymotion/hls.js) - [Demo](http://codepen.io/sampotts/pen/JKEMqB)
|
||||||
|
- Using [Shaka](https://github.com/google/shaka-player) - [Demo](http://codepen.io/sampotts/pen/zBNpVR)
|
||||||
|
- Using [dash.js](https://github.com/Dash-Industry-Forum/dash.js) - [Demo](http://codepen.io/sampotts/pen/BzpJXN)
|
||||||
|
|
||||||
|
## Fullscreen
|
||||||
|
Fullscreen in Plyr is supported by all browsers that [currently support it](http://caniuse.com/#feat=fullscreen). If you're using the default CSS, you can also use a "full browser" mode which will use the full browser window by adding the `plyr-fullscreen` class to your container.
|
||||||
|
|
||||||
## Browser support
|
## Browser support
|
||||||
|
|
||||||
|
1308
src/js/plyr.js
1308
src/js/plyr.js
File diff suppressed because it is too large
Load Diff
@ -19,7 +19,7 @@
|
|||||||
position: relative;
|
position: relative;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
min-width: 200px;
|
min-width: 200px;
|
||||||
font-family: Avenir, "Avenir Next", "Helvetica Neue", "Segoe UI", Helvetica, Arial, sans-serif;
|
font-family: @plyr-font-family;
|
||||||
direction: ltr;
|
direction: ltr;
|
||||||
|
|
||||||
& when (@plyr-border-box = true) {
|
& when (@plyr-border-box = true) {
|
||||||
@ -40,6 +40,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Focus
|
||||||
|
&:focus {
|
||||||
|
outline: 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Media elements
|
// Media elements
|
||||||
video,
|
video,
|
||||||
audio {
|
audio {
|
||||||
@ -225,6 +230,8 @@
|
|||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
padding: floor(@plyr-control-spacing / 3) @plyr-control-spacing;
|
padding: floor(@plyr-control-spacing / 3) @plyr-control-spacing;
|
||||||
background: @plyr-captions-bg;
|
background: @plyr-captions-bg;
|
||||||
|
box-decoration-break: clone;
|
||||||
|
line-height: 150%;
|
||||||
}
|
}
|
||||||
span:empty {
|
span:empty {
|
||||||
display: none;
|
display: none;
|
||||||
@ -255,12 +262,9 @@
|
|||||||
.plyr__controls {
|
.plyr__controls {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
||||||
transition: opacity .3s ease;
|
|
||||||
|
|
||||||
// Spacing
|
// Spacing
|
||||||
> button,
|
> button,
|
||||||
.plyr__progress,
|
.plyr__progress,
|
||||||
@ -324,6 +328,7 @@
|
|||||||
// Hide controls
|
// Hide controls
|
||||||
.plyr--hide-controls .plyr__controls {
|
.plyr--hide-controls .plyr__controls {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Video controls
|
// Video controls
|
||||||
@ -337,6 +342,7 @@
|
|||||||
border-bottom-left-radius: inherit;
|
border-bottom-left-radius: inherit;
|
||||||
border-bottom-right-radius: inherit;
|
border-bottom-right-radius: inherit;
|
||||||
color: @plyr-video-control-color;
|
color: @plyr-video-control-color;
|
||||||
|
transition: opacity .3s ease;
|
||||||
|
|
||||||
button {
|
button {
|
||||||
// Hover and tab focus
|
// Hover and tab focus
|
||||||
@ -354,7 +360,6 @@
|
|||||||
border-radius: inherit;
|
border-radius: inherit;
|
||||||
background: @plyr-audio-controls-bg;
|
background: @plyr-audio-controls-bg;
|
||||||
border: @plyr-audio-controls-border;
|
border: @plyr-audio-controls-border;
|
||||||
box-shadow: @plyr-audio-controls-box-shadow;
|
|
||||||
color: @plyr-audio-control-color;
|
color: @plyr-audio-control-color;
|
||||||
|
|
||||||
button {
|
button {
|
||||||
@ -371,6 +376,7 @@
|
|||||||
.plyr__play-large {
|
.plyr__play-large {
|
||||||
display: none;
|
display: none;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
z-index: 1;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
transform: translate(-50%, -50%);
|
transform: translate(-50%, -50%);
|
||||||
@ -378,7 +384,7 @@
|
|||||||
background: @plyr-video-control-bg-hover;
|
background: @plyr-video-control-bg-hover;
|
||||||
border: 4px solid currentColor;
|
border: 4px solid currentColor;
|
||||||
border-radius: 100%;
|
border-radius: 100%;
|
||||||
box-shadow: 0 1px 1px fade(@plyr-video-controls-bg, 15%);
|
box-shadow: 0 1px 1px fade(#000, 15%);
|
||||||
color: @plyr-video-control-color;
|
color: @plyr-video-control-color;
|
||||||
transition: all .3s ease;
|
transition: all .3s ease;
|
||||||
|
|
||||||
@ -663,7 +669,6 @@
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
font-size: @plyr-font-size-small;
|
font-size: @plyr-font-size-small;
|
||||||
line-height: .95;
|
|
||||||
}
|
}
|
||||||
// Media duration hidden on small screens
|
// Media duration hidden on small screens
|
||||||
.plyr__time + .plyr__time {
|
.plyr__time + .plyr__time {
|
||||||
@ -712,7 +717,6 @@
|
|||||||
|
|
||||||
// Fullscreen
|
// Fullscreen
|
||||||
// --------------------------------------------------------------
|
// --------------------------------------------------------------
|
||||||
.plyr--fullscreen,
|
|
||||||
.plyr--fullscreen-active {
|
.plyr--fullscreen-active {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
@ -723,7 +727,7 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
z-index: 10000000;
|
z-index: 10000000;
|
||||||
background: #000;
|
background: #000;
|
||||||
border-radius: 0;
|
border-radius: 0 !important;
|
||||||
|
|
||||||
video {
|
video {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
@ -11,7 +11,8 @@
|
|||||||
// Colors
|
// Colors
|
||||||
@plyr-color-main: #3498db;
|
@plyr-color-main: #3498db;
|
||||||
|
|
||||||
// Font sizes
|
// Font
|
||||||
|
@plyr-font-family: Avenir, 'Avenir Next', 'Helvetica Neue', 'Segoe UI', Helvetica, Arial, sans-serif;
|
||||||
@plyr-font-size-small: 14px;
|
@plyr-font-size-small: 14px;
|
||||||
@plyr-font-size-base: 16px;
|
@plyr-font-size-base: 16px;
|
||||||
|
|
||||||
@ -32,7 +33,6 @@
|
|||||||
@plyr-video-control-bg-hover: @plyr-color-main;
|
@plyr-video-control-bg-hover: @plyr-color-main;
|
||||||
@plyr-audio-controls-bg: #fff;
|
@plyr-audio-controls-bg: #fff;
|
||||||
@plyr-audio-controls-border: 1px solid #dbe3e8;
|
@plyr-audio-controls-border: 1px solid #dbe3e8;
|
||||||
@plyr-audio-controls-box-shadow: 0 1px 1px fade(#000, 5%);
|
|
||||||
@plyr-audio-control-color: #565D64;
|
@plyr-audio-control-color: #565D64;
|
||||||
@plyr-audio-control-color-hover: #fff;
|
@plyr-audio-control-color-hover: #fff;
|
||||||
@plyr-audio-control-bg-hover: @plyr-color-main;
|
@plyr-audio-control-bg-hover: @plyr-color-main;
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
position: relative;
|
position: relative;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
min-width: 200px;
|
min-width: 200px;
|
||||||
font-family: Avenir, "Avenir Next", "Helvetica Neue", "Segoe UI", Helvetica, Arial, sans-serif;
|
font-family: $plyr-font-family;
|
||||||
direction: ltr;
|
direction: ltr;
|
||||||
|
|
||||||
@if $plyr-border-box == true {
|
@if $plyr-border-box == true {
|
||||||
@ -40,6 +40,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Focus
|
||||||
|
&:focus {
|
||||||
|
outline: 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Media elements
|
// Media elements
|
||||||
video,
|
video,
|
||||||
audio {
|
audio {
|
||||||
@ -225,6 +230,8 @@
|
|||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
padding: floor($plyr-control-spacing / 3) $plyr-control-spacing;
|
padding: floor($plyr-control-spacing / 3) $plyr-control-spacing;
|
||||||
background: $plyr-captions-bg;
|
background: $plyr-captions-bg;
|
||||||
|
box-decoration-break: clone;
|
||||||
|
line-height: 150%;
|
||||||
}
|
}
|
||||||
span:empty {
|
span:empty {
|
||||||
display: none;
|
display: none;
|
||||||
@ -255,12 +262,9 @@
|
|||||||
.plyr__controls {
|
.plyr__controls {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
||||||
transition: opacity .3s ease;
|
|
||||||
|
|
||||||
// Spacing
|
// Spacing
|
||||||
> button,
|
> button,
|
||||||
.plyr__progress,
|
.plyr__progress,
|
||||||
@ -324,6 +328,7 @@
|
|||||||
// Hide controls
|
// Hide controls
|
||||||
.plyr--hide-controls .plyr__controls {
|
.plyr--hide-controls .plyr__controls {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Video controls
|
// Video controls
|
||||||
@ -337,6 +342,7 @@
|
|||||||
border-bottom-left-radius: inherit;
|
border-bottom-left-radius: inherit;
|
||||||
border-bottom-right-radius: inherit;
|
border-bottom-right-radius: inherit;
|
||||||
color: $plyr-video-control-color;
|
color: $plyr-video-control-color;
|
||||||
|
transition: opacity .3s ease;
|
||||||
|
|
||||||
button {
|
button {
|
||||||
// Hover and tab focus
|
// Hover and tab focus
|
||||||
@ -354,7 +360,6 @@
|
|||||||
border-radius: inherit;
|
border-radius: inherit;
|
||||||
background: $plyr-audio-controls-bg;
|
background: $plyr-audio-controls-bg;
|
||||||
border: $plyr-audio-controls-border;
|
border: $plyr-audio-controls-border;
|
||||||
box-shadow: $plyr-audio-controls-box-shadow;
|
|
||||||
color: $plyr-audio-control-color;
|
color: $plyr-audio-control-color;
|
||||||
|
|
||||||
button {
|
button {
|
||||||
@ -371,6 +376,7 @@
|
|||||||
.plyr__play-large {
|
.plyr__play-large {
|
||||||
display: none;
|
display: none;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
z-index: 1;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
transform: translate(-50%, -50%);
|
transform: translate(-50%, -50%);
|
||||||
@ -378,7 +384,7 @@
|
|||||||
background: $plyr-video-control-bg-hover;
|
background: $plyr-video-control-bg-hover;
|
||||||
border: 4px solid currentColor;
|
border: 4px solid currentColor;
|
||||||
border-radius: 100%;
|
border-radius: 100%;
|
||||||
box-shadow: 0 1px 1px transparentize($plyr-video-controls-bg, .85);
|
box-shadow: 0 1px 1px transparentize(#000, .85);
|
||||||
color: $plyr-video-control-color;
|
color: $plyr-video-control-color;
|
||||||
transition: all .3s ease;
|
transition: all .3s ease;
|
||||||
|
|
||||||
@ -662,7 +668,6 @@
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
font-size: $plyr-font-size-small;
|
font-size: $plyr-font-size-small;
|
||||||
line-height: .95;
|
|
||||||
}
|
}
|
||||||
// Media duration hidden on small screens
|
// Media duration hidden on small screens
|
||||||
.plyr__time + .plyr__time {
|
.plyr__time + .plyr__time {
|
||||||
@ -711,7 +716,6 @@
|
|||||||
|
|
||||||
// Fullscreen
|
// Fullscreen
|
||||||
// --------------------------------------------------------------
|
// --------------------------------------------------------------
|
||||||
.plyr--fullscreen,
|
|
||||||
.plyr--fullscreen-active {
|
.plyr--fullscreen-active {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
@ -722,7 +726,7 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
z-index: 10000000;
|
z-index: 10000000;
|
||||||
background: #000;
|
background: #000;
|
||||||
border-radius: 0;
|
border-radius: 0 !important;
|
||||||
|
|
||||||
video {
|
video {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
@ -13,6 +13,7 @@ $plyr-sr-only-important: true !default;
|
|||||||
$plyr-color-main: #3498db !default;
|
$plyr-color-main: #3498db !default;
|
||||||
|
|
||||||
// Font sizes
|
// Font sizes
|
||||||
|
$plyr-font-family: Avenir, 'Avenir Next', 'Helvetica Neue', 'Segoe UI', Helvetica, Arial, sans-serif !default;
|
||||||
$plyr-font-size-small: 14px !default;
|
$plyr-font-size-small: 14px !default;
|
||||||
$plyr-font-size-base: 16px !default;
|
$plyr-font-size-base: 16px !default;
|
||||||
|
|
||||||
@ -33,7 +34,6 @@ $plyr-video-control-color-hover: #fff !default;
|
|||||||
$plyr-video-control-bg-hover: $plyr-color-main !default;
|
$plyr-video-control-bg-hover: $plyr-color-main !default;
|
||||||
$plyr-audio-controls-bg: #fff !default;
|
$plyr-audio-controls-bg: #fff !default;
|
||||||
$plyr-audio-controls-border: 1px solid #dbe3e8 !default;
|
$plyr-audio-controls-border: 1px solid #dbe3e8 !default;
|
||||||
$plyr-audio-controls-box-shadow: 0 1px 1px transparentize(#000, .95) !default;
|
|
||||||
$plyr-audio-control-color: #565D64 !default;
|
$plyr-audio-control-color: #565D64 !default;
|
||||||
$plyr-audio-control-color-hover: #fff !default;
|
$plyr-audio-control-color-hover: #fff !default;
|
||||||
$plyr-audio-control-bg-hover: $plyr-color-main;
|
$plyr-audio-control-bg-hover: $plyr-color-main;
|
||||||
|
Reference in New Issue
Block a user