Compare commits

...

87 Commits

Author SHA1 Message Date
3c99357f06 Vimeo fixes + small bug fixes 2017-11-04 23:18:47 +11:00
a757acad15 Merge pull request #577 from brandon-pereira/master
fix for svg4everybody conflicting with plyr
2017-11-04 22:25:27 +11:00
7913cf837f Merge branch 'master' into master 2017-11-04 22:25:17 +11:00
e98d356ede Merge branch 'master' into master 2017-11-04 22:22:49 +11:00
c9c20345c0 Merge pull request #613 from vers-one/master
Fix for handling explicitly set duration of audio
2017-11-04 22:19:47 +11:00
aca06be7ac Merge branch 'master' into master 2017-11-04 22:19:39 +11:00
550cc6a19b Merge branch 'master' into master 2017-11-04 22:19:17 +11:00
e44e93c117 Merge pull request #617 from oemueller/patch-1
[bugfix] target is null exception
2017-11-04 22:17:00 +11:00
a06a8150ef Merge pull request #649 from waltercruz/master
Adding title to the player html template
2017-11-04 22:16:28 +11:00
e787934ee6 Merge branch 'master' into master 2017-11-04 22:16:16 +11:00
be4b5ef4db Merge branch 'master' into master 2017-11-04 22:14:55 +11:00
55c5b8b07e Typo 2017-11-04 21:32:19 +11:00
a924d40620 Merge pull request #654 from jjui/patch-1
Enable start/stop toggle on whole element
2017-11-04 21:29:25 +11:00
0074e77a7c Update plyr.scss 2017-11-04 21:28:38 +11:00
f3141690ee Update plyr.less 2017-11-04 21:28:17 +11:00
7ac5b0e18b Merge pull request #678 from StudyTube/use-url-as-input-for-vimeo-player
Add URL as a possible input option to Vimeo player
2017-11-04 21:24:55 +11:00
5abf7e9535 Merge pull request #703 from gurupras/early-listener-fix
Allow Plyr.setup event listeners to be set up as separate event listeners
2017-11-04 18:15:03 +11:00
650ee2c18f Merge pull request #700 from ashkanhosseini/master
fix #684 memory leaks issues after destroy.
2017-11-04 18:11:35 +11:00
95734cf7cc Allow setup event listeners to be set up as separate event listeners
rather than in-conjunction with defaultListener

This allows the setup listeners to do things like
preventDefault()/stopImmediatePropagation() and have them work
2017-11-01 04:15:03 -04:00
7234e2f5a3 fix #684 memory leaks issues after destroy. 2017-10-28 00:09:40 +03:00
1b3a6b340d Add URL as a possible input option to Vimeo player
This is reasonable to processing correctly private Vimeo links, like https://vimeo.com/25345658/fe46e209ac - that contain not only vimeo id, but also private key
2017-10-06 14:41:57 +03:00
b3759e966d Version bump 2017-10-05 22:47:27 +11:00
34172b9aee Fullscreen bug fix (fixes #664) 2017-10-05 22:46:48 +11:00
a21ffe983c Demo fixes 2017-10-02 14:52:31 +11:00
9fb79f29fd Readme fix 2017-10-02 14:25:14 +11:00
032d73408f CDN URL updates 2017-10-02 14:18:44 +11:00
J
72412d26a5 Update plyr.less 2017-09-09 13:31:39 +02:00
J
bf02c69daa Enable start/stop toggle on whole element
Related to issue https://github.com/sampotts/plyr/issues/587
2017-09-09 13:25:22 +02:00
01f50f03f1 dding title to the player html template (build) 2017-08-28 10:32:56 -03:00
f50f0eb63d Adding title to the player html template 2017-08-28 10:19:29 -03:00
3fe0c7c84b Update readme.md 2017-08-13 21:07:22 +10:00
b114a6f42e [bugfix] target is null exception
when using 'play-large' without a 'play' button, the statement target = target[0]; caused an error. So it is necessary to check the value of target before accessing [0]
2017-07-12 22:17:25 +02:00
d0ceefe827 Gulp build 2017-07-06 23:41:34 -04:00
e756664750 Fix for https://github.com/sampotts/plyr/issues/601 2017-07-06 23:28:31 -04:00
6828bc00f8 Delete notes.md 2017-05-16 10:31:07 +10:00
e95c81cc5b Update bower.json 2017-05-16 10:17:57 +10:00
c0eee58732 Plugin versions 2017-05-16 10:14:01 +10:00
bcf88cd024 Vimeo demo bug fix + repo move 2017-05-16 10:08:59 +10:00
d27a0b3855 updated to check for global namespace 2017-05-01 16:53:54 -06:00
a575aa25ac fix for svg4everybody conflicting with plyr 2017-05-01 15:50:54 -06:00
4957e4d80c Version bump to 2.0.12 2017-03-25 10:58:41 +11:00
605f8a8249 Changelog update 2017-03-25 10:57:52 +11:00
7490a7e7f3 Merge pull request #468 from jronallo/captions-listener
allow for setting additional listener for captions
2017-03-25 10:51:54 +11:00
f32527feb4 Merge pull request #504 from ShimShamSam/master
Add blankUrl option to set the URL for blank.mp4
2017-03-25 10:50:55 +11:00
a971850d26 Update readme.md 2017-03-09 15:35:29 +11:00
382397407f Generated dist files 2017-02-12 00:15:21 -05:00
82809235b9 Documented the blankUrl option 2017-02-11 23:59:14 -05:00
7d5c507f16 Allow configuration of the blank.mp4 URL
This is useful for people behind firewalls who need to host a blank mp4 themselves.
2017-02-11 23:50:49 -05:00
bc139f16a7 Update readme.md 2017-02-10 11:21:20 +11:00
f6f3284dc5 Update readme.md 2017-02-10 11:19:37 +11:00
f4d2f1856f Update readme.md 2017-02-09 23:38:52 +11:00
871e19ed92 Update readme.md 2017-02-09 23:37:29 +11:00
72998c4c41 Merge pull request #437 from tv2/playground
Fixed typo
2017-01-10 20:21:01 +11:00
da48be495b Merge pull request #477 from iamrobert/patch-1
Update index.html
2017-01-10 14:51:40 +11:00
c843ed3460 Update index.html
Just missing the closing </li>
2017-01-10 11:50:26 +08:00
4232aa9ea4 Update issue_template.md 2017-01-10 09:47:46 +11:00
f6612fa78c Update issue_template.md 2017-01-10 09:45:41 +11:00
96ae866baa allow for setting additional listener for captions 2016-12-26 17:06:59 -05:00
a1d5bccac2 Fixed typo 2016-11-30 08:54:24 +01:00
a9bb8afca4 v2.0.11 2016-11-27 20:18:30 +11:00
28cd92b708 Merge branch 'master' of https://github.com/Selz/plyr 2016-11-27 20:15:19 +11:00
a44c7ecc3a Fix for iPad and YouTube issues 2016-11-27 20:15:15 +11:00
5214c5d55d Merge pull request #425 from sebastiancarlsson/cleanup-called-twice-bug
fixes bug where cleanUp would be called twice
2016-11-18 09:40:34 +11:00
3e6ed7b69b fixes bug where cleanUp would be called twice 2016-11-17 15:43:26 +01:00
7d2a8d343a Update 2016-11-16 09:41:06 +11:00
03aacf483f Update readme.md 2016-11-16 09:40:09 +11:00
73a1391f2f Update readme.md 2016-11-02 18:45:37 +11:00
660ff0434d Cache bust 2016-11-02 18:29:38 +11:00
94208dce76 v2.0.10
- Added seek event fixes for Vimeo and YouTube (fixes #409)
- Added support for embed URLs rather than ID only (fixes #345)
2016-11-02 18:14:06 +11:00
efe54fbba4 Added seek event fixes (fixes #409), Added support for URLs (fixes #345) 2016-11-02 18:09:40 +11:00
10561d6c83 Merge pull request #408 from gurupras/urlparser
Added logic to parse youtube video id
2016-11-02 16:59:28 +11:00
0ef87f93a6 Added logic to parse youtube video id
This commit is targetted at solving issue#345 and adds
    functionality to parse youtube video IDs from various
    types of youtube video URLs.

    Other embed types like vimeo/soundcloud can be extended by
    following a similar structure as implemented in this commit.
2016-10-30 00:49:17 -04:00
a3ed309342 v2.0.9
- Temporary patch for the YouTube API issues with `getDuration()` (relates to #374)
2016-10-23 15:18:53 +11:00
08b4c09b89 Temporary patch for the YouTube API issues with getDuration() (relates to #374) 2016-10-23 15:18:08 +11:00
a509a5e1bc 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
2016-10-23 13:48:05 +11:00
bec10e7836 Fix for caption size (fixes #390), Fix for Firefox Dev (fixes #392) 2016-10-23 13:35:49 +11:00
f9a184800b Add Issue and PR templates 2016-10-23 13:34:44 +11:00
f428c3ff8b Manually merged #395 2016-10-23 12:19:39 +11:00
97eb40a8e3 Merge pull request #389 from darrena092/master
Added .isPaused().
2016-10-23 11:51:10 +11:00
8211631950 Gulp build done. 2016-10-06 15:43:41 +01:00
a17cbb0e8b Added .isPaused to API 2016-10-06 15:33:49 +01:00
8098be6f93 Merge pull request #379 from magourex/master
Support WebVTT with CRLF or LF Line separator with firefox #378
2016-10-01 22:10:35 +10:00
1c73c9fbfe Update plyr.js 2016-09-27 10:57:35 +02:00
978606edb4 CSS path 2016-09-06 23:54:04 +10:00
Sam
435b5c74bf Fixed API method, added new methods (fixes #346, #351)
- Fixed `getCurrentTime()` method (fixes #351)
- Added `getVolume()` , `isMuted()` and `getDuration()` API methods (fixes #346)
2016-08-29 23:36:43 +10:00
Sam
15fd7041ab Fixed AMD definition 2016-08-26 21:43:51 +10:00
1ced6b4d67 Vimeo IE9/10 (Fixes #348), HTML5 ready event (Fixes #349) 2016-08-26 18:15:24 +10:00
26 changed files with 6317 additions and 1268 deletions

28
.github/issue_template.md vendored Normal file
View File

@ -0,0 +1,28 @@
<!---
Please use this issue template as it makes replicating and fixing the issue easier!
--->
- [ ] Issue does not already exist
- [ ] Issue observed on https://plyr.io
### Expected behaviour
### Actual behaviour
### Environment
- Browser:
- Version:
- Operating System:
- Version:
Players affected:
- [ ] HTML5 Video
- [ ] HTML5 Audio
- [ ] YouTube
- [ ] Vimeo
### Steps to reproduce
-
### Relevant links

8
.github/pull_request_template.md vendored Normal file
View File

@ -0,0 +1,8 @@
### Link to related issue (if applicable)
### Sumary of proposed changes
### Task list
- [ ] Tested on [supported browsers](https://github.com/sampotts/plyr#browser-support)
- [ ] Gulp build completed

11
.jsbeautifyrc Normal file
View File

@ -0,0 +1,11 @@
{
"html": {
"allowed_file_extensions": []
},
"css": {
"allowed_file_extensions": []
},
"js": {
"allowed_file_extensions": []
}
}

View File

2
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,2 @@
{
}

View File

@ -9,7 +9,7 @@
"HTml5 Video"
],
"authors": [
"Sam Potts <me@sampotts.me>"
"Sam Potts <sam@potts.es>"
],
"dependencies": {},
"main": [
@ -27,7 +27,7 @@
],
"repository": {
"type": "git",
"url": "git://github.com/selz/plyr.git"
"url": "git://github.com/sampotts/plyr.git"
},
"license": "MIT"
}

View File

@ -1,24 +1,79 @@
# Changelog
## v2.0.17
- Vimeo controls fix (fixes #697)
- SVG4everybody compatibility fix
- Allow Plyr.setup event listeners to be set up as separate event listeners (https://github.com/sampotts/plyr/pull/703)
- Added title to the layer html template (for custom controls) (https://github.com/sampotts/plyr/pull/649)
- Target is null bug fix (https://github.com/sampotts/plyr/pull/617)
- fix #684 memory leaks issues after destroy (https://github.com/sampotts/plyr/pull/700)
## v2.0.16
- Fullscreen bug fix (fixes #664)
## v2.0.15
- Demo fix
## v2.0.14
- CDN URL updates. Sorry, still working on V3 as hard as I can...
## v2.0.13
- Repo moved and Vimeo demo fix
## v2.0.12
- Ability to set custom `blankUrl` for source changes (https://github.com/sampotts/plyr/pull/504)
- Ability to set caption button listener (https://github.com/sampotts/plyr/pull/468)
## v2.0.11
- 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.
- 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
- Version bump for NPM (sorry for folks who upgraded to the now deleted v1.9.0 through NPM)
# 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 ;-)
- 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:
@ -48,7 +103,7 @@ And some other changes and bug fixes:
## v1.8.11
- 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
- Fix for YouTube bug introduced in v1.8.9
- Added support for passing array to .setup() (Fixes #319)
@ -88,20 +143,20 @@ And some other changes and bug fixes:
- Improvements for controls hiding and showing on touch devices
## v1.8.2
- Fixed event bubbling
- 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)
- Fixed using a relative URL for `iconUrl` in IE (fixes #269)
# v1.7.0
- SASS cleanup (fixes #265)
- Docs tidy up to help quick start (fixes #253)
- 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
## v1.6.20
@ -131,7 +186,7 @@ And some other changes and bug fixes:
- Decreased sensitivity and inverted scroll on volume slider (scroll up to increase, down to decrease)
## v1.6.12
- Fix for undefined buffer error
- Fix for undefined buffer error
- Add scroll listener on volume slider (PR #227 bty @igoradamenko)
## v1.6.11
@ -173,13 +228,13 @@ And some other changes and bug fixes:
- Other minor bug fixes
## v1.6.1
- Tooltip changes for accessibility
- Tooltip changes for accessibility
## v1.6.0
- New, cleaner, UI:
- Controls are now overlaid, maintaining the video's ratio and making sizing easier
- 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
- 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

View File

@ -37,6 +37,7 @@ You need to add several placeholders to your html template that are replaced whe
- `{id}` - the dynamically generated ID for the player (for form controls)
- `{seektime}` - the seek time specified in options for fast forward and rewind
- `{title}` - the title of your media, if specified
You can include only the controls you need when specifying custom html.

2
demo/dist/demo.css vendored

File diff suppressed because one or more lines are too long

2
demo/dist/demo.js vendored
View File

@ -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 &ndash; &ldquo;It All Began With A Burst&rdquo;",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 t=document.createElement("_");if(t.classList.add("c1","c2"),!t.classList.contains("c2")){var e=function(t){var e=DOMTokenList.prototype[t];DOMTokenList.prototype[t]=function(t){var i,o=arguments.length;for(i=0;i<o;i++)t=arguments[i],e.call(this,t)}};e("add"),e("remove")}if(t.classList.toggle("c3",!1),t.classList.contains("c3")){var i=DOMTokenList.prototype.toggle;DOMTokenList.prototype.toggle=function(t,e){return 1 in arguments&&!this.contains(t)==!e?e:i.call(this,t)}}t=null}():function(t){"use strict";if("Element"in t){var e=t.Element.prototype,i=Object,o=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")},s=Array.prototype.indexOf||function(t){for(var e=0,i=this.length;e<i;e++)if(e in this&&this[e]===t)return e;return-1},n=function(t,e){this.name=t,this.code=DOMException[t],this.message=e},r=function(t,e){if(""===e)throw new n("SYNTAX_ERR","An invalid or illegal string was specified");if(/\s/.test(e))throw new n("INVALID_CHARACTER_ERR","String contains an invalid character");return s.call(t,e)},a=function(t){for(var e=o.call(t.getAttribute("class")||""),i=e?e.split(/\s+/):[],s=0,n=i.length;s<n;s++)this.push(i[s]);this._updateClassName=function(){t.setAttribute("class",this.toString())}},c=a.prototype=[],l=function(){return new a(this)};if(n.prototype=Error.prototype,c.item=function(t){return this[t]||null},c.contains=function(t){return t+="",-1!==r(this,t)},c.add=function(){var t,e=arguments,i=0,o=e.length,s=!1;do{t=e[i]+"",-1===r(this,t)&&(this.push(t),s=!0)}while(++i<o);s&&this._updateClassName()},c.remove=function(){var t,e,i=arguments,o=0,s=i.length,n=!1;do{for(t=i[o]+"",e=r(this,t);-1!==e;)this.splice(e,1),n=!0,e=r(this,t)}while(++o<s);n&&this._updateClassName()},c.toggle=function(t,e){t+="";var i=this.contains(t),o=i?!0!==e&&"remove":!1!==e&&"add";return o&&this[o](t),!0===e||!1===e?e:!i},c.toString=function(){return this.join(" ")},i.defineProperty){var u={get:l,enumerable:!0,configurable:!0};try{i.defineProperty(e,"classList",u)}catch(t){-2146823252===t.number&&(u.enumerable=!1,i.defineProperty(e,"classList",u))}}else i.prototype.__defineGetter__&&e.__defineGetter__("classList",l)}}(self)),function(){function t(t,e,i){if(t)if(t.classList)t.classList[i?"add":"remove"](e);else{var o=(" "+t.className+" ").replace(/\s+/g," ").replace(" "+e+" ","");t.className=o+(i?" "+e:"")}}function e(e,i){if(e in n&&(i||e!==r)&&(r.length||e!==n.video)){switch(e){case n.video:o.source({type:"video",title:"View From A Blue Moon",sources:[{src:"https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.mp4",type:"video/mp4"},{src:"https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.webm",type:"video/webm"}],poster:"https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.jpg",tracks:[{kind:"captions",label:"English",srclang:"en",src:"https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.en.vtt",default:!0}]});break;case n.audio:o.source({type:"audio",title:"Kishi Bashi &ndash; &ldquo;It All Began With A Burst&rdquo;",sources:[{src:"https://cdn.plyr.io/static/demo/Kishi_Bashi_-_It_All_Began_With_a_Burst.mp3",type:"audio/mp3"},{src:"https://cdn.plyr.io/static/demo/Kishi_Bashi_-_It_All_Began_With_a_Burst.ogg",type:"audio/ogg"}]});break;case n.youtube:o.source({type:"video",title:"View From A Blue Moon",sources:[{src:"bTqVqk7FSmY",type:"youtube"}]});break;case n.vimeo:o.source({type:"video",title:"View From A Blue Moon",sources:[{src:"147865858",type:"vimeo"}]})}r=e;for(var a=s.length-1;a>=0;a--)t(s[a].parentElement,"active",!1);t(document.querySelector('[data-source="'+e+'"]').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 o=i[0],s=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=s.length-1;c>=0;c--)s[c].addEventListener("click",function(){var t=this.getAttribute("data-source");e(t),a&&history.pushState({type:t},"","#"+t)});if(window.addEventListener("popstate",function(t){t.state&&"type"in t.state&&e(t.state.type)}),a){var l=!r.length;l&&(r=n.video),r in n&&history.replaceState({type:r},"",l?"":"#"+r),r!==n.video&&e(r,!0)}}(),document.domain.indexOf("plyr.io")>-1&&(!function(t,e,i,o,s,n,r){t.GoogleAnalyticsObject=s,t.ga=t.ga||function(){(t.ga.q=t.ga.q||[]).push(arguments)},t.ga.l=1*new Date,n=e.createElement(i),r=e.getElementsByTagName(i)[0],n.async=1,n.src="//www.google-analytics.com/analytics.js",r.parentNode.insertBefore(n,r)}(window,document,"script",0,"ga"),ga("create","UA-40881672-11","auto"),ga("send","pageview"));

View File

@ -1,18 +1,25 @@
<!doctype html>
<html lang="en" class="error">
<head>
<meta charset="utf-8" />
<title>Doh. Looks like something went wrong.</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Docs styles -->
<link rel="stylesheet" href="dist/docs.css">
</head>
<body>
<main>
<h1>Doh.</h1>
<p>Looks like something went wrong.</p>
<a href="http://plyr.io" class="btn btn--primary">Back to plyr.io</a>
</main>
</body>
</html>
<head>
<meta charset="utf-8" />
<title>Doh. Looks like something went wrong.</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Docs styles -->
<link rel="stylesheet" href="dist/demo.css">
<!-- Preload -->
<link rel="preload" as="font" crossorigin type="font/woff2" href="https://cdn.plyr.io/static/fonts/avenir-medium.woff2">
<link rel="preload" as="font" crossorigin type="font/woff2" href="https://cdn.plyr.io/static/fonts/avenir-bold.woff2">
</head>
<body>
<main>
<h1>Doh.</h1>
<p>Looks like something went wrong.</p>
<a href="http://plyr.io" class="btn btn--primary">Back to plyr.io</a>
</main>
</body>
</html>

View File

@ -1,88 +1,103 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Plyr - A simple HTML5 media player</title>
<meta name="description" content="A simple HTML5 media player with custom controls and WebVTT captions.">
<meta name="author" content="Sam Potts">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Styles -->
<link rel="stylesheet" href="../dist/plyr.css">
<head>
<meta charset="utf-8" />
<title>Plyr - A simple HTML5 media player</title>
<meta name="description" content="A simple HTML5 media player with custom controls and WebVTT captions.">
<meta name="author" content="Sam Potts">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Docs styles -->
<link rel="stylesheet" href="dist/demo.css">
</head>
<body>
<header>
<h1>Plyr</h1>
<p>A simple, accessible HTML5 media player by <a href="https://twitter.com/sam_potts" target="_blank">@sam_potts</a> from <a href="https://twitter.com/selz" target="_blank">@selz</a></p>
<nav>
<ul>
<li>
<a href="https://github.com/selz/plyr" target="_blank" class="btn btn--large btn--primary" data-shr-network="github">
<svg class="icon"><use xlink:href="#icon-github"/></svg>Download on GitHub
</a>
</li>
<li>
<a href="https://twitter.com/intent/tweet?text=A+simple+HTML5+media+player+with+custom+controls+and+WebVTT+captions.&url=http%3A%2F%2Fplyr.io&via=Sam_Potts" target="_blank" class="btn btn--large btn--twitter" data-shr-network="twitter">
<svg class="icon"><use xlink:href="#icon-twitter"/></svg>Tweet
</a>
</li>
</ul>
</nav>
</header>
<!-- Styles -->
<link rel="stylesheet" href="../dist/plyr.css">
<main role="main" id="main">
<nav class="btn__bar">
<ul>
<li class="active">
<button type="button" class="btn" data-source="video">Video</button>
</li>
<li>
<button type="button" class="btn" data-source="audio">Audio</button>
</li>
<li>
<button type="button" class="btn btn--youtube" data-source="youtube"><svg class="icon"><use xlink:href="#icon-youtube"/></svg>YouTube</button>
</li>
<li>
<button type="button" class="btn btn--vimeo" data-source="vimeo"><svg class="icon"><use xlink:href="#icon-vimeo"/></svg>Vimeo</button>
</li>
</ul>
</nav>
<section>
<video poster="https://cdn.selz.com/plyr/1.5/View_From_A_Blue_Moon_Trailer-HD.jpg" controls crossorigin>
<!-- 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.webm" type="video/webm">
<!-- Docs styles -->
<link rel="stylesheet" href="dist/demo.css">
<!-- Text track file -->
<track kind="captions" label="English" srclang="en" src="https://cdn.selz.com/plyr/1.5/View_From_A_Blue_Moon_Trailer-HD.en.vtt" default>
<!-- Preload -->
<link rel="preload" as="font" crossorigin type="font/woff2" href="https://cdn.plyr.io/static/fonts/avenir-medium.woff2">
<link rel="preload" as="font" crossorigin type="font/woff2" href="https://cdn.plyr.io/static/fonts/avenir-bold.woff2">
</head>
<!-- Fallback for browsers that don't support the <video> element -->
<a href="https://cdn.selz.com/plyr/1.5/View_From_A_Blue_Moon_Trailer-HD.mp4" download>Download</a>
</video>
<body>
<header>
<h1>Plyr</h1>
<p>A simple, accessible HTML5 media player by <a href="https://twitter.com/sam_potts" target="_blank">@sam_potts</a></p>
<nav>
<ul>
<li>
<a href="https://github.com/sampotts/plyr" target="_blank" class="btn btn--large btn--primary" data-shr-network="github">
<svg class="icon">
<use xlink:href="#icon-github" />
</svg>Download on GitHub
</a>
</li>
<li>
<a href="https://twitter.com/intent/tweet?text=A+simple+HTML5+media+player+with+custom+controls+and+WebVTT+captions.&url=http%3A%2F%2Fplyr.io&via=Sam_Potts"
target="_blank" class="btn btn--large btn--twitter" data-shr-network="twitter">
<svg class="icon">
<use xlink:href="#icon-twitter" />
</svg>Tweet
</a>
</li>
</ul>
</nav>
</header>
<ul>
<li class="plyr__cite plyr__cite--video"><small><a href="http://viewfromabluemoon.com/" target="_blank">View From A Blue Moon</a> &copy; Brainfarm</small></li>
<li class="plyr__cite plyr__cite--audio"><small><a href="http://www.kishibashi.com/" target="_blank">Kishi Bashi &ndash; &ldquo;It All Began With A Burst&rdquo;</a> &copy; Kishi Bashi</small></li>
<li class="plyr__cite plyr__cite--youtube"><small><a href="https://www.youtube.com/watch?v=bTqVqk7FSmY" target="_blank">View From A Blue Moon</a> on <span class="color--youtube"><svg class="icon"><use xlink:href="#icon-youtube"/></svg>YouTube</span></small>
<li class="plyr__cite plyr__cite--vimeo"><small><a href="https://vimeo.com/ondemand/viewfromabluemoon4k" target="_blank">View From A Blue Moon</a> on <span class="color--vimeo"><svg class="icon"><use xlink:href="#icon-vimeo"/></svg>Vimeo</span></small>
</ul>
</section>
</main>
<main role="main" id="main">
<nav class="btn__bar">
<ul>
<li class="active">
<button type="button" class="btn" data-source="video">Video</button>
</li>
<li>
<button type="button" class="btn" data-source="audio">Audio</button>
</li>
<li>
<button type="button" class="btn btn--youtube" data-source="youtube"><svg class="icon"><use xlink:href="#icon-youtube"/></svg>YouTube</button>
</li>
<li>
<button type="button" class="btn btn--vimeo" data-source="vimeo"><svg class="icon"><use xlink:href="#icon-vimeo"/></svg>Vimeo</button>
</li>
</ul>
</nav>
<section>
<video poster="https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.jpg?v1" controls crossorigin>
<!-- Video files -->
<source src="https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.mp4" type="video/mp4">
<source src="https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.webm" type="video/webm">
<!-- Plyr core script -->
<script src="../dist/plyr.js"></script>
<!-- Text track file -->
<track kind="captions" label="English" srclang="en" src="https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.en.vtt"
default>
<!-- Docs script -->
<script src="dist/demo.js"></script>
<!-- Fallback for browsers that don't support the <video> element -->
<a href="https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.mp4" download>Download</a>
</video>
<!-- Rangetouch to fix <input type="range"> on touch devices (see https://rangetouch.com) -->
<script src="https://cdn.rangetouch.com/0.0.9/rangetouch.js" async></script>
<ul>
<li class="plyr__cite plyr__cite--video"><small><a href="http://viewfromabluemoon.com/" target="_blank">View From A Blue Moon</a> &copy; Brainfarm</small></li>
<li class="plyr__cite plyr__cite--audio"><small><a href="http://www.kishibashi.com/" target="_blank">Kishi Bashi &ndash; &ldquo;It All Began With A Burst&rdquo;</a> &copy; Kishi Bashi</small></li>
<li class="plyr__cite plyr__cite--youtube"><small><a href="https://www.youtube.com/watch?v=bTqVqk7FSmY" target="_blank">View From A Blue Moon</a> on <span class="color--youtube"><svg class="icon"><use xlink:href="#icon-youtube"/></svg>YouTube</span></small></li>
<li class="plyr__cite plyr__cite--vimeo"><small><a href="https://vimeo.com/ondemand/viewfromabluemoon4k" target="_blank">View From A Blue Moon</a> on <span class="color--vimeo"><svg class="icon"><use xlink:href="#icon-vimeo"/></svg>Vimeo</span></small></li>
</ul>
</section>
</main>
<!-- Sharing libary (https://shr.one) -->
<script src="https://cdn.shr.one/0.1.9/shr.js"></script>
<script>if(window.shr) { window.shr.setup({ count: { classname: 'btn__count' } }); }</script>
</body>
</html>
<!-- Plyr core script -->
<script src="../dist/plyr.js"></script>
<!-- Docs script -->
<script src="dist/demo.js"></script>
<!-- Rangetouch to fix <input type="range"> on touch devices (see https://rangetouch.com) -->
<script src="https://cdn.rangetouch.com/1.0.1/rangetouch.js" async></script>
<!-- Sharing libary (https://shr.one) -->
<script src="https://cdn.shr.one/1.0.1/shr.js"></script>
<script>
if (window.shr) { window.shr.setup({ count: { classname: 'btn__count' } }); }
</script>
</body>
</html>

View File

@ -7,73 +7,73 @@
/*global plyr*/
// General functions
;(function() {
(function() {
//document.body.addEventListener('ready', function(event) { console.log(event); });
// Setup the player
var instances = plyr.setup({
debug: true,
title: 'Video demo',
iconUrl: '../dist/plyr.svg',
debug: true,
title: "Video demo",
iconUrl: "../dist/plyr.svg",
tooltips: {
controls: true
controls: true
},
captions: {
defaultActive: true
defaultActive: true
}
});
plyr.loadSprite('dist/demo.svg');
plyr.loadSprite("dist/demo.svg");
// Plyr returns an array regardless
var player = instances[0];
// Setup type toggle
var buttons = document.querySelectorAll('[data-source]'),
var buttons = document.querySelectorAll("[data-source]"),
types = {
video: 'video',
audio: 'audio',
youtube: 'youtube',
vimeo: 'vimeo'
video: "video",
audio: "audio",
youtube: "youtube",
vimeo: "vimeo"
},
currentType = window.location.hash.replace('#', ''),
historySupport = (window.history && window.history.pushState);
currentType = window.location.hash.replace("#", ""),
historySupport = window.history && window.history.pushState;
// Bind to each button
for (var i = buttons.length - 1; i >= 0; i--) {
buttons[i].addEventListener('click', function() {
var type = this.getAttribute('data-source');
buttons[i].addEventListener("click", function() {
var type = this.getAttribute("data-source");
newSource(type);
if (historySupport) {
history.pushState({ 'type': type }, '', '#' + type);
history.pushState({ type: type }, "", "#" + type);
}
});
}
// List for backwards/forwards
window.addEventListener('popstate', function(event) {
if(event.state && 'type' in event.state) {
window.addEventListener("popstate", function(event) {
if (event.state && "type" in event.state) {
newSource(event.state.type);
}
});
// On load
if(historySupport) {
if (historySupport) {
var video = !currentType.length;
// If there's no current type set, assume video
if(video) {
if (video) {
currentType = types.video;
}
// Replace current history state
if(currentType in types) {
history.replaceState({ 'type': currentType }, '', (video ? '' : '#' + currentType));
if (currentType in types) {
history.replaceState({ type: currentType }, "", video ? "" : "#" + currentType);
}
// If it's not video, load the source
if(currentType !== types.video) {
if (currentType !== types.video) {
newSource(currentType, true);
}
}
@ -82,11 +82,10 @@
function toggleClass(element, className, state) {
if (element) {
if (element.classList) {
element.classList[state ? 'add' : 'remove'](className);
}
else {
var name = (' ' + element.className + ' ').replace(/\s+/g, ' ').replace(' ' + className + ' ', '');
element.className = name + (state ? ' ' + className : '');
element.classList[state ? "add" : "remove"](className);
} else {
var name = (" " + element.className + " ").replace(/\s+/g, " ").replace(" " + className + " ", "");
element.className = name + (state ? " " + className : "");
}
}
}
@ -94,68 +93,78 @@
// Set a new source
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
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;
}
switch(type) {
switch (type) {
case types.video:
player.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: true
}]
type: "video",
title: "View From A Blue Moon",
sources: [
{
src: "https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.mp4",
type: "video/mp4"
},
{
src: "https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.webm",
type: "video/webm"
}
],
poster: "https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.jpg",
tracks: [
{
kind: "captions",
label: "English",
srclang: "en",
src: "https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.en.vtt",
default: true
}
]
});
break;
case types.audio:
player.source({
type: 'audio',
title: 'Kishi Bashi &ndash; &ldquo;It All Began With A Burst&rdquo;',
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'
}]
type: "audio",
title: "Kishi Bashi &ndash; &ldquo;It All Began With A Burst&rdquo;",
sources: [
{
src: "https://cdn.plyr.io/static/demo/Kishi_Bashi_-_It_All_Began_With_a_Burst.mp3",
type: "audio/mp3"
},
{
src: "https://cdn.plyr.io/static/demo/Kishi_Bashi_-_It_All_Began_With_a_Burst.ogg",
type: "audio/ogg"
}
]
});
break;
case types.youtube:
player.source({
type: 'video',
title: 'View From A Blue Moon',
sources: [{
src: 'bTqVqk7FSmY',
type: 'youtube'
}]
type: "video",
title: "View From A Blue Moon",
sources: [
{
src: "bTqVqk7FSmY",
type: "youtube"
}
]
});
break;
case types.vimeo:
player.source({
type: 'video',
title: 'View From A Blue Moon',
sources: [{
src: '143418951',
type: 'vimeo'
}]
type: "video",
title: "View From A Blue Moon",
sources: [
{
src: "147865858",
type: "vimeo"
}
]
});
break;
}
@ -165,21 +174,30 @@
// Remove active classes
for (var x = buttons.length - 1; x >= 0; x--) {
toggleClass(buttons[x].parentElement, 'active', false);
toggleClass(buttons[x].parentElement, "active", false);
}
// Set active on parent
toggleClass(document.querySelector('[data-source="'+ type +'"]').parentElement, 'active', true);
toggleClass(document.querySelector('[data-source="' + type + '"]').parentElement, "active", true);
}
})();
// Google analytics
// For demo site (http://[www.]plyr.io) only
if(document.domain.indexOf('plyr.io') > -1) {
(function(i,s,o,g,r,a,m){i.GoogleAnalyticsObject=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-40881672-11', 'auto');
ga('send', 'pageview');
if (document.domain.indexOf("plyr.io") > -1) {
(function(i, s, o, g, r, a, m) {
i.GoogleAnalyticsObject = r;
(i[r] =
i[r] ||
function() {
(i[r].q = i[r].q || []).push(arguments);
}),
(i[r].l = 1 * new Date());
(a = s.createElement(o)), (m = s.getElementsByTagName(o)[0]);
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m);
})(window, document, "script", "//www.google-analytics.com/analytics.js", "ga");
ga("create", "UA-40881672-11", "auto");
ga("send", "pageview");
}

View File

@ -3,16 +3,16 @@
// ==========================================================================
@font-face {
font-family: "Avenir";
src: url("//cdn.plyr.io/fonts/avenir-medium.woff2") format("woff2"),
url("//cdn.plyr.io/fonts/avenir-medium.woff") format("woff");
font-style: normal;
font-weight: @font-weight-base;
font-family: 'Avenir';
src: url('https://cdn.plyr.io/static/fonts/avenir-medium.woff2') format('woff2'), url('https://cdn.plyr.io/static/fonts/avenir-medium.woff') format('woff');
font-style: normal;
font-weight: @font-weight-base;
font-display: swap;
}
@font-face {
font-family: "Avenir";
src: url("//cdn.plyr.io/fonts/avenir-bold.woff2") format("woff2"),
url("//cdn.plyr.io/fonts/avenir-bold.woff") format("woff");
font-style: normal;
font-weight: @font-weight-bold;
}
font-family: 'Avenir';
src: url('https://cdn.plyr.io/static/fonts/avenir-bold.woff2') format('woff2'), url('https://cdn.plyr.io/static/fonts/avenir-bold.woff') format('woff');
font-style: normal;
font-weight: @font-weight-bold;
font-display: swap;
}

2
dist/plyr.css vendored

File diff suppressed because one or more lines are too long

3
dist/plyr.js vendored

File diff suppressed because one or more lines are too long

View File

@ -4,72 +4,69 @@
/*global require, __dirname,Buffer*/
/*jshint -W079 */
var fs = require("fs"),
path = require("path"),
gulp = require("gulp"),
gutil = require("gulp-util"),
concat = require("gulp-concat"),
uglify = require("gulp-uglify"),
less = require("gulp-less"),
sass = require("gulp-sass"),
cleanCSS = require("gulp-clean-css"),
run = require("run-sequence"),
prefix = require("gulp-autoprefixer"),
svgstore = require("gulp-svgstore"),
svgmin = require("gulp-svgmin"),
rename = require("gulp-rename"),
s3 = require("gulp-s3"),
replace = require("gulp-replace"),
open = require("gulp-open"),
size = require("gulp-size"),
through = require("through2");
var fs = require('fs'),
path = require('path'),
gulp = require('gulp'),
gutil = require('gulp-util'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
less = require('gulp-less'),
sass = require('gulp-sass'),
cleanCSS = require('gulp-clean-css'),
run = require('run-sequence'),
prefix = require('gulp-autoprefixer'),
svgstore = require('gulp-svgstore'),
svgmin = require('gulp-svgmin'),
rename = require('gulp-rename'),
s3 = require('gulp-s3'),
replace = require('gulp-replace'),
open = require('gulp-open'),
size = require('gulp-size'),
through = require('through2');
var root = __dirname,
paths = {
plyr: {
// Source paths
src: {
less: path.join(root, "src/less/**/*"),
scss: path.join(root, "src/scss/**/*"),
js: path.join(root, "src/js/**/*"),
sprite: path.join(root, "src/sprite/*.svg")
paths = {
plyr: {
// Source paths
src: {
less: path.join(root, 'src/less/**/*'),
scss: path.join(root, 'src/scss/**/*'),
js: path.join(root, 'src/js/**/*'),
sprite: path.join(root, 'src/sprite/*.svg'),
},
// Output paths
output: path.join(root, 'dist/'),
},
// Output paths
output: path.join(root, "dist/")
},
demo: {
// Source paths
src: {
less: path.join(root, "demo/src/less/**/*"),
js: path.join(root, "demo/src/js/**/*"),
sprite: path.join(root, "demo/src/sprite/**/*")
demo: {
// Source paths
src: {
less: path.join(root, 'demo/src/less/**/*'),
js: path.join(root, 'demo/src/js/**/*'),
sprite: path.join(root, 'demo/src/sprite/**/*'),
},
// Output paths
output: path.join(root, 'demo/dist/'),
// Demo
root: path.join(root, 'demo/'),
},
// Output paths
output: path.join(root, "demo/dist/"),
// Demo
root: path.join(root, "demo/")
upload: [path.join(root, 'dist/**'), path.join(root, 'demo/dist/**')],
},
upload: [path.join(root, "dist/**"), path.join(root, "demo/dist/**")]
},
// Task arrays
tasks = {
less: [],
scss: [],
js: [],
sprite: []
},
// Fetch bundles from JSON
bundles = loadJSON(path.join(root, "bundles.json")),
package = loadJSON(path.join(root, "package.json"));
// Task arrays
tasks = {
less: [],
scss: [],
js: [],
sprite: [],
},
// Fetch bundles from JSON
bundles = loadJSON(path.join(root, 'bundles.json')),
package = loadJSON(path.join(root, 'package.json'));
// Load json
function loadJSON(path) {
try {
return JSON.parse(fs.readFileSync(path));
}
catch(err) {
} catch (err) {
return {};
}
}
@ -77,38 +74,40 @@ function loadJSON(path) {
// Create a file from a string
// http://stackoverflow.com/questions/23230569/how-do-you-create-a-file-from-a-string-in-gulp
function createFile(filename, string) {
var src = require('stream').Readable({
objectMode: true
var src = require('stream').Readable({
objectMode: true,
});
src._read = function () {
this.push(new gutil.File({
cwd: "",
base: "",
path: filename,
contents: new Buffer(string),
// stats also required for some functions
// https://nodejs.org/api/fs.html#fs_class_fs_stats
stat: {
size: string.length
}
}));
src._read = function() {
this.push(
new gutil.File({
cwd: '',
base: '',
path: filename,
contents: new Buffer(string),
// stats also required for some functions
// https://nodejs.org/api/fs.html#fs_class_fs_stats
stat: {
size: string.length,
},
}),
);
this.push(null);
}
return src
};
return src;
}
var build = {
js: function (files, bundle) {
js: function(files, bundle) {
for (var key in files) {
(function(key) {
var name = "js-" + key;
var name = 'js-' + key;
tasks.js.push(name);
gulp.task(name, function () {
gulp.task(name, function() {
return gulp
.src(bundles[bundle].js[key])
.pipe(concat(key))
.pipe(uglify())
.pipe(uglify().on('error', gutil.log))
.pipe(gulp.dest(paths[bundle].output));
});
})(key);
@ -116,17 +115,17 @@ var build = {
},
less: function(files, bundle) {
for (var key in files) {
(function (key) {
var name = "less-" + key;
(function(key) {
var name = 'less-' + key;
tasks.less.push(name);
gulp.task(name, function () {
gulp.task(name, function() {
return gulp
.src(bundles[bundle].less[key])
.pipe(less())
.on("error", gutil.log)
.on('error', gutil.log)
.pipe(concat(key))
.pipe(prefix(["last 2 versions"], { cascade: true }))
.pipe(prefix(['last 2 versions'], { cascade: true }))
.pipe(cleanCSS())
.pipe(gulp.dest(paths[bundle].output));
});
@ -135,17 +134,17 @@ var build = {
},
scss: function(files, bundle) {
for (var key in files) {
(function (key) {
var name = "scss-" + key;
(function(key) {
var name = 'scss-' + key;
tasks.scss.push(name);
gulp.task(name, function () {
gulp.task(name, function() {
return gulp
.src(bundles[bundle].scss[key])
.pipe(sass())
.on("error", gutil.log)
.on('error', gutil.log)
.pipe(concat(key))
.pipe(prefix(["last 2 versions"], { cascade: true }))
.pipe(prefix(['last 2 versions'], { cascade: true }))
.pipe(cleanCSS())
.pipe(gulp.dest(paths[bundle].output));
});
@ -153,48 +152,52 @@ var build = {
}
},
sprite: function(bundle) {
var name = "sprite-" + bundle;
var name = 'sprite-' + bundle;
tasks.sprite.push(name);
// Process Icons
gulp.task(name, function () {
gulp.task(name, function() {
return gulp
.src(paths[bundle].src.sprite)
.pipe(svgmin({
plugins: [{
removeDesc: true
}]
}))
.pipe(
svgmin({
plugins: [
{
removeDesc: true,
},
],
}),
)
.pipe(svgstore())
.pipe(rename({ basename: bundle }))
.pipe(gulp.dest(paths[bundle].output));
});
}
},
};
// Plyr core files
build.js(bundles.plyr.js, "plyr");
build.less(bundles.plyr.less, "plyr");
build.scss(bundles.plyr.scss, "plyr");
build.sprite("plyr");
build.js(bundles.plyr.js, 'plyr');
build.less(bundles.plyr.less, 'plyr');
build.scss(bundles.plyr.scss, 'plyr');
build.sprite('plyr');
// Demo files
build.less(bundles.demo.less, "demo");
build.js(bundles.demo.js, "demo");
build.sprite("demo");
build.less(bundles.demo.less, 'demo');
build.js(bundles.demo.js, 'demo');
build.sprite('demo');
// Build all JS
gulp.task("js", function(){
gulp.task('js', function() {
run(tasks.js);
});
// Build SCSS (for testing, default is LESS)
gulp.task("scss", function(){
gulp.task('scss', function() {
run(tasks.scss);
});
// Watch for file changes
gulp.task("watch", function () {
gulp.task('watch', function() {
// Plyr core
gulp.watch(paths.plyr.src.js, tasks.js);
gulp.watch(paths.plyr.src.less, tasks.less);
@ -207,131 +210,144 @@ gulp.task("watch", function () {
});
// Default gulp task
gulp.task("default", function(){
run(tasks.js, tasks.less, tasks.sprite, "watch");
gulp.task('default', function() {
run(tasks.js, tasks.less, tasks.sprite, 'watch');
});
// Publish a version to CDN and demo
// --------------------------------------------
// Some options
var aws = loadJSON(path.join(root, "aws.json")),
version = package.version,
maxAge = 31536000, // seconds 1 year
options = {
cdn: {
headers: {
"Cache-Control": "max-age=" + maxAge,
"Vary": "Accept-Encoding"
}
},
demo: {
headers: {
"Cache-Control": "no-cache, no-store, must-revalidate, max-age=0",
"Vary": "Accept-Encoding"
}
},
symlinks: function(version, filename) {
return {
var aws = loadJSON(path.join(root, 'aws.json')),
version = package.version,
maxAge = 31536000, // seconds 1 year
options = {
cdn: {
headers: {
// http://stackoverflow.com/questions/2272835/amazon-s3-object-redirect
"x-amz-website-redirect-location": "/" + version + "/" + filename,
"Cache-Control": "no-cache, no-store, must-revalidate, max-age=0"
}
}
}
};
'Cache-Control': 'max-age=' + maxAge,
Vary: 'Accept-Encoding',
},
},
demo: {
headers: {
'Cache-Control': 'no-cache, no-store, must-revalidate, max-age=0',
Vary: 'Accept-Encoding',
},
},
symlinks: function(version, filename) {
return {
headers: {
// http://stackoverflow.com/questions/2272835/amazon-s3-object-redirect
'x-amz-website-redirect-location': '/' + version + '/' + filename,
'Cache-Control': 'no-cache, no-store, must-revalidate, max-age=0',
},
};
},
};
// If aws is setup
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\\-]+)*)?",
cdnpath = new RegExp(aws.cdn.bucket + "\/" + regex, "gi"),
semver = new RegExp("v" + regex, "gi"),
localPath = new RegExp("(\.\.\/)?dist", "gi"),
versionPath = "https://" + aws.cdn.bucket + "/" + version;
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\\-]+)*)?',
cdnpath = new RegExp(aws.cdn.domain + '/' + regex, 'gi'),
semver = new RegExp('v' + regex, 'gi'),
localPath = new RegExp('(../)?dist', 'gi'),
versionPath = 'https://' + aws.cdn.domain + '/' + version;
}
// Publish version to CDN bucket
gulp.task("cdn", function () {
console.log("Uploading " + version + " to " + aws.cdn.bucket + "...");
gulp.task('cdn', function() {
console.log('Uploading ' + version + ' to ' + aws.cdn.domain + '...');
// Upload to CDN
return gulp.src(paths.upload)
.pipe(size({
showFiles: true,
gzip: true
}))
.pipe(rename(function (path) {
path.dirname = path.dirname.replace(".", version);
}))
return gulp
.src(paths.upload)
.pipe(
size({
showFiles: true,
gzip: true,
}),
)
.pipe(
rename(function(path) {
path.dirname = path.dirname.replace('.', version);
}),
)
.pipe(replace(localPath, versionPath))
.pipe(s3(aws.cdn, options.cdn));
});
// Publish to demo bucket
gulp.task("demo", function () {
console.log("Uploading " + version + " demo to " + aws.demo.bucket + "...");
gulp.task('demo', function() {
console.log('Uploading ' + version + ' demo to ' + aws.demo.domain + '...');
// Replace versioned files in readme.md
gulp.src([root + "/readme.md"])
.pipe(replace(cdnpath, aws.cdn.bucket + "/" + version))
gulp
.src([root + '/readme.md'])
.pipe(replace(cdnpath, aws.cdn.domain + '/' + version))
.pipe(gulp.dest(root));
// Replace versioned files in plyr.js
gulp.src(path.join(root, "src/js/plyr.js"))
.pipe(replace(semver, "v" + version))
.pipe(replace(cdnpath, aws.cdn.bucket + "/" + version))
.pipe(gulp.dest(path.join(root, "src/js/")));
gulp
.src(path.join(root, 'src/js/plyr.js'))
.pipe(replace(semver, 'v' + version))
.pipe(replace(cdnpath, aws.cdn.domain + '/' + version))
.pipe(gulp.dest(path.join(root, 'src/js/')));
// Replace local file paths with remote paths in demo HTML
// e.g. "../dist/plyr.js" to "https://cdn.plyr.io/x.x.x/plyr.js"
gulp.src([paths.demo.root + "*.html"])
gulp
.src([paths.demo.root + '*.html'])
.pipe(replace(localPath, versionPath))
.pipe(s3(aws.demo, options.demo));
// Upload error.html to cdn (as well as demo site)
return gulp.src([paths.demo.root + "error.html"])
return gulp
.src([paths.demo.root + 'error.html'])
.pipe(replace(localPath, versionPath))
.pipe(s3(aws.cdn, options.demo));
});
// Open the demo site to check it's sweet
gulp.task("symlinks", function () {
console.log("Updating symlinks...");
gulp.task('symlinks', function() {
console.log('Updating symlinks...');
return gulp.src(paths.upload)
.pipe(through.obj(function (chunk, enc, callback) {
return gulp.src(paths.upload).pipe(
through.obj(function(chunk, enc, callback) {
if (chunk.stat.isFile()) {
// Get the filename
var filename = chunk.path.split("/").reverse()[0];
var filename = chunk.path.split('/').reverse()[0];
// Create the 0 byte redirect files to upload
createFile(filename, "")
.pipe(rename(function (path) {
path.dirname = path.dirname.replace(".", "latest");
}))
createFile(filename, '')
.pipe(
rename(function(path) {
path.dirname = path.dirname.replace('.', 'latest');
}),
)
// Upload to S3 with correct headers
.pipe(s3(aws.cdn, options.symlinks(version, filename)));
}
callback(null, chunk);
}));
}),
);
});
// Open the demo site to check it's sweet
gulp.task("open", function () {
console.log("Opening " + aws.demo.bucket + "...");
gulp.task('open', function() {
console.log('Opening ' + aws.demo.domain + '...');
// A file must be specified or gulp will skip the task
// Doesn't matter which file since we set the URL above
// Weird, I know...
return gulp.src([paths.demo.root + "index.html"])
.pipe(open("", {
url: "http://" + aws.demo.bucket
}));
return gulp.src([paths.demo.root + 'index.html']).pipe(
open('', {
url: 'http://' + aws.demo.domain,
}),
);
});
// Do everything
gulp.task("publish", function () {
run(tasks.js, tasks.less, tasks.sprite, "cdn", "demo", "symlinks");
gulp.task('publish', function() {
run(tasks.js, tasks.less, tasks.sprite, 'cdn', 'demo', 'symlinks');
});

View File

@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2015 Selz.com
Copyright (c) 2017 Sam Potts
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

4604
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,51 +1,51 @@
{
"name": "plyr",
"version": "2.0.4",
"description": "A simple, accessible and customizable HTML5, YouTube and Vimeo media player",
"homepage": "http://plyr.io",
"main": "src/js/plyr.js",
"dependencies": {},
"devDependencies": {
"gulp": "^3.9.1",
"gulp-autoprefixer": "^3.1.0",
"gulp-clean-css": "^2.0.6",
"gulp-concat": "^2.3.3",
"gulp-less": "^3.0.5",
"gulp-open": "^2.0.0",
"gulp-rename": "^1.2.0",
"gulp-replace": "^0.5.3",
"gulp-s3": "^0.3.0",
"gulp-sass": "^2.3.1",
"gulp-size": "^2.1.0",
"gulp-svgmin": "^1.2.2",
"gulp-svgstore": "^5.0.5",
"gulp-uglify": "^1.5.3",
"gulp-util": "^3.0.7",
"run-sequence": "^1.1.5",
"through2": "^2.0.1"
},
"keywords": [
"HTML5 Video",
"HTML5 Audio",
"Media Player",
"DASH",
"Shaka",
"WordPress",
"HLS"
],
"repository": {
"type": "git",
"url": "git://github.com/selz/plyr.git"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/selz/plyr/issues"
},
"directories": {
"doc": "readme.md"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Sam Potts <sam@selz.com>"
"name": "plyr",
"version": "2.0.17",
"description": "A simple, accessible and customizable HTML5, YouTube and Vimeo media player",
"homepage": "http://plyr.io",
"main": "src/js/plyr.js",
"dependencies": {},
"devDependencies": {
"gulp": "^3.9.1",
"gulp-autoprefixer": "^4.0.0",
"gulp-clean-css": "^3.9.0",
"gulp-concat": "^2.6.1",
"gulp-less": "^3.3.2",
"gulp-open": "^2.0.0",
"gulp-rename": "^1.2.2",
"gulp-replace": "^0.6.1",
"gulp-s3": "^0.11.0",
"gulp-sass": "^3.1.0",
"gulp-size": "^2.1.0",
"gulp-svgmin": "^1.2.4",
"gulp-svgstore": "^6.1.0",
"gulp-uglify": "^3.0.0",
"gulp-util": "^3.0.8",
"run-sequence": "^2.2.0",
"through2": "^2.0.3"
},
"keywords": [
"HTML5 Video",
"HTML5 Audio",
"Media Player",
"DASH",
"Shaka",
"WordPress",
"HLS"
],
"repository": {
"type": "git",
"url": "git://github.com/sampotts/plyr.git"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/sampotts/plyr/issues"
},
"directories": {
"doc": "readme.md"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Sam Potts <sam@potts.es>"
}

138
readme.md
View File

@ -1,9 +1,11 @@
# Plyr
A simple, accessible and customizable HTML5, YouTube and Vimeo media player.
[Donate to support Plyr](#donate)
[Checkout the demo](https://plyr.io)
[![Image of Plyr](https://cdn.selz.com/plyr/plyr_v1.8.9.png)](https://plyr.io)
[![Image of Plyr](https://cdn.plyr.io/static/demo/screenshot.png)](https://plyr.io)
## 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.
@ -30,15 +32,25 @@ Oh and yes, it works with Bootstrap.
## Changelog
Check out the [changelog](changelog.md) to see what's new with Plyr.
## Planned Development
- Playback speed
## Features currently being developed
- Playback speed selection
- Quality selection
- Playlists
- Multiple language captions (with selection)
- Audio captions
... and whatever else has been raised in [issues](https://github.com/Selz/plyr/issues)
- Caption language selection
- AirPlay
- Picture in Picture (MacOS Sierra + Safari)
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.
[more info](https://github.com/sampotts/plyr/issues?q=is%3Aissue+is%3Aopen+label%3A%22In+Development%22)
## Planned features
- Playlists
- Google cast
- Facebook video support
- Wistia video support
- YouTube and Vimeo audio support
- Audio captions
...and whatever else has been raised in [issues](https://github.com/sampotts/plyr/issues)
If you have any cool ideas or features, please let me know by [creating an issue](https://github.com/sampotts/plyr/issues/new) or, of course, forking and sending a pull request.
## CMS plugins
@ -106,12 +118,15 @@ For YouTube and Vimeo, Plyr uses the standard YouTube API markup (an empty `<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
```html
<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).
```html
@ -119,10 +134,10 @@ Include the `plyr.js` script before the closing `</body>` tag and then call `ply
<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
<script src="https://cdn.plyr.io/2.0.4/plyr.js"></script>
<script src="https://cdn.plyr.io/2.0.17/plyr.js"></script>
```
### CSS
@ -132,19 +147,19 @@ Include the `plyr.css` stylsheet into your `<head>`
<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
<link rel="stylesheet" href="https://cdn.plyr.io/2.0.4/plyr.css">
<link rel="stylesheet" href="https://cdn.plyr.io/2.0.17/plyr.css">
```
### 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.4/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.17/plyr.svg`.
## Advanced
### 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 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.
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.
@ -152,7 +167,7 @@ The HTML markup uses the BEM methodology with `plyr` as the block, e.g. `.plyr__
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).
#### Using the `iconUrl` option
You can however specify your own `iconUrl` option and Plyr will determine if the url is absolute and requires loading by AJAX/CORS due to current browser limitations or if it's a relative path, just use the path directly.
You can however specify your own `iconUrl` option and Plyr will determine if the url is absolute and requires loading by AJAX/CORS due to current browser limitations or if it's a relative path, just use the path directly.
If you're using the `<base>` tag on your site, you may need to use something like this:
[svgfixer.js](https://gist.github.com/leonderijke/c5cf7c5b2e424c0061d2)
@ -198,7 +213,7 @@ Passing a [string selector](https://developer.mozilla.org/en-US/docs/Web/API/Doc
plyr.setup('.js-player', options);
```
The NodeList, HTMLElement or string selector can be the target `<video>`, `<audio>` or `[data-type]` (for embeds) element itself 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:
```javascript
@ -208,7 +223,7 @@ 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
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 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:
@ -271,6 +286,12 @@ Note the single quotes encapsulating the JSON and double quotes on the object ke
<td><code>plyr</code></td>
<td>Specify the id prefix for the icons used in the default controls (e.g. "plyr-play" would be "plyr"). This is to prevent clashes if you're using your own SVG sprite but with the default controls. Most people can ignore this option.</td>
</tr>
<tr>
<td><code>blankUrl</code></td>
<td>String</td>
<td><code>https://cdn.selz.com/plyr/blank.mp4</code></td>
<td>Specify a URL or path to a blank video file used to properly cancel network requests. See <a href="https://github.com/sampotts/plyr/issues/174">issue #174</a> for more info.</td>
</tr>
<tr>
<td><code>debug</code></td>
<td>Boolean</td>
@ -435,7 +456,7 @@ This will return an array of all instances that were setup. Another way is to us
var players = plyr.get('.js-player');
```
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.
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.
A final option is to access the instance through the event handlers:
@ -487,12 +508,12 @@ Here's a list of the methods supported:
<tr>
<td><code>isReady()</code></td>
<td>&mdash;</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>
<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>
<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>
<td><code>play()</code></td>
@ -529,6 +550,26 @@ Here's a list of the methods supported:
<td>Number</td>
<td>Seeks the media to the provided parameter, time in seconds.</td>
</tr>
<tr>
<td><code>getCurrentTime()</code></td>
<td>&mdash;</td>
<td>Will return a float with the current time in seconds.</td>
</tr>
<tr>
<td><code>getDuration()</code></td>
<td>&mdash;</td>
<td>Will return a float with the duration in seconds.</td>
</tr>
<tr>
<td><code>getVolume()</code></td>
<td>&mdash;</td>
<td>Will return a float between 0 and 1 for the current volume level.</td>
</tr>
<tr>
<td><code>isMuted()</code></td>
<td>&mdash;</td>
<td>Will return a boolean for whether the media is currently muted.</td>
</tr>
<tr>
<td><code>setVolume(...)</code></td>
<td>Number</td>
@ -539,6 +580,11 @@ Here's a list of the methods supported:
<td>Boolean</td>
<td>Toggles playback for the player based on either the boolean argument or it's current state.</td>
</tr>
<tr>
<td><code>isPaused()</code></td>
<td>&mdash;</td>
<td>Will return a boolean for whether the media is currently paused.</td>
</tr>
<tr>
<td><code>toggleMute()</code></td>
<td>&mdash;</td>
@ -590,11 +636,6 @@ Here's a list of the methods supported:
<td>&mdash;</td>
<td>Restores the original element, reversing the effects of <code>setup()</code>.</td>
</tr>
<tr>
<td><code>getCurrentTime()</code></td>
<td>&mdash;</td>
<td>Will return a float with the current time in seconds.</td>
</tr>
</tbody>
</table>
@ -656,6 +697,8 @@ player.source({
});
```
Note: `src` can be the video ID or URL
Vimeo example
```javascript
@ -669,7 +712,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%">
<thead>
@ -693,7 +738,7 @@ Some more details on the object parameters
<tr>
<td><code>sources</code></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>
<td><code>poster</code></td>
@ -736,7 +781,7 @@ These events also bubble up the DOM. The event target will be the container elem
<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>
<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>
<td><code>canplay</code></td>
@ -756,7 +801,7 @@ These events also bubble up the DOM. The event target will be the container elem
<tr>
<td><code>ended</code></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>
<td><code>error</code></td>
@ -800,12 +845,12 @@ These events also bubble up the DOM. The event target will be the container elem
</tr>
<tr>
<td><code>seeked</code></td>
<td></td>
<td></td>
<td>Sent when a seek operation completes.</td>
</tr>
<tr>
<td><code>seeking</code></td>
<td></td>
<td></td>
<td>Sent when a seek operation begins.</td>
</tr>
<tr>
@ -859,21 +904,19 @@ These events also bubble up the DOM. The event target will be the container elem
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)
## 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. You don't need to worry about including your own versions of the Vimeo or YouTube JavaScript APIs. Plyr will automatically include them.
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 embed third party API's can be accessed through the `getEmbed()` API method.
The embed third party API's can be accessed through the `getEmbed()` API method.
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)
- [Vimeo API Reference](https://github.com/vimeo/player.js)
*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
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.
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%">
<thead>
@ -888,7 +931,7 @@ By default, a player will bind the following keyboard shortcuts when it has focu
<td><code>0</code> to <code>9</code></td>
<td></td>
<td>Seek from 0 to 90% respectively</td>
</tr>
</tr>
<tr>
<td><code>space</code></td>
<td></td>
@ -937,7 +980,7 @@ By default, a player will bind the following keyboard shortcuts when it has focu
</tbody>
</table>
## Streaming
## 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)
@ -945,7 +988,7 @@ Because Plyr is an extension of the standard HTML5 video and audio elements, thi
- 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).
Fullscreen in Plyr is supported by all browsers that [currently support it](http://caniuse.com/#feat=fullscreen).
## Browser support
@ -976,7 +1019,7 @@ Fullscreen in Plyr is supported by all browsers that [currently support it](http
&sup2; Native player used (no support for `<progress>` or `<input type="range">`) but the API is supported (v1.0.28+)
&sup3; IE10 has no native fullscreen support, fallback can be used (see options)
&sup3; IE10 has no native fullscreen support, fallback can be used (see [options](#options))
The `enabled` option can be used to disable certain User Agents. For example, if you don't want to use Plyr for smartphones, you could use:
@ -994,7 +1037,11 @@ There's an API method for checking support. You can call `plyr.supported()` and
If you find anything weird with Plyr, please let us know using the GitHub issues tracker.
## Author
Plyr is developed by [@sam_potts](https://twitter.com/sam_potts) / [sampotts.me](http://sampotts.me) with help from the awesome [contributors](https://github.com/Selz/plyr/graphs/contributors)
Plyr is developed by [@sam_potts](https://twitter.com/sam_potts) / [sampotts.me](http://sampotts.me) with help from the awesome [contributors](https://github.com/sampotts/plyr/graphs/contributors)
## Donate
Plyr costs money to run, not my time - I donate that for free but domains, hosting and more. Any help is appreciated...
[Donate to support Plyr](https://www.paypal.me/pottsy/20usd)
## Mentions
- [ProductHunt](https://www.producthunt.com/tech/plyr)
@ -1030,5 +1077,10 @@ Also these links helped created Plyr:
- [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/)
## Thanks
[![Fastly](https://www.fastly.com/sites/all/themes/custom/fastly2016/logo.png)](https://www.fastly.com/)
Thanks to [Fastly](https://www.fastly.com/) for providing the CDN services.
## Copyright and License
[The MIT license](license.md).

File diff suppressed because it is too large Load Diff

View File

@ -3,13 +3,15 @@
// https://github.com/selz/plyr
// ==========================================================================
@import "variables";
@import "mixins";
@import 'variables';
@import 'mixins';
// Animation
// ---------------------------------------
@keyframes plyr-progress {
to { background-position: @plyr-progress-loading-size 0; }
to {
background-position: @plyr-progress-loading-size 0;
}
}
// Styles
@ -35,7 +37,10 @@
& when (@plyr-touch-action = true) {
// Fix 300ms delay
a, button, input, label {
a,
button,
input,
label {
touch-action: manipulation;
}
}
@ -61,14 +66,14 @@
height: (@plyr-range-thumb-height * @plyr-range-thumb-active-scale);
width: 100%;
margin: 0;
padding: 0;
vertical-align: middle;
appearance: none;
padding: 0;
-webkit-appearance: none;
-moz-appearance: none;
cursor: pointer;
border: none;
background: transparent;
// WebKit
&::-webkit-slider-runnable-track {
.plyr-range-track();
@ -86,7 +91,7 @@
&::-moz-range-thumb {
.plyr-range-thumb();
}
// Microsoft
&::-ms-track {
height: @plyr-range-track-height;
@ -104,7 +109,7 @@
&::-ms-thumb {
.plyr-range-thumb();
// For some reason, Edge uses the -webkit margin above
margin-top: 0;
margin-top: 0;
}
&::-ms-tooltip {
display: none;
@ -116,11 +121,11 @@
}
&::-moz-focus-outer {
border: 0;
}
}
&.tab-focus:focus {
outline-offset: 3px;
}
// Pressed styles
&:active {
&::-webkit-slider-thumb {
@ -173,16 +178,17 @@
position: relative;
background: #000;
border-radius: inherit;
// Cleaner radius, also forces iframe radius
-webkit-mask-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAA5JREFUeNpiYGBgAAgwAAAEAAGbA+oJAAAAAElFTkSuQmCC);
}
// Container for embeds
.plyr__video-embed {
padding-bottom: 56.25%; /* 16:9 */
height: 0;
border-radius: inherit;
// Require overflow and z-index to force border-radius
overflow: hidden;
z-index: 0;
iframe {
position: absolute;
@ -220,7 +226,7 @@
width: 100%;
padding: (@plyr-control-spacing * 2);
transform: translateY(-(@plyr-control-spacing * 4));
transition: transform .3s ease;
transition: transform 0.3s ease;
color: @plyr-captions-color;
font-size: @plyr-font-size-captions-base;
text-align: center;
@ -244,12 +250,15 @@
.plyr--captions-active .plyr__captions {
display: block;
}
.plyr--fullscreen-active .plyr__captions {
font-size: @plyr-font-size-captions-large;
}
.plyr--hide-controls .plyr__captions {
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
// --------------------------------------------------------------
@ -261,9 +270,14 @@
// Playback controls
.plyr__controls {
display: flex;
align-items: center;
align-items: center;
line-height: 1;
text-align: center;
pointer-events: none;
& > * {
pointer-events: all;
}
// Spacing
> button,
@ -278,7 +292,7 @@
.plyr__volume {
margin-left: (@plyr-control-spacing / 2);
}
[data-plyr="pause"] {
[data-plyr='pause'] {
margin-left: 0;
}
@ -294,7 +308,7 @@
background: transparent;
border-radius: 3px;
cursor: pointer;
transition: background .3s ease, color .3s ease, opacity .3s ease;
transition: background 0.3s ease, color 0.3s ease, opacity 0.3s ease;
color: inherit;
svg {
@ -325,7 +339,7 @@
}
}
}
// Hide controls
// Hide controls
.plyr--hide-controls .plyr__controls {
opacity: 0;
pointer-events: none;
@ -337,12 +351,13 @@
left: 0;
right: 0;
bottom: 0;
z-index: 2;
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%));
border-bottom-left-radius: inherit;
border-bottom-right-radius: inherit;
color: @plyr-video-control-color;
transition: opacity .3s ease;
transition: opacity 0.3s ease;
button {
// Hover and tab focus
@ -386,7 +401,7 @@
border-radius: 100%;
box-shadow: 0 1px 1px fade(#000, 15%);
color: @plyr-video-control-color;
transition: all .3s ease;
transition: all 0.3s ease;
svg {
position: relative;
@ -460,9 +475,9 @@
font-size: @plyr-font-size-small;
line-height: 1.3;
transform: translate(-50%, 10px) scale(.8);
transform: translate(-50%, 10px) scale(0.8);
transform-origin: 50% 100%;
transition: transform .2s .1s ease, opacity .2s .1s ease;
transition: transform 0.2s 0.1s ease, opacity 0.2s 0.1s ease;
&::before {
// Arrows
@ -472,7 +487,7 @@
height: 0;
left: 50%;
transform: translateX(-50%);
// The background triangle
bottom: -@plyr-tooltip-arrow-size;
border-right: @plyr-tooltip-arrow-size solid transparent;
@ -494,7 +509,7 @@
// First tooltip
.plyr__controls button:first-child .plyr__tooltip {
left: 0;
transform: translate(0, 10px) scale(.8);
transform: translate(0, 10px) scale(0.8);
transform-origin: 0 100%;
&::before {
@ -505,7 +520,7 @@
// Last tooltip
.plyr__controls button:last-child .plyr__tooltip {
right: 0;
transform: translate(0, 10px) scale(.8);
transform: translate(0, 10px) scale(0.8);
transform-origin: 100% 100%;
&::before {
@ -524,7 +539,6 @@
}
}
// Playback progress
// --------------------------------------------------------------
// <progress> element
@ -533,7 +547,7 @@
display: none;
flex: 1;
input[type="range"] {
input[type='range'] {
position: relative;
z-index: 2;
@ -568,7 +582,8 @@
margin: -(@plyr-range-track-height / 2) 0 0;
padding: 0;
vertical-align: top;
appearance: none;
-webkit-appearance: none;
-moz-appearance: none;
border: none;
border-radius: 100px;
@ -616,20 +631,20 @@
}
.plyr__progress--buffer {
&::-webkit-progress-value {
transition: width .2s ease;
transition: width 0.2s ease;
}
&::-moz-progress-bar {
transition: width .2s ease;
}
transition: width 0.2s ease;
}
&::-ms-fill {
transition: width .2s ease;
}
transition: width 0.2s ease;
}
}
.plyr--video .plyr__progress--buffer,
.plyr--video .plyr__volume--display {
background: @plyr-video-range-track-bg;
}
.plyr--video .plyr__progress--buffer {
.plyr--video .plyr__progress--buffer {
color: @plyr-video-progress-buffered-bg;
}
.plyr--audio .plyr__progress--buffer,
@ -653,7 +668,8 @@
@plyr-progress-loading-bg 50%,
@plyr-progress-loading-bg 75%,
transparent 75%,
transparent);
transparent
);
color: transparent;
}
.plyr--video.plyr--loading .plyr__progress--buffer {
@ -694,7 +710,7 @@
flex: 1;
position: relative;
input[type="range"] {
input[type='range'] {
position: relative;
z-index: 2;
}
@ -718,14 +734,8 @@
// Fullscreen
// --------------------------------------------------------------
.plyr--fullscreen-active {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
height: 100%;
width: 100%;
z-index: 10000000;
background: #000;
border-radius: 0 !important;
@ -736,11 +746,9 @@
height: 100%;
width: 100%;
}
.plyr__controls {
position: absolute;
bottom: 0;
left: 0;
right: 0;
.plyr__video-embed {
// Revert overflow change
overflow: visible;
}
// Vimeo requires some different styling
@ -750,3 +758,13 @@
transform: translateY(-50%);
}
}
// Fallback for unsupported browsers
.plyr--fullscreen-fallback.plyr--fullscreen-active {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 10000000;
}

View File

@ -68,4 +68,5 @@
// Breakpoints
@plyr-bp-screen-sm: 480px;
@plyr-bp-screen-md: 768px;
@plyr-bp-screen-md: 768px;
@plyr-bp-screen-lg: 1024px;

View File

@ -9,7 +9,9 @@
// Animation
// ---------------------------------------
@keyframes plyr-progress {
to { background-position: $plyr-progress-loading-size 0; }
to {
background-position: $plyr-progress-loading-size 0;
}
}
// Styles
@ -34,10 +36,13 @@
}
@if $plyr-touch-action == true {
// Fix 300ms delay
a, button, input, label {
touch-action: manipulation;
}
// Fix 300ms delay
a,
button,
input,
label {
touch-action: manipulation;
}
}
// Focus
@ -56,19 +61,19 @@
// Range inputs
// Specificity is for bootstrap compatibility
input[type='range'] {
input[type="range"] {
display: block;
height: ($plyr-range-thumb-height * $plyr-range-thumb-active-scale);
width: 100%;
margin: 0;
padding: 0;
padding: 0;
vertical-align: middle;
appearance: none;
cursor: pointer;
border: none;
background: transparent;
// WebKit
&::-webkit-slider-runnable-track {
@include plyr-range-track();
@ -86,7 +91,7 @@
&::-moz-range-thumb {
@include plyr-range-thumb();
}
// Microsoft
&::-ms-track {
height: $plyr-range-track-height;
@ -104,7 +109,7 @@
&::-ms-thumb {
@include plyr-range-thumb();
// For some reason, Edge uses the -webkit margin above
margin-top: 0;
margin-top: 0;
}
&::-ms-tooltip {
display: none;
@ -116,11 +121,11 @@
}
&::-moz-focus-outer {
border: 0;
}
}
&.tab-focus:focus {
outline-offset: 3px;
}
// Pressed styles
&:active {
&::-webkit-slider-thumb {
@ -137,13 +142,13 @@
}
// Video range inputs
.plyr--video input[type='range'].tab-focus:focus {
outline: 1px dotted transparentize($plyr-video-control-color, .5);
.plyr--video input[type="range"].tab-focus:focus {
outline: 1px dotted transparentize($plyr-video-control-color, 0.5);
}
// Audio range inputs
.plyr--audio input[type='range'].tab-focus:focus {
outline: 1px dotted transparentize($plyr-audio-control-color, .5);
.plyr--audio input[type="range"].tab-focus:focus {
outline: 1px dotted transparentize($plyr-audio-control-color, 0.5);
}
// Screen reader only elements
@ -172,18 +177,18 @@
position: relative;
background: #000;
border-radius: inherit;
// Cleaner radius, also forces iframe radius
-webkit-mask-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAA5JREFUeNpiYGBgAAgwAAAEAAGbA+oJAAAAAElFTkSuQmCC);
}
// Container for embeds
.plyr__video-embed {
padding-bottom: 56.25%; /* 16:9 */
height: 0;
overflow: hidden;
border-radius: inherit;
// Require overflow and z-index to force border-radius
overflow: hidden;
z-index: 0;
iframe {
position: absolute;
top: 0;
@ -220,7 +225,7 @@
width: 100%;
padding: ($plyr-control-spacing * 2);
transform: translateY(-($plyr-control-spacing * 6));
transition: transform .3s ease;
transition: transform 0.3s ease;
color: $plyr-captions-color;
font-size: $plyr-font-size-captions-base;
text-align: center;
@ -244,12 +249,15 @@
.plyr--captions-active .plyr__captions {
display: block;
}
.plyr--fullscreen-active .plyr__captions {
font-size: $plyr-font-size-captions-large;
}
.plyr--hide-controls .plyr__captions {
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
// --------------------------------------------------------------
@ -261,10 +269,15 @@
// Playback controls
.plyr__controls {
display: flex;
align-items: center;
align-items: center;
line-height: 1;
text-align: center;
pointer-events: none;
& > * {
pointer-events: all;
}
// Spacing
> button,
.plyr__progress,
@ -289,12 +302,12 @@
flex-shrink: 0;
overflow: visible; // IE11
vertical-align: middle;
padding: ($plyr-control-spacing * .7);
padding: ($plyr-control-spacing * 0.7);
border: 0;
background: transparent;
border-radius: 3px;
cursor: pointer;
transition: background .3s ease, color .3s ease, opacity .3s ease;
transition: background 0.3s ease, color 0.3s ease, opacity 0.3s ease;
color: inherit;
svg {
@ -325,7 +338,7 @@
}
}
}
// Hide controls
// Hide controls
.plyr--hide-controls .plyr__controls {
opacity: 0;
pointer-events: none;
@ -338,11 +351,14 @@
right: 0;
bottom: 0;
padding: ($plyr-control-spacing * 5) $plyr-control-spacing $plyr-control-spacing;
background: linear-gradient(transparentize($plyr-video-controls-bg, 1), transparentize($plyr-video-controls-bg, .5));
background: linear-gradient(
transparentize($plyr-video-controls-bg, 1),
transparentize($plyr-video-controls-bg, 0.5)
);
border-bottom-left-radius: inherit;
border-bottom-right-radius: inherit;
color: $plyr-video-control-color;
transition: opacity .3s ease;
transition: opacity 0.3s ease;
button {
// Hover and tab focus
@ -384,9 +400,9 @@
background: $plyr-video-control-bg-hover;
border: 4px solid currentColor;
border-radius: 100%;
box-shadow: 0 1px 1px transparentize(#000, .85);
box-shadow: 0 1px 1px transparentize(#000, 0.85);
color: $plyr-video-control-color;
transition: all .3s ease;
transition: all 0.3s ease;
svg {
position: relative;
@ -398,7 +414,7 @@
}
&:focus {
outline: 1px dotted transparentize($plyr-video-control-color, .5);
outline: 1px dotted transparentize($plyr-video-control-color, 0.5);
}
}
.plyr .plyr__play-large {
@ -413,11 +429,11 @@
}
// States
.plyr__controls [data-plyr='pause'],
.plyr--playing .plyr__controls [data-plyr='play'] {
.plyr__controls [data-plyr="pause"],
.plyr--playing .plyr__controls [data-plyr="play"] {
display: none;
}
.plyr--playing .plyr__controls [data-plyr='pause'] {
.plyr--playing .plyr__controls [data-plyr="pause"] {
display: inline-block;
}
@ -433,12 +449,12 @@
}
// Some options are hidden by default
.plyr [data-plyr='captions'],
.plyr [data-plyr='fullscreen'] {
.plyr [data-plyr="captions"],
.plyr [data-plyr="fullscreen"] {
display: none;
}
.plyr--captions-enabled [data-plyr='captions'],
.plyr--fullscreen-enabled [data-plyr='fullscreen'] {
.plyr--captions-enabled [data-plyr="captions"],
.plyr--fullscreen-enabled [data-plyr="fullscreen"] {
display: inline-block;
}
@ -460,19 +476,19 @@
font-size: $plyr-font-size-small;
line-height: 1.3;
transform: translate(-50%, 10px) scale(.8);
transform: translate(-50%, 10px) scale(0.8);
transform-origin: 50% 100%;
transition: transform .2s .1s ease, opacity .2s .1s ease;
transition: transform 0.2s 0.1s ease, opacity 0.2s 0.1s ease;
&::before {
// Arrows
content: '';
content: "";
position: absolute;
width: 0;
height: 0;
left: 50%;
transform: translateX(-50%);
// The background triangle
bottom: -$plyr-tooltip-arrow-size;
border-right: $plyr-tooltip-arrow-size solid transparent;
@ -494,7 +510,7 @@
// First tooltip
.plyr__controls button:first-child .plyr__tooltip {
left: 0;
transform: translate(0, 10px) scale(.8);
transform: translate(0, 10px) scale(0.8);
transform-origin: 0 100%;
&::before {
@ -505,7 +521,7 @@
// Last tooltip
.plyr__controls button:last-child .plyr__tooltip {
right: 0;
transform: translate(0, 10px) scale(.8);
transform: translate(0, 10px) scale(0.8);
transform-origin: 100% 100%;
&::before {
@ -615,20 +631,20 @@
}
.plyr__progress--buffer {
&::-webkit-progress-value {
transition: width .2s ease;
transition: width 0.2s ease;
}
&::-moz-progress-bar {
transition: width .2s ease;
}
transition: width 0.2s ease;
}
&::-ms-fill {
transition: width .2s ease;
}
transition: width 0.2s ease;
}
}
.plyr--video .plyr__progress--buffer,
.plyr--video .plyr__volume--display {
background: $plyr-video-range-track-bg;
}
.plyr--video .plyr__progress--buffer {
.plyr--video .plyr__progress--buffer {
color: $plyr-video-progress-buffered-bg;
}
.plyr--audio .plyr__progress--buffer,
@ -652,7 +668,8 @@
$plyr-progress-loading-bg 50%,
$plyr-progress-loading-bg 75%,
transparent 75%,
transparent);
transparent
);
color: transparent;
}
.plyr--video.plyr--loading .plyr__progress--buffer {
@ -679,7 +696,7 @@
// Add a slash in before
&::before {
content: '\2044';
content: "\2044";
margin-right: $plyr-control-spacing;
}
}
@ -710,21 +727,15 @@
// It's not supported to change volume using JavaScript:
// https://developer.apple.com/library/safari/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/Device-SpecificConsiderations/Device-SpecificConsiderations.html
.plyr--is-ios .plyr__volume,
.plyr--is-ios [data-plyr='mute'] {
.plyr--is-ios [data-plyr="mute"] {
display: none !important;
}
// Fullscreen
// --------------------------------------------------------------
.plyr--fullscreen-active {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
height: 100%;
width: 100%;
z-index: 10000000;
background: #000;
border-radius: 0 !important;
@ -735,11 +746,9 @@
height: 100%;
width: 100%;
}
.plyr__controls {
position: absolute;
bottom: 0;
left: 0;
right: 0;
.plyr__video-embed {
// Revert overflow change
overflow: visible;
}
// Vimeo requires some different styling
@ -749,3 +758,13 @@
transform: translateY(-50%);
}
}
// Fallback for unsupported browsers
.plyr--fullscreen-fallback.plyr--fullscreen-active {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 10000000;
}

View File

@ -69,4 +69,5 @@ $plyr-range-selected-bg: $plyr-color-main !default;
// Breakpoints
$plyr-bp-screen-sm: 480px !default;
$plyr-bp-screen-md: 768px !default;
$plyr-bp-screen-md: 768px !default;
$plyr-bp-screen-lg: 1024px !default;