Compare commits
32 Commits
Author | SHA1 | Date | |
---|---|---|---|
a9bb8afca4 | |||
28cd92b708 | |||
a44c7ecc3a | |||
5214c5d55d | |||
3e6ed7b69b | |||
7d2a8d343a | |||
03aacf483f | |||
73a1391f2f | |||
660ff0434d | |||
94208dce76 | |||
efe54fbba4 | |||
10561d6c83 | |||
0ef87f93a6 | |||
a3ed309342 | |||
08b4c09b89 | |||
a509a5e1bc | |||
bec10e7836 | |||
f9a184800b | |||
f428c3ff8b | |||
97eb40a8e3 | |||
8211631950 | |||
a17cbb0e8b | |||
8098be6f93 | |||
1c73c9fbfe | |||
978606edb4 | |||
435b5c74bf | |||
15fd7041ab | |||
1ced6b4d67 | |||
6694c1e6cf | |||
19ca906e50 | |||
12e94775d6 | |||
df7f52d885 |
18
.github/issue_template.md
vendored
Normal file
18
.github/issue_template.md
vendored
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
- [ ] Issue does not already exist
|
||||||
|
- [ ] Issue observed on https://plyr.io
|
||||||
|
|
||||||
|
### Expected behaviour
|
||||||
|
|
||||||
|
### Actual behaviour
|
||||||
|
|
||||||
|
### Environment
|
||||||
|
|
||||||
|
- Browser:
|
||||||
|
- Version:
|
||||||
|
- Operating System:
|
||||||
|
- Version:
|
||||||
|
|
||||||
|
### Steps to reproduce
|
||||||
|
-
|
||||||
|
|
||||||
|
### Relevant links
|
8
.github/pull_request_template.md
vendored
Normal file
8
.github/pull_request_template.md
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
### Link to related issue (if applicable)
|
||||||
|
|
||||||
|
### Sumary of proposed changes
|
||||||
|
|
||||||
|
### Task list
|
||||||
|
|
||||||
|
- [ ] Tested on [supported browsers](https://github.com/Selz/plyr#browser-support)
|
||||||
|
- [ ] Gulp build completed
|
11
.jsbeautifyrc
Normal file
11
.jsbeautifyrc
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"html": {
|
||||||
|
"allowed_file_extensions": []
|
||||||
|
},
|
||||||
|
"css": {
|
||||||
|
"allowed_file_extensions": []
|
||||||
|
},
|
||||||
|
"js": {
|
||||||
|
"allowed_file_extensions": []
|
||||||
|
}
|
||||||
|
}
|
62
changelog.md
62
changelog.md
@ -1,15 +1,55 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
# v2.0.1
|
## v2.0.11
|
||||||
- Version bump for NPM
|
- Fix for `cleanUp` being called twice (thanks to @sebastiancarlsson)
|
||||||
|
- Fix for YouTube controls on iPad (fixes #391)
|
||||||
|
|
||||||
|
## v2.0.10
|
||||||
|
- Added seek event fixes for Vimeo and YouTube (fixes #409)
|
||||||
|
- Added support for embed URLs rather than ID only (fixes #345)
|
||||||
|
|
||||||
|
## v2.0.9
|
||||||
|
- Temporary patch for the YouTube API issues with `getDuration()` (relates to #374)
|
||||||
|
|
||||||
|
## v2.0.8
|
||||||
|
- Added `isPaused()` API method (thanks to @darrena092)
|
||||||
|
- Allowed `.on()` API method to be chainable (thanks to @gurupras) (fixes #357)
|
||||||
|
- Improved the "awful" rendering of captions on small screens in fullscreen mode (fixes #390)
|
||||||
|
- Fix for Firefox VTT compatibility (thanks to @magourex)
|
||||||
|
- Fix for Firefox Developer Edition blank video due to `-webkit-mask-image` issue (fixes #392)
|
||||||
|
- Added Issue and PR templates with the aim of reducing duplicate or duff issues
|
||||||
|
|
||||||
|
## v2.0.7
|
||||||
|
- Fixed `getCurrentTime()` method (fixes #351)
|
||||||
|
- Added `getVolume()` , `isMuted()` and `getDuration()` API methods (fixes #346)
|
||||||
|
|
||||||
|
## v2.0.6
|
||||||
|
- Fixed merge issue with `Updated define to work with AMD imports #326` PR
|
||||||
|
- Code formatting
|
||||||
|
|
||||||
|
## v2.0.5
|
||||||
|
- Fix for Vimeo in IE9 & IE10
|
||||||
|
- Fix for HTML5 elements not firing `ready` event
|
||||||
|
|
||||||
|
## v2.0.4
|
||||||
|
- Fix for Firefox full screen (fixes #343)
|
||||||
|
|
||||||
|
## v2.0.3
|
||||||
|
- Set 'global' keyboard shortcut option to false as default, added `<textarea>` to editable elements to be ignored
|
||||||
|
|
||||||
|
## v2.0.2
|
||||||
|
- Added 'global' keyboard shortcut option
|
||||||
|
|
||||||
|
## v2.0.1
|
||||||
|
- Version bump for NPM (sorry for folks who upgraded to the now deleted v1.9.0 through NPM)
|
||||||
|
|
||||||
# v2.0.0
|
# v2.0.0
|
||||||
This version contains several potential ***breaking changes***:
|
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).
|
- `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.
|
- 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 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 ;-)
|
- 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:
|
And some other changes and bug fixes:
|
||||||
|
|
||||||
@ -39,7 +79,7 @@ And some other changes and bug fixes:
|
|||||||
|
|
||||||
## v1.8.11
|
## v1.8.11
|
||||||
- Fix for keyboard navigation on Vimeo (Fixes #317)
|
- Fix for keyboard navigation on Vimeo (Fixes #317)
|
||||||
- Fix for bug introduced in v1.8.9 related to additional controls
|
- Fix for bug introduced in v1.8.9 related to additional controls
|
||||||
- Vimeo API upgrade
|
- Vimeo API upgrade
|
||||||
- Fix for YouTube bug introduced in v1.8.9
|
- Fix for YouTube bug introduced in v1.8.9
|
||||||
- Added support for passing array to .setup() (Fixes #319)
|
- Added support for passing array to .setup() (Fixes #319)
|
||||||
@ -79,20 +119,20 @@ And some other changes and bug fixes:
|
|||||||
- Improvements for controls hiding and showing on touch devices
|
- Improvements for controls hiding and showing on touch devices
|
||||||
|
|
||||||
## v1.8.2
|
## v1.8.2
|
||||||
- Fixed event bubbling
|
- Fixed event bubbling
|
||||||
|
|
||||||
## v1.8.1
|
## v1.8.1
|
||||||
- Fixed inaccurate log message
|
- Fixed inaccurate log message
|
||||||
|
|
||||||
# v1.8.0
|
# 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
|
- ***(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)
|
- 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)
|
||||||
- ***(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)
|
- ***(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
|
||||||
@ -122,7 +162,7 @@ And some other changes and bug fixes:
|
|||||||
- Decreased sensitivity and inverted scroll on volume slider (scroll up to increase, down to decrease)
|
- Decreased sensitivity and inverted scroll on volume slider (scroll up to increase, down to decrease)
|
||||||
|
|
||||||
## v1.6.12
|
## v1.6.12
|
||||||
- Fix for undefined buffer error
|
- Fix for undefined buffer error
|
||||||
- Add scroll listener on volume slider (PR #227 bty @igoradamenko)
|
- Add scroll listener on volume slider (PR #227 bty @igoradamenko)
|
||||||
|
|
||||||
## v1.6.11
|
## v1.6.11
|
||||||
@ -164,13 +204,13 @@ And some other changes and bug fixes:
|
|||||||
- Other minor bug fixes
|
- Other minor bug fixes
|
||||||
|
|
||||||
## v1.6.1
|
## v1.6.1
|
||||||
- Tooltip changes for accessibility
|
- Tooltip changes for accessibility
|
||||||
|
|
||||||
## v1.6.0
|
## v1.6.0
|
||||||
- New, cleaner, UI:
|
- New, cleaner, UI:
|
||||||
- Controls are now overlaid, maintaining the video's ratio and making sizing easier
|
- Controls are now overlaid, maintaining the video's ratio and making sizing easier
|
||||||
- A large play button can now be overlaid over videos
|
- A large play button can now be overlaid over videos
|
||||||
- Default number of control buttons reduced
|
- Default number of control buttons reduced
|
||||||
- New play, pause, rewind and fast forward icons
|
- New play, pause, rewind and fast forward icons
|
||||||
- Flexbox all the things!
|
- Flexbox all the things!
|
||||||
- Tidied up the LESS (and SCSS) as part of the above, variables and mixins in seprate files amking customization and upgrades easier
|
- Tidied up the LESS (and SCSS) as part of the above, variables and mixins in seprate files amking customization and upgrades easier
|
||||||
|
2
demo/dist/demo.css
vendored
2
demo/dist/demo.css
vendored
File diff suppressed because one or more lines are too long
2
demo/dist/demo.js
vendored
2
demo/dist/demo.js
vendored
@ -1 +1 @@
|
|||||||
"document"in self&&("classList"in document.createElement("_")?!function(){"use strict";var e=document.createElement("_");if(e.classList.add("c1","c2"),!e.classList.contains("c2")){var t=function(e){var t=DOMTokenList.prototype[e];DOMTokenList.prototype[e]=function(e){var i,s=arguments.length;for(i=0;s>i;i++)e=arguments[i],t.call(this,e)}};t("add"),t("remove")}if(e.classList.toggle("c3",!1),e.classList.contains("c3")){var i=DOMTokenList.prototype.toggle;DOMTokenList.prototype.toggle=function(e,t){return 1 in arguments&&!this.contains(e)==!t?t:i.call(this,e)}}e=null}():!function(e){"use strict";if("Element"in e){var t="classList",i="prototype",s=e.Element[i],o=Object,n=String[i].trim||function(){return this.replace(/^\s+|\s+$/g,"")},r=Array[i].indexOf||function(e){for(var t=0,i=this.length;i>t;t++)if(t in this&&this[t]===e)return t;return-1},a=function(e,t){this.name=e,this.code=DOMException[e],this.message=t},c=function(e,t){if(""===t)throw new a("SYNTAX_ERR","An invalid or illegal string was specified");if(/\s/.test(t))throw new a("INVALID_CHARACTER_ERR","String contains an invalid character");return r.call(e,t)},l=function(e){for(var t=n.call(e.getAttribute("class")||""),i=t?t.split(/\s+/):[],s=0,o=i.length;o>s;s++)this.push(i[s]);this._updateClassName=function(){e.setAttribute("class",this.toString())}},u=l[i]=[],d=function(){return new l(this)};if(a[i]=Error[i],u.item=function(e){return this[e]||null},u.contains=function(e){return e+="",-1!==c(this,e)},u.add=function(){var e,t=arguments,i=0,s=t.length,o=!1;do e=t[i]+"",-1===c(this,e)&&(this.push(e),o=!0);while(++i<s);o&&this._updateClassName()},u.remove=function(){var e,t,i=arguments,s=0,o=i.length,n=!1;do for(e=i[s]+"",t=c(this,e);-1!==t;)this.splice(t,1),n=!0,t=c(this,e);while(++s<o);n&&this._updateClassName()},u.toggle=function(e,t){e+="";var i=this.contains(e),s=i?t!==!0&&"remove":t!==!1&&"add";return s&&this[s](e),t===!0||t===!1?t:!i},u.toString=function(){return this.join(" ")},o.defineProperty){var p={get:d,enumerable:!0,configurable:!0};try{o.defineProperty(s,t,p)}catch(h){-2146823252===h.number&&(p.enumerable=!1,o.defineProperty(s,t,p))}}else o[i].__defineGetter__&&s.__defineGetter__(t,d)}}(self)),function(){function e(e,t,i){if(e)if(e.classList)e.classList[i?"add":"remove"](t);else{var s=(" "+e.className+" ").replace(/\s+/g," ").replace(" "+t+" ","");e.className=s+(i?" "+t:"")}}function t(t,i){if(t in n&&(i||t!=r)&&(r.length||t!=n.video)){switch(t){case n.video:s.source({type:"video",title:"View From A Blue Moon",sources:[{src:"https://cdn.selz.com/plyr/1.5/View_From_A_Blue_Moon_Trailer-HD.mp4",type:"video/mp4"},{src:"https://cdn.selz.com/plyr/1.5/View_From_A_Blue_Moon_Trailer-HD.webm",type:"video/webm"}],poster:"https://cdn.selz.com/plyr/1.5/View_From_A_Blue_Moon_Trailer-HD.jpg",tracks:[{kind:"captions",label:"English",srclang:"en",src:"https://cdn.selz.com/plyr/1.5/View_From_A_Blue_Moon_Trailer-HD.en.vtt","default":!0}]});break;case n.audio:s.source({type:"audio",title:"Kishi Bashi – “It All Began With A Burst”",sources:[{src:"https://cdn.selz.com/plyr/1.5/Kishi_Bashi_-_It_All_Began_With_a_Burst.mp3",type:"audio/mp3"},{src:"https://cdn.selz.com/plyr/1.5/Kishi_Bashi_-_It_All_Began_With_a_Burst.ogg",type:"audio/ogg"}]});break;case n.youtube:s.source({type:"video",title:"View From A Blue Moon",sources:[{src:"bTqVqk7FSmY",type:"youtube"}]});break;case n.vimeo:s.source({type:"video",title:"View From A Blue Moon",sources:[{src:"143418951",type:"vimeo"}]})}r=t;for(var a=o.length-1;a>=0;a--)e(o[a].parentElement,"active",!1);e(document.querySelector('[data-source="'+t+'"]').parentElement,"active",!0)}}var i=plyr.setup({debug:!0,title:"Video demo",iconUrl:"../dist/plyr.svg",tooltips:{controls:!0},captions:{defaultActive:!0}});plyr.loadSprite("dist/demo.svg");for(var s=i[0],o=document.querySelectorAll("[data-source]"),n={video:"video",audio:"audio",youtube:"youtube",vimeo:"vimeo"},r=window.location.hash.replace("#",""),a=window.history&&window.history.pushState,c=o.length-1;c>=0;c--)o[c].addEventListener("click",function(){var e=this.getAttribute("data-source");t(e),a&&history.pushState({type:e},"","#"+e)});if(window.addEventListener("popstate",function(e){e.state&&"type"in e.state&&t(e.state.type)}),a){var l=!r.length;l&&(r=n.video),r in n&&history.replaceState({type:r},"",l?"":"#"+r),r!==n.video&&t(r,!0)}}(),document.domain.indexOf("plyr.io")>-1&&(!function(e,t,i,s,o,n,r){e.GoogleAnalyticsObject=o,e[o]=e[o]||function(){(e[o].q=e[o].q||[]).push(arguments)},e[o].l=1*new Date,n=t.createElement(i),r=t.getElementsByTagName(i)[0],n.async=1,n.src=s,r.parentNode.insertBefore(n,r)}(window,document,"script","//www.google-analytics.com/analytics.js","ga"),ga("create","UA-40881672-11","auto"),ga("send","pageview"));
|
"document"in self&&("classList"in document.createElement("_")?!function(){"use strict";var e=document.createElement("_");if(e.classList.add("c1","c2"),!e.classList.contains("c2")){var t=function(e){var t=DOMTokenList.prototype[e];DOMTokenList.prototype[e]=function(e){var i,s=arguments.length;for(i=0;i<s;i++)e=arguments[i],t.call(this,e)}};t("add"),t("remove")}if(e.classList.toggle("c3",!1),e.classList.contains("c3")){var i=DOMTokenList.prototype.toggle;DOMTokenList.prototype.toggle=function(e,t){return 1 in arguments&&!this.contains(e)==!t?t:i.call(this,e)}}e=null}():!function(e){"use strict";if("Element"in e){var t="classList",i="prototype",s=e.Element[i],o=Object,n=String[i].trim||function(){return this.replace(/^\s+|\s+$/g,"")},r=Array[i].indexOf||function(e){for(var t=0,i=this.length;t<i;t++)if(t in this&&this[t]===e)return t;return-1},a=function(e,t){this.name=e,this.code=DOMException[e],this.message=t},c=function(e,t){if(""===t)throw new a("SYNTAX_ERR","An invalid or illegal string was specified");if(/\s/.test(t))throw new a("INVALID_CHARACTER_ERR","String contains an invalid character");return r.call(e,t)},l=function(e){for(var t=n.call(e.getAttribute("class")||""),i=t?t.split(/\s+/):[],s=0,o=i.length;s<o;s++)this.push(i[s]);this._updateClassName=function(){e.setAttribute("class",this.toString())}},u=l[i]=[],d=function(){return new l(this)};if(a[i]=Error[i],u.item=function(e){return this[e]||null},u.contains=function(e){return e+="",c(this,e)!==-1},u.add=function(){var e,t=arguments,i=0,s=t.length,o=!1;do e=t[i]+"",c(this,e)===-1&&(this.push(e),o=!0);while(++i<s);o&&this._updateClassName()},u.remove=function(){var e,t,i=arguments,s=0,o=i.length,n=!1;do for(e=i[s]+"",t=c(this,e);t!==-1;)this.splice(t,1),n=!0,t=c(this,e);while(++s<o);n&&this._updateClassName()},u.toggle=function(e,t){e+="";var i=this.contains(e),s=i?t!==!0&&"remove":t!==!1&&"add";return s&&this[s](e),t===!0||t===!1?t:!i},u.toString=function(){return this.join(" ")},o.defineProperty){var p={get:d,enumerable:!0,configurable:!0};try{o.defineProperty(s,t,p)}catch(e){e.number===-2146823252&&(p.enumerable=!1,o.defineProperty(s,t,p))}}else o[i].__defineGetter__&&s.__defineGetter__(t,d)}}(self)),function(){function e(e,t,i){if(e)if(e.classList)e.classList[i?"add":"remove"](t);else{var s=(" "+e.className+" ").replace(/\s+/g," ").replace(" "+t+" ","");e.className=s+(i?" "+t:"")}}function t(t,i){if(t in n&&(i||t!==r)&&(r.length||t!==n.video)){switch(t){case n.video:s.source({type:"video",title:"View From A Blue Moon",sources:[{src:"https://cdn.selz.com/plyr/1.5/View_From_A_Blue_Moon_Trailer-HD.mp4",type:"video/mp4"},{src:"https://cdn.selz.com/plyr/1.5/View_From_A_Blue_Moon_Trailer-HD.webm",type:"video/webm"}],poster:"https://cdn.selz.com/plyr/1.5/View_From_A_Blue_Moon_Trailer-HD.jpg",tracks:[{kind:"captions",label:"English",srclang:"en",src:"https://cdn.selz.com/plyr/1.5/View_From_A_Blue_Moon_Trailer-HD.en.vtt",default:!0}]});break;case n.audio:s.source({type:"audio",title:"Kishi Bashi – “It All Began With A Burst”",sources:[{src:"https://cdn.selz.com/plyr/1.5/Kishi_Bashi_-_It_All_Began_With_a_Burst.mp3",type:"audio/mp3"},{src:"https://cdn.selz.com/plyr/1.5/Kishi_Bashi_-_It_All_Began_With_a_Burst.ogg",type:"audio/ogg"}]});break;case n.youtube:s.source({type:"video",title:"View From A Blue Moon",sources:[{src:"bTqVqk7FSmY",type:"youtube"}]});break;case n.vimeo:s.source({type:"video",title:"View From A Blue Moon",sources:[{src:"143418951",type:"vimeo"}]})}r=t;for(var a=o.length-1;a>=0;a--)e(o[a].parentElement,"active",!1);e(document.querySelector('[data-source="'+t+'"]').parentElement,"active",!0)}}var i=plyr.setup({debug:!0,title:"Video demo",iconUrl:"../dist/plyr.svg",tooltips:{controls:!0},captions:{defaultActive:!0}});plyr.loadSprite("dist/demo.svg");for(var s=i[0],o=document.querySelectorAll("[data-source]"),n={video:"video",audio:"audio",youtube:"youtube",vimeo:"vimeo"},r=window.location.hash.replace("#",""),a=window.history&&window.history.pushState,c=o.length-1;c>=0;c--)o[c].addEventListener("click",function(){var e=this.getAttribute("data-source");t(e),a&&history.pushState({type:e},"","#"+e)});if(window.addEventListener("popstate",function(e){e.state&&"type"in e.state&&t(e.state.type)}),a){var l=!r.length;l&&(r=n.video),r in n&&history.replaceState({type:r},"",l?"":"#"+r),r!==n.video&&t(r,!0)}}(),document.domain.indexOf("plyr.io")>-1&&(!function(e,t,i,s,o,n,r){e.GoogleAnalyticsObject=o,e[o]=e[o]||function(){(e[o].q=e[o].q||[]).push(arguments)},e[o].l=1*new Date,n=t.createElement(i),r=t.getElementsByTagName(i)[0],n.async=1,n.src=s,r.parentNode.insertBefore(n,r)}(window,document,"script","//www.google-analytics.com/analytics.js","ga"),ga("create","UA-40881672-11","auto"),ga("send","pageview"));
|
@ -6,7 +6,7 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
|
||||||
<!-- Docs styles -->
|
<!-- Docs styles -->
|
||||||
<link rel="stylesheet" href="dist/docs.css">
|
<link rel="stylesheet" href="dist/demo.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<main>
|
<main>
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
<section>
|
<section>
|
||||||
<video poster="https://cdn.selz.com/plyr/1.5/View_From_A_Blue_Moon_Trailer-HD.jpg" controls crossorigin>
|
<video poster="https://cdn.selz.com/plyr/1.5/View_From_A_Blue_Moon_Trailer-HD.jpg?v1" controls crossorigin>
|
||||||
<!-- Video files -->
|
<!-- Video files -->
|
||||||
<source src="https://cdn.selz.com/plyr/1.5/View_From_A_Blue_Moon_Trailer-HD.mp4" type="video/mp4">
|
<source src="https://cdn.selz.com/plyr/1.5/View_From_A_Blue_Moon_Trailer-HD.mp4" type="video/mp4">
|
||||||
<source src="https://cdn.selz.com/plyr/1.5/View_From_A_Blue_Moon_Trailer-HD.webm" type="video/webm">
|
<source src="https://cdn.selz.com/plyr/1.5/View_From_A_Blue_Moon_Trailer-HD.webm" type="video/webm">
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
// General functions
|
// General functions
|
||||||
;(function() {
|
;(function() {
|
||||||
//document.body.addEventListener('ready', function(event) { console.log(event); });
|
//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,
|
||||||
@ -94,7 +94,7 @@
|
|||||||
// Set a new source
|
// Set a new source
|
||||||
function newSource(type, init) {
|
function newSource(type, init) {
|
||||||
// Bail if new type isn't known, it's the current type, or current type is empty (video is default) and new type is video
|
// Bail if new type isn't known, it's the current type, or current type is empty (video is default) and new type is video
|
||||||
if(!(type in types) || (!init && type == currentType) || (!currentType.length && type == types.video)) {
|
if(!(type in types) || (!init && type === currentType) || (!currentType.length && type === types.video)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
16
gulpfile.js
16
gulpfile.js
@ -245,15 +245,15 @@ options = {
|
|||||||
// If aws is setup
|
// If aws is setup
|
||||||
if("cdn" in aws) {
|
if("cdn" in aws) {
|
||||||
var regex = "(?:0|[1-9][0-9]*)\\.(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)(?:-[\\da-z\\-]+(?:\.[\\da-z\\-]+)*)?(?:\\+[\\da-z\\-]+(?:\.[\\da-z\\-]+)*)?",
|
var regex = "(?:0|[1-9][0-9]*)\\.(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)(?:-[\\da-z\\-]+(?:\.[\\da-z\\-]+)*)?(?:\\+[\\da-z\\-]+(?:\.[\\da-z\\-]+)*)?",
|
||||||
cdnpath = new RegExp(aws.cdn.bucket + "\/" + regex, "gi"),
|
cdnpath = new RegExp(aws.cdn.domain + "\/" + regex, "gi"),
|
||||||
semver = new RegExp("v" + regex, "gi"),
|
semver = new RegExp("v" + regex, "gi"),
|
||||||
localPath = new RegExp("(\.\.\/)?dist", "gi"),
|
localPath = new RegExp("(\.\.\/)?dist", "gi"),
|
||||||
versionPath = "https://" + aws.cdn.bucket + "/" + version;
|
versionPath = "https://" + aws.cdn.domain + "/" + version;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Publish version to CDN bucket
|
// Publish version to CDN bucket
|
||||||
gulp.task("cdn", function () {
|
gulp.task("cdn", function () {
|
||||||
console.log("Uploading " + version + " to " + aws.cdn.bucket + "...");
|
console.log("Uploading " + version + " to " + aws.cdn.domain + "...");
|
||||||
|
|
||||||
// Upload to CDN
|
// Upload to CDN
|
||||||
return gulp.src(paths.upload)
|
return gulp.src(paths.upload)
|
||||||
@ -270,17 +270,17 @@ gulp.task("cdn", function () {
|
|||||||
|
|
||||||
// Publish to demo bucket
|
// Publish to demo bucket
|
||||||
gulp.task("demo", function () {
|
gulp.task("demo", function () {
|
||||||
console.log("Uploading " + version + " demo to " + aws.demo.bucket + "...");
|
console.log("Uploading " + version + " demo to " + aws.demo.domain + "...");
|
||||||
|
|
||||||
// Replace versioned files in readme.md
|
// Replace versioned files in readme.md
|
||||||
gulp.src([root + "/readme.md"])
|
gulp.src([root + "/readme.md"])
|
||||||
.pipe(replace(cdnpath, aws.cdn.bucket + "/" + version))
|
.pipe(replace(cdnpath, aws.cdn.domain + "/" + version))
|
||||||
.pipe(gulp.dest(root));
|
.pipe(gulp.dest(root));
|
||||||
|
|
||||||
// Replace versioned files in plyr.js
|
// Replace versioned files in plyr.js
|
||||||
gulp.src(path.join(root, "src/js/plyr.js"))
|
gulp.src(path.join(root, "src/js/plyr.js"))
|
||||||
.pipe(replace(semver, "v" + version))
|
.pipe(replace(semver, "v" + version))
|
||||||
.pipe(replace(cdnpath, aws.cdn.bucket + "/" + version))
|
.pipe(replace(cdnpath, aws.cdn.domain + "/" + version))
|
||||||
.pipe(gulp.dest(path.join(root, "src/js/")));
|
.pipe(gulp.dest(path.join(root, "src/js/")));
|
||||||
|
|
||||||
// Replace local file paths with remote paths in demo HTML
|
// Replace local file paths with remote paths in demo HTML
|
||||||
@ -320,14 +320,14 @@ gulp.task("symlinks", function () {
|
|||||||
|
|
||||||
// Open the demo site to check it's sweet
|
// Open the demo site to check it's sweet
|
||||||
gulp.task("open", function () {
|
gulp.task("open", function () {
|
||||||
console.log("Opening " + aws.demo.bucket + "...");
|
console.log("Opening " + aws.demo.domain + "...");
|
||||||
|
|
||||||
// A file must be specified or gulp will skip the task
|
// A file must be specified or gulp will skip the task
|
||||||
// Doesn't matter which file since we set the URL above
|
// Doesn't matter which file since we set the URL above
|
||||||
// Weird, I know...
|
// Weird, I know...
|
||||||
return gulp.src([paths.demo.root + "index.html"])
|
return gulp.src([paths.demo.root + "index.html"])
|
||||||
.pipe(open("", {
|
.pipe(open("", {
|
||||||
url: "http://" + aws.demo.bucket
|
url: "http://" + aws.demo.domain
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "plyr",
|
"name": "plyr",
|
||||||
"version": "2.0.1",
|
"version": "2.0.11",
|
||||||
"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",
|
||||||
|
112
readme.md
112
readme.md
@ -30,13 +30,23 @@ Oh and yes, it works with Bootstrap.
|
|||||||
## Changelog
|
## Changelog
|
||||||
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
|
## Features currently being developed
|
||||||
- Playback speed
|
- Playback speed selection
|
||||||
- Quality selection
|
- Quality selection
|
||||||
|
- Caption language selection
|
||||||
|
- AirPlay
|
||||||
|
- Picture in Picture (MacOS Sierra + Safari)
|
||||||
|
|
||||||
|
[more info](https://github.com/Selz/plyr/issues?q=is%3Aissue+is%3Aopen+label%3A%22In+Development%22)
|
||||||
|
|
||||||
|
## Planned features
|
||||||
- Playlists
|
- Playlists
|
||||||
- Multiple language captions (with selection)
|
- Google cast
|
||||||
|
- Facebook video support
|
||||||
|
- Wistia video support
|
||||||
|
- YouTube and Vimeo audio support
|
||||||
- Audio captions
|
- Audio captions
|
||||||
... and whatever else has been raised in [issues](https://github.com/Selz/plyr/issues)
|
...and whatever else has been raised in [issues](https://github.com/Selz/plyr/issues)
|
||||||
|
|
||||||
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.
|
||||||
|
|
||||||
@ -106,10 +116,13 @@ For YouTube and Vimeo, Plyr uses the standard YouTube API markup (an empty `<div
|
|||||||
<div data-type="youtube" data-video-id="bTqVqk7FSmY"></div>
|
<div data-type="youtube" data-video-id="bTqVqk7FSmY"></div>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Note: `data-video-id` value can now be the ID or URL for the video. This attribute name will change in a future release to reflect this change.
|
||||||
|
|
||||||
#### Vimeo embed
|
#### Vimeo embed
|
||||||
```html
|
```html
|
||||||
<div data-type="vimeo" data-video-id="143418951"></div>
|
<div data-type="vimeo" data-video-id="143418951"></div>
|
||||||
```
|
```
|
||||||
|
Note: `data-video-id` value can now be the ID or URL for the video. This attribute name will change in a future release to reflect this change.
|
||||||
|
|
||||||
### 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).
|
||||||
@ -119,10 +132,10 @@ Include the `plyr.js` script before the closing `</body>` tag and then call `ply
|
|||||||
<script>plyr.setup();</script>
|
<script>plyr.setup();</script>
|
||||||
```
|
```
|
||||||
|
|
||||||
If you want to use our CDN for the JavaScript, you can use the following:
|
If you want to use our CDN (provided by [Fastly](https://www.fastly.com/)) for the JavaScript, you can use the following:
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<script src="https://cdn.plyr.io/2.0.1/plyr.js"></script>
|
<script src="https://cdn.plyr.io/2.0.11/plyr.js"></script>
|
||||||
```
|
```
|
||||||
|
|
||||||
### CSS
|
### CSS
|
||||||
@ -132,14 +145,14 @@ Include the `plyr.css` stylsheet into your `<head>`
|
|||||||
<link rel="stylesheet" href="path/to/plyr.css">
|
<link rel="stylesheet" href="path/to/plyr.css">
|
||||||
```
|
```
|
||||||
|
|
||||||
If you want to use our CDN for the default CSS, you can use the following:
|
If you want to use our CDN (provided by [Fastly](https://www.fastly.com/)) for the default CSS, you can use the following:
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<link rel="stylesheet" href="https://cdn.plyr.io/2.0.1/plyr.css">
|
<link rel="stylesheet" href="https://cdn.plyr.io/2.0.11/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/2.0.1/plyr.svg`.
|
The SVG sprite is loaded automatically from our CDN (provided by [Fastly](https://www.fastly.com/)). 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.11/plyr.svg`.
|
||||||
|
|
||||||
## Advanced
|
## Advanced
|
||||||
|
|
||||||
@ -321,9 +334,9 @@ Note the single quotes encapsulating the JSON and double quotes on the object ke
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><code>keyboardShortcuts</code></td>
|
<td><code>keyboardShortcuts</code></td>
|
||||||
<td>Boolean</td>
|
<td>Object</td>
|
||||||
<td><code>true</code></td>
|
<td><code>{ focused: true, global: false }</code></td>
|
||||||
<td>Enable <a href="#shortcuts">keyboard shortcuts</a></td>
|
<td>Enable <a href="#shortcuts">keyboard shortcuts</a> for focused players only or globally as well (this will only work if there's one player in the document)</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><code>tooltips</code></td>
|
<td><code>tooltips</code></td>
|
||||||
@ -487,12 +500,12 @@ Here's a list of the methods supported:
|
|||||||
<tr>
|
<tr>
|
||||||
<td><code>isReady()</code></td>
|
<td><code>isReady()</code></td>
|
||||||
<td>—</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>
|
<td>Determine if the player is loaded and UI ready.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><code>on()</code></td>
|
<td><code>on()</code></td>
|
||||||
<td>String, Function</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>
|
<td>Watch for an event (first argument) and run a callback function (second argument). This saves you doing your own <code>addEventListner</code> code. This is chainable.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><code>play()</code></td>
|
<td><code>play()</code></td>
|
||||||
@ -529,6 +542,26 @@ Here's a list of the methods supported:
|
|||||||
<td>Number</td>
|
<td>Number</td>
|
||||||
<td>Seeks the media to the provided parameter, time in seconds.</td>
|
<td>Seeks the media to the provided parameter, time in seconds.</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><code>getCurrentTime()</code></td>
|
||||||
|
<td>—</td>
|
||||||
|
<td>Will return a float with the current time in seconds.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><code>getDuration()</code></td>
|
||||||
|
<td>—</td>
|
||||||
|
<td>Will return a float with the duration in seconds.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><code>getVolume()</code></td>
|
||||||
|
<td>—</td>
|
||||||
|
<td>Will return a float between 0 and 1 for the current volume level.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><code>isMuted()</code></td>
|
||||||
|
<td>—</td>
|
||||||
|
<td>Will return a boolean for whether the media is currently muted.</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><code>setVolume(...)</code></td>
|
<td><code>setVolume(...)</code></td>
|
||||||
<td>Number</td>
|
<td>Number</td>
|
||||||
@ -539,6 +572,11 @@ Here's a list of the methods supported:
|
|||||||
<td>Boolean</td>
|
<td>Boolean</td>
|
||||||
<td>Toggles playback for the player based on either the boolean argument or it's current state.</td>
|
<td>Toggles playback for the player based on either the boolean argument or it's current state.</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><code>isPaused()</code></td>
|
||||||
|
<td>—</td>
|
||||||
|
<td>Will return a boolean for whether the media is currently paused.</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><code>toggleMute()</code></td>
|
<td><code>toggleMute()</code></td>
|
||||||
<td>—</td>
|
<td>—</td>
|
||||||
@ -590,11 +628,6 @@ Here's a list of the methods supported:
|
|||||||
<td>—</td>
|
<td>—</td>
|
||||||
<td>Restores the original element, reversing the effects of <code>setup()</code>.</td>
|
<td>Restores the original element, reversing the effects of <code>setup()</code>.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
|
||||||
<td><code>getCurrentTime()</code></td>
|
|
||||||
<td>—</td>
|
|
||||||
<td>Will return a float with the current time in seconds.</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
@ -656,6 +689,8 @@ player.source({
|
|||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Note: `src` can be the video ID or URL
|
||||||
|
|
||||||
Vimeo example
|
Vimeo example
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
@ -669,7 +704,9 @@ player.source({
|
|||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
Some more details on the object parameters
|
Note: `src` can be the video ID or URL
|
||||||
|
|
||||||
|
More details on the object parameters
|
||||||
|
|
||||||
<table class="table" width="100%">
|
<table class="table" width="100%">
|
||||||
<thead>
|
<thead>
|
||||||
@ -693,7 +730,7 @@ Some more details on the object parameters
|
|||||||
<tr>
|
<tr>
|
||||||
<td><code>sources</code></td>
|
<td><code>sources</code></td>
|
||||||
<td>Array</td>
|
<td>Array</td>
|
||||||
<td>This is an array of sources. <code>type</code> is optional for YouTube and Vimeo when specifying an array. For YouTube and Vimeo media, only the video ID must be passed as the source as shown above. The keys of this object are mapped directly to HTML attributes so more can be added to the object if required.</td>
|
<td>This is an array of sources. <code>type</code> is optional for YouTube and Vimeo when specifying an array. For YouTube and Vimeo media, the video ID or URL must be passed as the source as shown above. The keys of this object are mapped directly to HTML attributes so more can be added to the object if required.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><code>poster</code></td>
|
<td><code>poster</code></td>
|
||||||
@ -736,7 +773,7 @@ These events also bubble up the DOM. The event target will be the container elem
|
|||||||
<tr>
|
<tr>
|
||||||
<td><code>ready</code></td>
|
<td><code>ready</code></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td>Triggered when the instance is ready for API use and external APIs are ready (YouTube and Vimeo).</td>
|
<td>Triggered when the instance is ready for API use and external APIs are ready (in the case of YouTube and Vimeo).</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><code>canplay</code></td>
|
<td><code>canplay</code></td>
|
||||||
@ -756,7 +793,7 @@ These events also bubble up the DOM. The event target will be the container elem
|
|||||||
<tr>
|
<tr>
|
||||||
<td><code>ended</code></td>
|
<td><code>ended</code></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td>Sent when playback completes.</td>
|
<td>Sent when playback completes. Note: with Vimeo this does not occur if `loop` is enabled.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><code>error</code></td>
|
<td><code>error</code></td>
|
||||||
@ -800,12 +837,12 @@ These events also bubble up the DOM. The event target will be the container elem
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><code>seeked</code></td>
|
<td><code>seeked</code></td>
|
||||||
<td>✔</td>
|
<td></td>
|
||||||
<td>Sent when a seek operation completes.</td>
|
<td>Sent when a seek operation completes.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><code>seeking</code></td>
|
<td><code>seeking</code></td>
|
||||||
<td>✔</td>
|
<td></td>
|
||||||
<td>Sent when a seek operation begins.</td>
|
<td>Sent when a seek operation begins.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -873,50 +910,65 @@ More info on the respective API's here:
|
|||||||
*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.
|
||||||
|
|
||||||
## Shortcuts
|
## Shortcuts
|
||||||
By default, a focused player will bind the following keyboard shortcuts:
|
By default, a player will bind the following keyboard shortcuts when it has focus. If you have the `global` option to `true` and there's only one player in the document then the shortcuts will work when any element has focus, apart from an element that requires input.
|
||||||
|
|
||||||
<table class="table" width="100%">
|
<table class="table" width="100%">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th width="25%">Key</th>
|
<th width="25%">Key</th>
|
||||||
<th width="75%">Action</th>
|
<th width="25%">Global</th>
|
||||||
|
<th width="50%">Action</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td><code>0</code> to <code>9</code></td>
|
<td><code>0</code> to <code>9</code></td>
|
||||||
|
<td>✔</td>
|
||||||
<td>Seek from 0 to 90% respectively</td>
|
<td>Seek from 0 to 90% respectively</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><code>space</code> or <code>K</code></td>
|
<td><code>space</code></td>
|
||||||
|
<td></td>
|
||||||
|
<td>Toggle playback</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><code>K</code></td>
|
||||||
|
<td>✔</td>
|
||||||
<td>Toggle playback</td>
|
<td>Toggle playback</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><code>←</code></td>
|
<td><code>←</code></td>
|
||||||
|
<td></td>
|
||||||
<td>Seek backward by the <code>seekTime</code> option</td>
|
<td>Seek backward by the <code>seekTime</code> option</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><code>→</code></td>
|
<td><code>→</code></td>
|
||||||
|
<td></td>
|
||||||
<td>Seek forward by the <code>seekTime</code> option</td>
|
<td>Seek forward by the <code>seekTime</code> option</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><code>↑</code></td>
|
<td><code>↑</code></td>
|
||||||
|
<td></td>
|
||||||
<td>Increase volume</td>
|
<td>Increase volume</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><code>↓</code></td>
|
<td><code>↓</code></td>
|
||||||
|
<td></td>
|
||||||
<td>Decrease volume</td>
|
<td>Decrease volume</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><code>M</code></td>
|
<td><code>M</code></td>
|
||||||
|
<td>✔</td>
|
||||||
<td>Toggle mute</td>
|
<td>Toggle mute</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><code>F</code></td>
|
<td><code>F</code></td>
|
||||||
|
<td>✔</td>
|
||||||
<td>Toggle fullscreen</td>
|
<td>Toggle fullscreen</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><code>C</code></td>
|
<td><code>C</code></td>
|
||||||
|
<td>✔</td>
|
||||||
<td>Toggle captions</td>
|
<td>Toggle captions</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
@ -1015,5 +1067,7 @@ Also these links helped created Plyr:
|
|||||||
- [Media Events - W3.org](http://www.w3.org/2010/05/video/mediaevents.html)
|
- [Media Events - W3.org](http://www.w3.org/2010/05/video/mediaevents.html)
|
||||||
- [Styling the `<progress>` element - hongkiat.com](http://www.hongkiat.com/blog/html5-progress-bar/)
|
- [Styling the `<progress>` element - hongkiat.com](http://www.hongkiat.com/blog/html5-progress-bar/)
|
||||||
|
|
||||||
|
Thanks to [Fastly](https://www.fastly.com/) for providing the CDN services.
|
||||||
|
|
||||||
## Copyright and License
|
## Copyright and License
|
||||||
[The MIT license](license.md).
|
[The MIT license](license.md).
|
||||||
|
616
src/js/plyr.js
616
src/js/plyr.js
File diff suppressed because it is too large
Load Diff
@ -61,14 +61,14 @@
|
|||||||
height: (@plyr-range-thumb-height * @plyr-range-thumb-active-scale);
|
height: (@plyr-range-thumb-height * @plyr-range-thumb-active-scale);
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
|
|
||||||
appearance: none;
|
appearance: none;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
border: none;
|
border: none;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
|
|
||||||
// WebKit
|
// WebKit
|
||||||
&::-webkit-slider-runnable-track {
|
&::-webkit-slider-runnable-track {
|
||||||
.plyr-range-track();
|
.plyr-range-track();
|
||||||
@ -86,7 +86,7 @@
|
|||||||
&::-moz-range-thumb {
|
&::-moz-range-thumb {
|
||||||
.plyr-range-thumb();
|
.plyr-range-thumb();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Microsoft
|
// Microsoft
|
||||||
&::-ms-track {
|
&::-ms-track {
|
||||||
height: @plyr-range-track-height;
|
height: @plyr-range-track-height;
|
||||||
@ -104,7 +104,7 @@
|
|||||||
&::-ms-thumb {
|
&::-ms-thumb {
|
||||||
.plyr-range-thumb();
|
.plyr-range-thumb();
|
||||||
// For some reason, Edge uses the -webkit margin above
|
// For some reason, Edge uses the -webkit margin above
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
&::-ms-tooltip {
|
&::-ms-tooltip {
|
||||||
display: none;
|
display: none;
|
||||||
@ -116,11 +116,11 @@
|
|||||||
}
|
}
|
||||||
&::-moz-focus-outer {
|
&::-moz-focus-outer {
|
||||||
border: 0;
|
border: 0;
|
||||||
}
|
}
|
||||||
&.tab-focus:focus {
|
&.tab-focus:focus {
|
||||||
outline-offset: 3px;
|
outline-offset: 3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pressed styles
|
// Pressed styles
|
||||||
&:active {
|
&:active {
|
||||||
&::-webkit-slider-thumb {
|
&::-webkit-slider-thumb {
|
||||||
@ -173,16 +173,17 @@
|
|||||||
position: relative;
|
position: relative;
|
||||||
background: #000;
|
background: #000;
|
||||||
border-radius: inherit;
|
border-radius: inherit;
|
||||||
|
|
||||||
// Cleaner radius, also forces iframe radius
|
|
||||||
-webkit-mask-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAA5JREFUeNpiYGBgAAgwAAAEAAGbA+oJAAAAAElFTkSuQmCC);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Container for embeds
|
// Container for embeds
|
||||||
.plyr__video-embed {
|
.plyr__video-embed {
|
||||||
padding-bottom: 56.25%; /* 16:9 */
|
padding-bottom: 56.25%; /* 16:9 */
|
||||||
height: 0;
|
height: 0;
|
||||||
|
border-radius: inherit;
|
||||||
|
|
||||||
|
// Require overflow and z-index to force border-radius
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
z-index: 0;
|
||||||
|
|
||||||
iframe {
|
iframe {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@ -244,12 +245,15 @@
|
|||||||
.plyr--captions-active .plyr__captions {
|
.plyr--captions-active .plyr__captions {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
.plyr--fullscreen-active .plyr__captions {
|
|
||||||
font-size: @plyr-font-size-captions-large;
|
|
||||||
}
|
|
||||||
.plyr--hide-controls .plyr__captions {
|
.plyr--hide-controls .plyr__captions {
|
||||||
transform: translateY(-(@plyr-control-spacing * 1.5));
|
transform: translateY(-(@plyr-control-spacing * 1.5));
|
||||||
}
|
}
|
||||||
|
// Large captions in full screen on larger screens
|
||||||
|
@media (min-width: @plyr-bp-screen-lg) {
|
||||||
|
.plyr--fullscreen-active .plyr__captions {
|
||||||
|
font-size: @plyr-font-size-captions-large;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Controls
|
// Controls
|
||||||
// --------------------------------------------------------------
|
// --------------------------------------------------------------
|
||||||
@ -261,7 +265,7 @@
|
|||||||
// Playback controls
|
// Playback controls
|
||||||
.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;
|
||||||
|
|
||||||
@ -325,7 +329,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Hide controls
|
// Hide controls
|
||||||
.plyr--hide-controls .plyr__controls {
|
.plyr--hide-controls .plyr__controls {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
@ -337,6 +341,7 @@
|
|||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
|
z-index: 2;
|
||||||
padding: (@plyr-control-spacing * 5) @plyr-control-spacing @plyr-control-spacing;
|
padding: (@plyr-control-spacing * 5) @plyr-control-spacing @plyr-control-spacing;
|
||||||
background: linear-gradient(fade(@plyr-video-controls-bg, 0%), fade(@plyr-video-controls-bg, 50%));
|
background: linear-gradient(fade(@plyr-video-controls-bg, 0%), fade(@plyr-video-controls-bg, 50%));
|
||||||
border-bottom-left-radius: inherit;
|
border-bottom-left-radius: inherit;
|
||||||
@ -472,7 +477,7 @@
|
|||||||
height: 0;
|
height: 0;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
transform: translateX(-50%);
|
transform: translateX(-50%);
|
||||||
|
|
||||||
// The background triangle
|
// The background triangle
|
||||||
bottom: -@plyr-tooltip-arrow-size;
|
bottom: -@plyr-tooltip-arrow-size;
|
||||||
border-right: @plyr-tooltip-arrow-size solid transparent;
|
border-right: @plyr-tooltip-arrow-size solid transparent;
|
||||||
@ -620,16 +625,16 @@
|
|||||||
}
|
}
|
||||||
&::-moz-progress-bar {
|
&::-moz-progress-bar {
|
||||||
transition: width .2s ease;
|
transition: width .2s ease;
|
||||||
}
|
}
|
||||||
&::-ms-fill {
|
&::-ms-fill {
|
||||||
transition: width .2s ease;
|
transition: width .2s ease;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.plyr--video .plyr__progress--buffer,
|
.plyr--video .plyr__progress--buffer,
|
||||||
.plyr--video .plyr__volume--display {
|
.plyr--video .plyr__volume--display {
|
||||||
background: @plyr-video-range-track-bg;
|
background: @plyr-video-range-track-bg;
|
||||||
}
|
}
|
||||||
.plyr--video .plyr__progress--buffer {
|
.plyr--video .plyr__progress--buffer {
|
||||||
color: @plyr-video-progress-buffered-bg;
|
color: @plyr-video-progress-buffered-bg;
|
||||||
}
|
}
|
||||||
.plyr--audio .plyr__progress--buffer,
|
.plyr--audio .plyr__progress--buffer,
|
||||||
@ -736,6 +741,10 @@
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
.plyr__video-embed {
|
||||||
|
// Revert overflow change
|
||||||
|
overflow: visible;
|
||||||
|
}
|
||||||
.plyr__controls {
|
.plyr__controls {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
|
@ -68,4 +68,5 @@
|
|||||||
|
|
||||||
// Breakpoints
|
// Breakpoints
|
||||||
@plyr-bp-screen-sm: 480px;
|
@plyr-bp-screen-sm: 480px;
|
||||||
@plyr-bp-screen-md: 768px;
|
@plyr-bp-screen-md: 768px;
|
||||||
|
@plyr-bp-screen-lg: 1024px;
|
@ -61,14 +61,14 @@
|
|||||||
height: ($plyr-range-thumb-height * $plyr-range-thumb-active-scale);
|
height: ($plyr-range-thumb-height * $plyr-range-thumb-active-scale);
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
|
|
||||||
appearance: none;
|
appearance: none;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
border: none;
|
border: none;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
|
|
||||||
// WebKit
|
// WebKit
|
||||||
&::-webkit-slider-runnable-track {
|
&::-webkit-slider-runnable-track {
|
||||||
@include plyr-range-track();
|
@include plyr-range-track();
|
||||||
@ -86,7 +86,7 @@
|
|||||||
&::-moz-range-thumb {
|
&::-moz-range-thumb {
|
||||||
@include plyr-range-thumb();
|
@include plyr-range-thumb();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Microsoft
|
// Microsoft
|
||||||
&::-ms-track {
|
&::-ms-track {
|
||||||
height: $plyr-range-track-height;
|
height: $plyr-range-track-height;
|
||||||
@ -104,7 +104,7 @@
|
|||||||
&::-ms-thumb {
|
&::-ms-thumb {
|
||||||
@include plyr-range-thumb();
|
@include plyr-range-thumb();
|
||||||
// For some reason, Edge uses the -webkit margin above
|
// For some reason, Edge uses the -webkit margin above
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
&::-ms-tooltip {
|
&::-ms-tooltip {
|
||||||
display: none;
|
display: none;
|
||||||
@ -116,11 +116,11 @@
|
|||||||
}
|
}
|
||||||
&::-moz-focus-outer {
|
&::-moz-focus-outer {
|
||||||
border: 0;
|
border: 0;
|
||||||
}
|
}
|
||||||
&.tab-focus:focus {
|
&.tab-focus:focus {
|
||||||
outline-offset: 3px;
|
outline-offset: 3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pressed styles
|
// Pressed styles
|
||||||
&:active {
|
&:active {
|
||||||
&::-webkit-slider-thumb {
|
&::-webkit-slider-thumb {
|
||||||
@ -172,18 +172,18 @@
|
|||||||
position: relative;
|
position: relative;
|
||||||
background: #000;
|
background: #000;
|
||||||
border-radius: inherit;
|
border-radius: inherit;
|
||||||
|
|
||||||
// Cleaner radius, also forces iframe radius
|
|
||||||
-webkit-mask-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAA5JREFUeNpiYGBgAAgwAAAEAAGbA+oJAAAAAElFTkSuQmCC);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Container for embeds
|
// Container for embeds
|
||||||
.plyr__video-embed {
|
.plyr__video-embed {
|
||||||
padding-bottom: 56.25%; /* 16:9 */
|
padding-bottom: 56.25%; /* 16:9 */
|
||||||
height: 0;
|
height: 0;
|
||||||
overflow: hidden;
|
|
||||||
border-radius: inherit;
|
border-radius: inherit;
|
||||||
|
|
||||||
|
// Require overflow and z-index to force border-radius
|
||||||
|
overflow: hidden;
|
||||||
|
z-index: 0;
|
||||||
|
|
||||||
iframe {
|
iframe {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
@ -244,12 +244,15 @@
|
|||||||
.plyr--captions-active .plyr__captions {
|
.plyr--captions-active .plyr__captions {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
.plyr--fullscreen-active .plyr__captions {
|
|
||||||
font-size: $plyr-font-size-captions-large;
|
|
||||||
}
|
|
||||||
.plyr--hide-controls .plyr__captions {
|
.plyr--hide-controls .plyr__captions {
|
||||||
transform: translateY(-($plyr-control-spacing * 2));
|
transform: translateY(-($plyr-control-spacing * 2));
|
||||||
}
|
}
|
||||||
|
// Large captions in full screen on larger screens
|
||||||
|
@media (min-width: $plyr-bp-screen-lg) {
|
||||||
|
.plyr--fullscreen-active .plyr__captions {
|
||||||
|
font-size: $plyr-font-size-captions-large;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Controls
|
// Controls
|
||||||
// --------------------------------------------------------------
|
// --------------------------------------------------------------
|
||||||
@ -261,7 +264,7 @@
|
|||||||
// Playback controls
|
// Playback controls
|
||||||
.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;
|
||||||
|
|
||||||
@ -325,7 +328,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Hide controls
|
// Hide controls
|
||||||
.plyr--hide-controls .plyr__controls {
|
.plyr--hide-controls .plyr__controls {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
@ -472,7 +475,7 @@
|
|||||||
height: 0;
|
height: 0;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
transform: translateX(-50%);
|
transform: translateX(-50%);
|
||||||
|
|
||||||
// The background triangle
|
// The background triangle
|
||||||
bottom: -$plyr-tooltip-arrow-size;
|
bottom: -$plyr-tooltip-arrow-size;
|
||||||
border-right: $plyr-tooltip-arrow-size solid transparent;
|
border-right: $plyr-tooltip-arrow-size solid transparent;
|
||||||
@ -619,16 +622,16 @@
|
|||||||
}
|
}
|
||||||
&::-moz-progress-bar {
|
&::-moz-progress-bar {
|
||||||
transition: width .2s ease;
|
transition: width .2s ease;
|
||||||
}
|
}
|
||||||
&::-ms-fill {
|
&::-ms-fill {
|
||||||
transition: width .2s ease;
|
transition: width .2s ease;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.plyr--video .plyr__progress--buffer,
|
.plyr--video .plyr__progress--buffer,
|
||||||
.plyr--video .plyr__volume--display {
|
.plyr--video .plyr__volume--display {
|
||||||
background: $plyr-video-range-track-bg;
|
background: $plyr-video-range-track-bg;
|
||||||
}
|
}
|
||||||
.plyr--video .plyr__progress--buffer {
|
.plyr--video .plyr__progress--buffer {
|
||||||
color: $plyr-video-progress-buffered-bg;
|
color: $plyr-video-progress-buffered-bg;
|
||||||
}
|
}
|
||||||
.plyr--audio .plyr__progress--buffer,
|
.plyr--audio .plyr__progress--buffer,
|
||||||
@ -735,6 +738,10 @@
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
.plyr__video-embed {
|
||||||
|
// Revert overflow change
|
||||||
|
overflow: visible;
|
||||||
|
}
|
||||||
.plyr__controls {
|
.plyr__controls {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
|
@ -69,4 +69,5 @@ $plyr-range-selected-bg: $plyr-color-main !default;
|
|||||||
|
|
||||||
// Breakpoints
|
// Breakpoints
|
||||||
$plyr-bp-screen-sm: 480px !default;
|
$plyr-bp-screen-sm: 480px !default;
|
||||||
$plyr-bp-screen-md: 768px !default;
|
$plyr-bp-screen-md: 768px !default;
|
||||||
|
$plyr-bp-screen-lg: 1024px !default;
|
Reference in New Issue
Block a user