Compare commits

...

12 Commits

Author SHA1 Message Date
18dfc17439 Version bump 2015-02-28 12:09:01 +11:00
35ac236a00 Updates to docs, fix for seek time in controls 2015-02-28 12:07:21 +11:00
dd17100a53 Small improvements, docs updated 2015-02-28 11:18:24 +11:00
f8b4622093 Fix for Bootstrap compatibility
Fixes #6
2015-02-28 10:43:42 +11:00
1216968c60 Minor tweaks 2015-02-28 01:17:56 +11:00
1d2bd227f1 Small tweak to play(), pause() 2015-02-28 00:45:56 +11:00
6cec6b2e16 Docs for 1.0.12 2015-02-28 00:40:36 +11:00
98bc9b0c4b Handle native events
Fixes #34
2015-02-28 00:36:28 +11:00
a637949e84 Added link to Selz 2015-02-27 14:52:57 +11:00
d784669699 Updated docs/examples to use new CDN 2015-02-27 12:19:41 +11:00
ba340172ee Readme updates, code formatted using spaces 2015-02-26 14:32:18 +11:00
55b085c4d0 Bug fixes for fullscreen mode 2015-02-24 15:44:56 +11:00
15 changed files with 1355 additions and 1173 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "plyr", "name": "plyr",
"version": "1.0.10", "version": "1.0.15",
"description": "A simple HTML5 media player using custom controls", "description": "A simple HTML5 media player using custom controls",
"homepage": "http://plyr.io", "homepage": "http://plyr.io",
"keywords": [ "keywords": [

View File

@ -1,5 +1,25 @@
# Changelog # Changelog
## v1.0.15
- Fix for seek time display in controls
- More documentation for controls html
## v1.0.14
- Minor change for bootstrap compatibility
## v1.0.13
- Minor tweaks
## v1.0.12
- Handle native events (Issue #34)
## v1.0.11
- Bug fixes for fullscreen mode
## v1.0.10
- Bower includes src files now
- Folder re-arrangement
## v1.0.9 ## v1.0.9
- Added buffer progress bar - Added buffer progress bar
- Fixed Safari 8 caption track (it needs to be removed from the DOM like in Safari 7) - Fixed Safari 8 caption track (it needs to be removed from the DOM like in Safari 7)

80
controls.md Normal file
View File

@ -0,0 +1,80 @@
# Controls HTML
This is the markup that is rendered for controls. It is a seperate option to allow full customisation of markup based on your needs. The default Plyr setup uses a Hogan template, this is to allow for localisation at a later date. If you check `controls.html` in `/src/templates` to get an idea of how the default html works.
## Requirements
The classes and data attributes used in your template should match the `selectors` option.
You need to add two placeholders to your html template:
- {id} for the dynamically generated ID for the player (for form controls)
- {aria-label} for the dynamically generated play button label for screen readers
- {seek-time} for the seek time specified in options for fast forward and rewind
Currently all buttons and inputs need to be present for Plyr to work but later we'll make it more dynamic so if you omit a button or input, it'll still work.
## Vanilla HTML template
You can of course, just specify vanilla HTML. Here's an example snippet:
```javascript
var controls = [
'<div class="player-controls">',
'<div class="player-progress">',
'<progress class="player-progress-played" max="100" value="0">',
'<span>0</span>% played',
'</progress>',
'<progress class="player-progress-buffer" max="100" value="0">',
'<span>0</span>% buffered',
'</progress>',
'</div>',
'<span class="player-controls-playback">',
'<button type="button" data-player="restart">',
'<span class="icon-restart" aria-hidden="true"></span>',
'<span class="sr-only">Restart</span>',
'</button>',
'<button type="button" data-player="rewind">',
'<span class="icon-rewind" aria-hidden="true"></span>',
'<span class="sr-only">Rewind <span class="player-seek-time">{seek_time}</span> seconds</span>',
'</button>',
'<button type="button" aria-label="{aria-label}" data-player="play">',
'<span class="icon-play" aria-hidden="true"></span>',
'<span class="sr-only">Play</span>',
'</button>',
'<button type="button" data-player="pause">',
'<span class="icon-pause" aria-hidden="true"></span>',
'<span class="sr-only">Pause</span>',
'</button>',
'<button type="button" data-player="fast-forward">',
'<span class="icon-forward" aria-hidden="true"></span>',
'<span class="sr-only">Fast forward <span class="player-seek-time">{seek_time}</span> seconds</span>',
'</button>',
'<span class="player-time">',
'<span class="sr-only">Time</span>',
'<span class="player-duration">00:00</span>',
'</span>',
'</span>',
'<span class="player-controls-sound">',
'<input class="inverted sr-only" id="mute{id}" type="checkbox" data-player="mute">',
'<label id="mute{id}" for="mute{id}">',
'<span class="icon-mute icon-muted" aria-hidden="true"></span>',
'<span class="icon-volume-up" aria-hidden="true"></span>',
'<span class="sr-only">Mute</span>',
'</label>',
'<label for="volume{id}" class="sr-only">Volume:</label>',
'<input id="volume{id}" class="player-volume" type="range" min="0" max="10" value="5" data-player="volume">',
'<input class="sr-only" id="captions{id}" type="checkbox" data-player="captions">',
'<label for="captions{id}">',
'<span class="icon-subtitles" aria-hidden="true"></span>',
'<span class="sr-only">Captions</span>',
'</label>',
'<button type="button" data-player="fullscreen">',
'<span class="icon-resize-small icon-exit-fullscreen" aria-hidden="true"></span>',
'<span class="icon-resize-full" aria-hidden="true"></span>',
'<span class="sr-only">Toggle fullscreen</span>',
'</button>',
'</span>',
'</div>'
].join("\n");
```

2
dist/css/docs.css vendored
View File

@ -1 +1 @@
/*! normalize.css v2.1.3 | MIT License | git.io/normalize */article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,video{display:inline-block}audio:not([controls]){display:none;height:0}[hidden],template{display:none}html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}a{background:0 0}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}dfn{font-style:italic}hr{box-sizing:content-box;height:0}mark{background:#ff0;color:#000}code,kbd,pre,samp{font-family:monospace,serif;font-size:1em}pre{white-space:pre-wrap}q{quotes:"\201C" "\201D" "\2018" "\2019"}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:0}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{border:0;padding:0}button,input,select,textarea{font-family:inherit;font-size:100%;margin:0}button,input{line-height:normal}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=search]{-webkit-appearance:textfield;box-sizing:content-box}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}textarea{overflow:auto;vertical-align:top}table{border-collapse:collapse;border-spacing:0}*,::after,::before{box-sizing:border-box}body{font-family:Avenir,"Helvetica Neue",Helvetica,Arial,sans-serif;background:#fff;line-height:1.5;text-align:center;color:#6D797F}h1,h2{letter-spacing:-.025em;color:#2E3C44;margin:0 0 10px;line-height:1.2;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}h1{font-size:64px;font-size:4rem;color:#3498DB}p,small{margin:0 0 20px}small{display:block;padding:0 10px;font-size:14px;font-size:.9rem}header{padding:20px;margin-bottom:20px}header p{font-size:18px;font-size:1.1rem}@media (min-width:560px){header{padding-top:60px;padding-bottom:60px}}section{padding-bottom:20px}@media (min-width:560px){section{padding-bottom:40px}}a{text-decoration:none;color:#3498db;border-bottom:1px solid currentColor;transition:all .3s ease}a:focus,a:hover{color:#000}a:focus{outline:#343f4a dotted thin;outline-offset:1px}.btn{display:inline-block;padding:10px 30px;background:#3498db;border:0;color:#fff;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-weight:600;border-radius:3px}.btn:focus,.btn:hover{color:#fff;background:#258cd1}.example-audio .player{max-width:480px}.example-video .player{max-width:1200px}.example-audio .player,.example-video .player{margin:0 auto 20px}.example-audio .player-fullscreen,.example-audio .player.fullscreen-active,.example-video .player-fullscreen,.example-video .player.fullscreen-active{max-width:none}@font-face{font-family:Avenir;src:url(../../src/fonts/AvenirLTStd-Medium.woff2) format("woff2"),url(../../src/fonts/AvenirLTStd-Medium.woff) format("woff"),url(../../src/fonts/AvenirLTStd-Medium.ttf) format("truetype");font-style:normal;font-weight:400}@font-face{font-family:Avenir;src:url(../../src/fonts/AvenirLTStd-Heavy.woff2) format("woff2"),url(../../src/fonts/AvenirLTStd-Heavy.woff) format("woff"),url(../../src/fonts/AvenirLTStd-Heavy.ttf) format("truetype");font-style:normal;font-weight:600} /*! normalize.css v2.1.3 | MIT License | git.io/normalize */article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,video{display:inline-block}audio:not([controls]){display:none;height:0}[hidden],template{display:none}html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}a{background:0 0}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}dfn{font-style:italic}hr{box-sizing:content-box;height:0}mark{background:#ff0;color:#000}code,kbd,pre,samp{font-family:monospace,serif;font-size:1em}pre{white-space:pre-wrap}q{quotes:"\201C" "\201D" "\2018" "\2019"}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:0}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{border:0;padding:0}button,input,select,textarea{font-family:inherit;font-size:100%;margin:0}button,input{line-height:normal}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=search]{-webkit-appearance:textfield;box-sizing:content-box}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}textarea{overflow:auto;vertical-align:top}table{border-collapse:collapse;border-spacing:0}*,::after,::before{box-sizing:border-box}body{font-family:Avenir,"Helvetica Neue",Helvetica,Arial,sans-serif;background:#fff;line-height:1.5;text-align:center;color:#6D797F}h1,h2{letter-spacing:-.025em;color:#2E3C44;margin:0 0 10px;line-height:1.2;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}h1{font-size:64px;font-size:4rem;color:#3498DB}p,small{margin:0 0 20px}small{display:block;padding:0 10px;font-size:14px;font-size:.9rem}header{padding:20px;margin-bottom:20px}header p{font-size:18px;font-size:1.1rem}@media (min-width:560px){header{padding-top:60px;padding-bottom:60px}}section{padding-bottom:20px}@media (min-width:560px){section{padding-bottom:40px}}a{text-decoration:none;color:#3498db;border-bottom:1px solid currentColor;transition:all .3s ease}a:focus,a:hover{color:#000}a:focus{outline:#343f4a dotted thin;outline-offset:1px}a.logo{border:0}.btn{display:inline-block;padding:10px 30px;background:#3498db;border:0;color:#fff;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-weight:600;border-radius:3px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.btn:focus,.btn:hover{color:#fff;background:#258cd1}.example-audio .player{max-width:480px}.example-video .player{max-width:1200px}.example-audio .player,.example-video .player{margin:0 auto 20px}.example-audio .player-fullscreen,.example-audio .player.fullscreen-active,.example-video .player-fullscreen,.example-video .player.fullscreen-active{max-width:none}footer{margin-bottom:20px}footer p{margin-bottom:10px}@font-face{font-family:Avenir;src:url(../../src/fonts/AvenirLTStd-Medium.woff2) format("woff2"),url(../../src/fonts/AvenirLTStd-Medium.woff) format("woff"),url(../../src/fonts/AvenirLTStd-Medium.ttf) format("truetype");font-style:normal;font-weight:400}@font-face{font-family:Avenir;src:url(../../src/fonts/AvenirLTStd-Heavy.woff2) format("woff2"),url(../../src/fonts/AvenirLTStd-Heavy.woff) format("woff"),url(../../src/fonts/AvenirLTStd-Heavy.ttf) format("truetype");font-style:normal;font-weight:600}

2
dist/css/plyr.css vendored

File diff suppressed because one or more lines are too long

2
dist/js/docs.js vendored

File diff suppressed because one or more lines are too long

2
dist/js/plyr.js vendored

File diff suppressed because one or more lines are too long

View File

@ -1,2 +1,2 @@
var templates = {}; var templates = {};
templates['controls'] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("<div class=\"player-controls\">");t.b("\n" + i);t.b(" <div class=\"player-progress\">");t.b("\n" + i);t.b(" <progress class=\"player-progress-played\" max=\"100\" value=\"0\">");t.b("\n" + i);t.b(" <span>0</span>% played");t.b("\n" + i);t.b(" </progress>");t.b("\n" + i);t.b(" <progress class=\"player-progress-buffer\" max=\"100\" value=\"0\">");t.b("\n" + i);t.b(" <span>0</span>% buffered");t.b("\n" + i);t.b(" </progress>");t.b("\n" + i);t.b(" </div>");t.b("\n" + i);t.b(" <span class=\"player-controls-playback\">");t.b("\n" + i);t.b(" <button type=\"button\" data-player=\"restart\">");t.b("\n" + i);t.b(" <svg><use xlink:href=\"#icon-refresh\"></use></svg>");t.b("\n" + i);t.b(" <span class=\"sr-only\">Restart</span>");t.b("\n" + i);t.b(" </button>");t.b("\n" + i);t.b(" <button type=\"button\" data-player=\"rewind\">");t.b("\n" + i);t.b(" <svg><use xlink:href=\"#icon-rewind\"></use></svg>");t.b("\n" + i);t.b(" <span class=\"sr-only\">Rewind <span class=\"player-seek-time\">10</span> seconds</span>");t.b("\n" + i);t.b(" </button>");t.b("\n" + i);t.b(" <button type=\"button\" aria-label=\"{aria-label}\" data-player=\"play\">");t.b("\n" + i);t.b(" <svg><use xlink:href=\"#icon-play\"></use></svg>");t.b("\n" + i);t.b(" <span class=\"sr-only\">Play</span>");t.b("\n" + i);t.b(" </button>");t.b("\n" + i);t.b(" <button type=\"button\" data-player=\"pause\">");t.b("\n" + i);t.b(" <svg><use xlink:href=\"#icon-pause\"></use></svg>");t.b("\n" + i);t.b(" <span class=\"sr-only\">Pause</span>");t.b("\n" + i);t.b(" </button>");t.b("\n" + i);t.b(" <button type=\"button\" data-player=\"fast-forward\">");t.b("\n" + i);t.b(" <svg><use xlink:href=\"#icon-fast-forward\"></use></svg>");t.b("\n" + i);t.b(" <span class=\"sr-only\">Fast forward <span class=\"player-seek-time\">10</span> seconds</span>");t.b("\n" + i);t.b(" </button>");t.b("\n" + i);t.b(" <span class=\"player-time\">");t.b("\n" + i);t.b(" <span class=\"sr-only\">Time</span>");t.b("\n" + i);t.b(" <span class=\"player-duration\">00:00</span>");t.b("\n" + i);t.b(" </span>");t.b("\n" + i);t.b(" </span>");t.b("\n" + i);t.b(" <span class=\"player-controls-sound\">");t.b("\n" + i);t.b(" <input class=\"inverted sr-only\" id=\"mute{id}\" type=\"checkbox\" data-player=\"mute\">");t.b("\n" + i);t.b(" <label id=\"mute{id}\" for=\"mute{id}\">");t.b("\n" + i);t.b(" <svg class=\"icon-muted\"><use xlink:href=\"#icon-muted\"></use></svg>");t.b("\n" + i);t.b(" <svg><use xlink:href=\"#icon-sound\"></use></svg>");t.b("\n" + i);t.b(" <span class=\"sr-only\">Mute</span>");t.b("\n" + i);t.b(" </label>");t.b("\n");t.b("\n" + i);t.b(" <label for=\"volume{id}\" class=\"sr-only\">Volume:</label>");t.b("\n" + i);t.b(" <input id=\"volume{id}\" class=\"player-volume\" type=\"range\" min=\"0\" max=\"10\" value=\"5\" data-player=\"volume\">");t.b("\n");t.b("\n" + i);t.b(" <input class=\"sr-only\" id=\"captions{id}\" type=\"checkbox\" data-player=\"captions\">");t.b("\n" + i);t.b(" <label for=\"captions{id}\">");t.b("\n" + i);t.b(" <svg><use xlink:href=\"#icon-bubble\"></use></svg>");t.b("\n" + i);t.b(" <span class=\"sr-only\">Captions</span>");t.b("\n" + i);t.b(" </label>");t.b("\n");t.b("\n" + i);t.b(" <button type=\"button\" data-player=\"fullscreen\">");t.b("\n" + i);t.b(" <svg class=\"icon-exit-fullscreen\"><use xlink:href=\"#icon-collapse\"></use></svg>");t.b("\n" + i);t.b(" <svg><use xlink:href=\"#icon-expand\"></use></svg>");t.b("\n" + i);t.b(" <span class=\"sr-only\">Toggle fullscreen</span>");t.b("\n" + i);t.b(" </button>");t.b("\n" + i);t.b(" </span>");t.b("\n" + i);t.b("</div>");return t.fl(); },partials: {}, subs: { }}); templates['controls'] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("<div class=\"player-controls\">");t.b("\n" + i);t.b(" <div class=\"player-progress\">");t.b("\n" + i);t.b(" <progress class=\"player-progress-played\" max=\"100\" value=\"0\">");t.b("\n" + i);t.b(" <span>0</span>% played");t.b("\n" + i);t.b(" </progress>");t.b("\n" + i);t.b(" <progress class=\"player-progress-buffer\" max=\"100\" value=\"0\">");t.b("\n" + i);t.b(" <span>0</span>% buffered");t.b("\n" + i);t.b(" </progress>");t.b("\n" + i);t.b(" </div>");t.b("\n" + i);t.b(" <span class=\"player-controls-playback\">");t.b("\n" + i);t.b(" <button type=\"button\" data-player=\"restart\">");t.b("\n" + i);t.b(" <svg><use xlink:href=\"#icon-refresh\"></use></svg>");t.b("\n" + i);t.b(" <span class=\"sr-only\">Restart</span>");t.b("\n" + i);t.b(" </button>");t.b("\n" + i);t.b(" <button type=\"button\" data-player=\"rewind\">");t.b("\n" + i);t.b(" <svg><use xlink:href=\"#icon-rewind\"></use></svg>");t.b("\n" + i);t.b(" <span class=\"sr-only\">Rewind <span class=\"player-seek-time\">{seek-time}</span> seconds</span>");t.b("\n" + i);t.b(" </button>");t.b("\n" + i);t.b(" <button type=\"button\" aria-label=\"{aria-label}\" data-player=\"play\">");t.b("\n" + i);t.b(" <svg><use xlink:href=\"#icon-play\"></use></svg>");t.b("\n" + i);t.b(" <span class=\"sr-only\">Play</span>");t.b("\n" + i);t.b(" </button>");t.b("\n" + i);t.b(" <button type=\"button\" data-player=\"pause\">");t.b("\n" + i);t.b(" <svg><use xlink:href=\"#icon-pause\"></use></svg>");t.b("\n" + i);t.b(" <span class=\"sr-only\">Pause</span>");t.b("\n" + i);t.b(" </button>");t.b("\n" + i);t.b(" <button type=\"button\" data-player=\"fast-forward\">");t.b("\n" + i);t.b(" <svg><use xlink:href=\"#icon-fast-forward\"></use></svg>");t.b("\n" + i);t.b(" <span class=\"sr-only\">Fast forward <span class=\"player-seek-time\">{seek-time}</span> seconds</span>");t.b("\n" + i);t.b(" </button>");t.b("\n" + i);t.b(" <span class=\"player-time\">");t.b("\n" + i);t.b(" <span class=\"sr-only\">Time</span>");t.b("\n" + i);t.b(" <span class=\"player-duration\">00:00</span>");t.b("\n" + i);t.b(" </span>");t.b("\n" + i);t.b(" </span>");t.b("\n" + i);t.b(" <span class=\"player-controls-sound\">");t.b("\n" + i);t.b(" <input class=\"inverted sr-only\" id=\"mute{id}\" type=\"checkbox\" data-player=\"mute\">");t.b("\n" + i);t.b(" <label id=\"mute{id}\" for=\"mute{id}\">");t.b("\n" + i);t.b(" <svg class=\"icon-muted\"><use xlink:href=\"#icon-muted\"></use></svg>");t.b("\n" + i);t.b(" <svg><use xlink:href=\"#icon-sound\"></use></svg>");t.b("\n" + i);t.b(" <span class=\"sr-only\">Mute</span>");t.b("\n" + i);t.b(" </label>");t.b("\n");t.b("\n" + i);t.b(" <label for=\"volume{id}\" class=\"sr-only\">Volume:</label>");t.b("\n" + i);t.b(" <input id=\"volume{id}\" class=\"player-volume\" type=\"range\" min=\"0\" max=\"10\" value=\"5\" data-player=\"volume\">");t.b("\n");t.b("\n" + i);t.b(" <input class=\"sr-only\" id=\"captions{id}\" type=\"checkbox\" data-player=\"captions\">");t.b("\n" + i);t.b(" <label for=\"captions{id}\">");t.b("\n" + i);t.b(" <svg><use xlink:href=\"#icon-bubble\"></use></svg>");t.b("\n" + i);t.b(" <span class=\"sr-only\">Captions</span>");t.b("\n" + i);t.b(" </label>");t.b("\n");t.b("\n" + i);t.b(" <button type=\"button\" data-player=\"fullscreen\">");t.b("\n" + i);t.b(" <svg class=\"icon-exit-fullscreen\"><use xlink:href=\"#icon-collapse\"></use></svg>");t.b("\n" + i);t.b(" <svg><use xlink:href=\"#icon-expand\"></use></svg>");t.b("\n" + i);t.b(" <span class=\"sr-only\">Toggle fullscreen</span>");t.b("\n" + i);t.b(" </button>");t.b("\n" + i);t.b(" </span>");t.b("\n" + i);t.b("</div>");return t.fl(); },partials: {}, subs: { }});

View File

@ -20,17 +20,17 @@
<section class="example-video"> <section class="example-video">
<div class="player"> <div class="player">
<video poster="//cdn.sampotts.me/plyr/poster.jpg" controls crossorigin> <video poster="//cdn.selz.com/plyr/1.0/poster.jpg" controls crossorigin>
<!-- Video files --> <!-- Video files -->
<source src="//cdn.sampotts.me/plyr/movie.mp4" type="video/mp4"> <source src="//cdn.selz.com/plyr/1.0/movie.mp4" type="video/mp4">
<source src="//cdn.sampotts.me/plyr/movie.webm" type="video/webm"> <source src="//cdn.selz.com/plyr/1.0/movie.webm" type="video/webm">
<!-- Text track file --> <!-- Text track file -->
<track kind="captions" label="English" srclang="en" src="//cdn.sampotts.me/plyr/movie_en_captions.vtt" default> <track kind="captions" label="English" srclang="en" src="//cdn.selz.com/plyr/1.0/movie_en_captions.vtt" default>
<!-- Fallback for browsers that don't support the <video> element --> <!-- Fallback for browsers that don't support the <video> element -->
<div> <div>
<a href="//cdn.sampotts.me/plyr/movie.mp4">Download</a> <a href="//cdn.selz.com/plyr/1.0/movie.mp4">Download</a>
</div> </div>
</video> </video>
</div> </div>
@ -41,18 +41,25 @@
<div class="player"> <div class="player">
<audio controls> <audio controls>
<!-- Audio files --> <!-- Audio files -->
<source src="//cdn.sampotts.me/plyr/logistics-96-sample.mp3" type="audio/mp3"> <source src="//cdn.selz.com/plyr/1.0/logistics-96-sample.mp3" type="audio/mp3">
<source src="//cdn.sampotts.me/plyr/logistics-96-sample.ogg" type="application/ogg"> <source src="//cdn.selz.com/plyr/1.0/logistics-96-sample.ogg" type="audio/ogg">
<!-- Fallback for browsers that don't support the <audio> element --> <!-- Fallback for browsers that don't support the <audio> element -->
<div> <div>
<a href="//cdn.sampotts.me/plyr/logistics-96-sample.mp3">Download</a> <a href="//cdn.selz.com/plyr/1.0/logistics-96-sample.mp3">Download</a>
</div> </div>
</audio> </audio>
</div> </div>
<small>"96" by Logistics, which can be purchased from <a href="https://www.hospitalrecords.com/shop/artist/logistics" target="_blank">Hospital Records</a>.</small> <small>"96" by Logistics, which can be purchased from <a href="https://www.hospitalrecords.com/shop/artist/logistics" target="_blank">Hospital Records</a>.</small>
</section> </section>
<footer>
<p>Used by &hellip;</p>
<a href="https://selz.com" target="_blank" class="logo">
<img src="https://d33i624pw6jj68.cloudfront.net/static/img/logos/selz.svg" alt="Selz">
</a>
</footer>
<!-- Load SVG defs --> <!-- Load SVG defs -->
<script> <script>
(function(d,p){var a=new XMLHttpRequest(),b=d.body;a.open("GET",p,!0);a.send();a.onload=function(){var c=d.createElement("div");c.style.display="none";c.innerHTML=a.responseText;b.insertBefore(c,b.childNodes[0])}})(document,"dist/sprite.svg"); (function(d,p){var a=new XMLHttpRequest(),b=d.body;a.open("GET",p,!0);a.send();a.onload=function(){var c=d.createElement("div");c.style.display="none";c.innerHTML=a.responseText;b.insertBefore(c,b.childNodes[0])}})(document,"dist/sprite.svg");

View File

@ -1,6 +1,6 @@
{ {
"name": "plyr", "name": "plyr",
"version": "1.0.10", "version": "1.0.15",
"description": "A simple HTML5 media player using custom controls", "description": "A simple HTML5 media player using custom controls",
"homepage": "http://plyr.io", "homepage": "http://plyr.io",
"main": "gulpfile.js", "main": "gulpfile.js",

View File

@ -11,7 +11,8 @@ We wanted a lightweight, accessible and customisable media player that just supp
- **Lightweight** - just 4.8KB minified and gzipped. - **Lightweight** - just 4.8KB minified and gzipped.
- **Customisable** - make the player look how you want with the markup you want. - **Customisable** - make the player look how you want with the markup you want.
- **Semantic** - uses HTML5 form inputs for volume (range) and progress element for playback progress. - **Semantic** - uses HTML5 form inputs for volume (range) and progress element for playback progress.
- **No dependencies** - written in native JS. - **Responsive** - any screen size.
- **No dependencies** - written in vanilla JavaScript.
- **API** - easy to use API. - **API** - easy to use API.
- **Fallback** - if there's no support, the native players are used. - **Fallback** - if there's no support, the native players are used.
- **Fullscreen** - options to run the player full browser or the user can toggle fullscreen. - **Fullscreen** - options to run the player full browser or the user can toggle fullscreen.
@ -23,6 +24,7 @@ Check out [the changelog](changelog.md)
- Accept a string selector, a node, or a nodelist for the `container` property of `selectors`. - Accept a string selector, a node, or a nodelist for the `container` property of `selectors`.
- Accept a selector for the `html` template property. - Accept a selector for the `html` template property.
- Multiple language captions (with selection) - Multiple language captions (with selection)
- Localisation of control labels
If you have any cool ideas or features, please let me know by [creating an issue](https://github.com/Selz/plyr/issues/new) or of course, forking and sending a pull request. If you have any cool ideas or features, please let me know by [creating an issue](https://github.com/Selz/plyr/issues/new) or of course, forking and sending a pull request.
@ -36,10 +38,10 @@ bower install plyr
More info on setting up dependencies can be found in the [Bower Docs](http://bower.io/docs/creating-packages/#maintaining-dependencies) More info on setting up dependencies can be found in the [Bower Docs](http://bower.io/docs/creating-packages/#maintaining-dependencies)
### CSS ### CSS
If you want to use the default css, add the css file from /dist into your head, or even better use the less file included in /assets in your build to save a request. If you want to use the default css, add the css file from /dist into your head, or even better use the less file included in `/src` in your build to save a request.
```html ```html
<link rel="stylesheet" href="/css/plyr.css" /> <link rel="stylesheet" href="dist/css/plyr.css">
``` ```
### SVG ### SVG
@ -58,7 +60,7 @@ The SVG sprite for the controls icons is loaded in by AJAX to help with performa
c.innerHTML=a.responseText; c.innerHTML=a.responseText;
b.insertBefore(c,b.childNodes[0]) b.insertBefore(c,b.childNodes[0])
} }
})(document,"/svg/sprite.svg"); })(document,"dist/svg/sprite.svg");
</script> </script>
``` ```
More info on SVG sprites here: More info on SVG sprites here:
@ -70,19 +72,17 @@ and the AJAX technique here:
The only extra markup that's needed to use plyr is a `<div>` wrapper. Replace the source, poster and captions with urls for your media. The only extra markup that's needed to use plyr is a `<div>` wrapper. Replace the source, poster and captions with urls for your media.
```html ```html
<div class="player"> <div class="player">
<video poster="//cdn.sampotts.me/plyr/poster.jpg" controls crossorigin> <video poster="//cdn.selz.com/plyr/1.0/poster.jpg" controls crossorigin>
<!-- Video files --> <!-- Video files -->
<source src="//cdn.sampotts.me/plyr/movie.mp4" type="video/mp4"> <source src="//cdn.selz.com/plyr/1.0/movie.mp4" type="video/mp4">
<source src="//cdn.sampotts.me/plyr/movie.webm" type="video/webm"> <source src="//cdn.selz.com/plyr/1.0/movie.webm" type="video/webm">
<!-- Text track file --> <!-- Text track file -->
<track kind="captions" label="English captions" src="//cdn.sampotts.me/plyr/movie_captions_en.vtt" srclang="en" default> <track kind="captions" label="English captions" src="//cdn.selz.com/plyr/1.0/movie_captions_en.vtt" srclang="en" default>
<!-- Fallback for browsers that don't support the <video> element --> <!-- Fallback for browsers that don't support the <video> element -->
<div> <div>
<a href="//cdn.sampotts.me/plyr/movie.mp4"> <a href="//cdn.selz.com/plyr/1.0/movie.mp4">Download</a>
<img src="//cdn.sampotts.me/plyr/poster.jpg" alt="Download">
</a>
</div> </div>
</video> </video>
</div> </div>
@ -93,11 +93,12 @@ And the same for `<audio>`
<div class="player"> <div class="player">
<audio controls> <audio controls>
<!-- Audio files --> <!-- Audio files -->
<source src="//cdn.sampotts.me/plyr/logistics-96-sample.mp3" type="audio/mp3"> <source src="//cdn.selz.com/plyr/1.0/logistics-96-sample.mp3" type="audio/mp3">
<source src="//cdn.selz.com/plyr/1.0/logistics-96-sample.ogg" type="audio/ogg">
<!-- Fallback for browsers that don't support the <audio> element --> <!-- Fallback for browsers that don't support the <audio> element -->
<div> <div>
<a href="//cdn.sampotts.me/plyr/logistics-96-sample.mp3">Download</a> <a href="//cdn.selz.com/plyr/1.0/logistics-96-sample.mp3">Download</a>
</div> </div>
</audio> </audio>
</div> </div>
@ -113,14 +114,15 @@ More info on CORS here:
Much of the behaviour of the player is configurable when initialising the library. Below is an example of a default instance. Much of the behaviour of the player is configurable when initialising the library. Below is an example of a default instance.
```html ```html
<script src="js/plyr.js"></script> <script src="dist/js/plyr.js"></script>
<script> <script>
plyr.setup({ plyr.setup({
html: **your controls html** html: **your controls html**
}); });
</script> </script>
``` ```
You can pass the following settings:
#### Options
<table class="table" width="100%"> <table class="table" width="100%">
<thead> <thead>
@ -142,11 +144,7 @@ You can pass the following settings:
<td><code>html</code></td> <td><code>html</code></td>
<td>String</td> <td>String</td>
<td><code>&mdash;</code></td> <td><code>&mdash;</code></td>
<td>This is **required**. It is the markup used for the controls. In the demo, we use Hogan templates as we are already using them. You can of course, just specify vanilla html. The only requirement is your selectors should match the `selectors` option below. If you check `controls.html` in `/assets/templates` to get an idea of how the default html works. <td>This is **required**. See [controls.md](controls.md) for more info on how the html needs to be structured.</td>
You need to add two placeholders to your html template:
- {id} for the dynamically generated ID for the player (for form controls)
- {aria_label} for the dynamically generated play button label for screen readers</td>
</tr> </tr>
<tr> <tr>
<td><code>debug</code></td> <td><code>debug</code></td>
@ -155,7 +153,7 @@ You can pass the following settings:
<td>Display debugging information on what Plyr is doing.</td> <td>Display debugging information on what Plyr is doing.</td>
</tr> </tr>
<tr> <tr>
<td><code>seekInterval</code></td> <td><code>seekTime</code></td>
<td>Number</td> <td>Number</td>
<td><code>10</code></td> <td><code>10</code></td>
<td>The time, in seconds, to seek when a user hits fast forward or rewind.</td> <td>The time, in seconds, to seek when a user hits fast forward or rewind.</td>
@ -176,7 +174,7 @@ You can pass the following settings:
<td><code>selectors</code></td> <td><code>selectors</code></td>
<td>Object</td> <td>Object</td>
<td>&mdash;</td> <td>&mdash;</td>
<td>See `plyr.js` in `/assets` for more info. The only option you might want to change is `player` which is the hook used for Plyr, the default is `.player`.</td> <td>See `plyr.js` in `/src` for more info. The only option you might want to change is `player` which is the hook used for Plyr, the default is `.player`.</td>
</tr> </tr>
<tr> <tr>
<td><code>classes</code></td> <td><code>classes</code></td>
@ -194,7 +192,13 @@ You can pass the following settings:
<td><code>fullscreen</code></td> <td><code>fullscreen</code></td>
<td>Object</td> <td>Object</td>
<td>&mdash;</td> <td>&mdash;</td>
<td>This currently contains one property `enabled` which toggles if fullscreen should be enabled (if the browser supports it). The default value is `true`.</td> <td>This currently contains two properties; `enabled` which toggles if fullscreen should be enabled (if the browser supports it). The default value is `true`. Also an extra property called `fallback` which will enable a 'full window' view for older browsers. The default value is `true`.</td>
</tr>
<tr>
<td><code>storage</code></td>
<td>Object</td>
<td>&mdash;</td>
<td>This currently contains one property `enabled` which toggles if local storage should be enabled (if the browser supports it). The default value is `true`. This enables storing user settings, currently it only stores volume but more will be added later.</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -278,12 +282,31 @@ A complete list of events can be found here:
## Fullscreen ## Fullscreen
Fullscreen in Plyr is supported for all browsers that [currently support it](http://caniuse.com/#feat=fullscreen). If you're using the default CSS, you can also use a "full browser" mode which will use the full browser window by adding the `player-fullscreen` class to your container. Fullscreen in Plyr is supported for all browsers that [currently support it](http://caniuse.com/#feat=fullscreen). If you're using the default CSS, you can also use a "full browser" mode which will use the full browser window by adding the `player-fullscreen` class to your container.
## Support ## Browser support
- Chrome: full support
- Safari: full support <table width="100%" style="text-align: center;">
- Firefox: full support <thead>
- Internet Explorer 10, 11: full support <tr>
- Internet Explorer 9: native player used (no support for `<progress>` or `<input type="range">`) <td>Safari</td>
<td>Firefox</td>
<td>Chrome</td>
<td>IE9</td>
<td>IE10+</td>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td></td>
<td></td>
<td>&sup1;</td>
<td>&sup2;</td>
</tr>
</tbody>
</table>
&sup1; Native player used (no support for `<progress>` or `<input type="range">`)
&sup2; IE10 has no native fullscreen support, fallback can be used (see 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: 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:
@ -298,11 +321,22 @@ Any unsupported browsers will display links to download the media if the correct
If you find anything weird with Plyr, please let us know using the Github issues tracker. If you find anything weird with Plyr, please let us know using the Github issues tracker.
## Author ## Author
This was created by Sam Potts ([@sam_potts](https://twitter.com/sam_potts)) Plyr is developed by Sam Potts ([@sam_potts](https://twitter.com/sam_potts)) ([sampotts.me](http://sampotts.me))
## Mentions
- [The Changelog](http://thechangelog.com/plyr-simple-html5-media-player-custom-controls-webvtt-captions/)
- [HTML5 Weekly #177](http://html5weekly.com/issues/177)
- [Web Design Weekly #174](https://web-design-weekly.com/2015/02/24/web-design-weekly-174/)
## Used by
- [Selz.com](https://selz.com)
Let me know on [Twitter](https://twitter.com/sam_potts) I can add you to the above list. It'd be awesome to see how you're using Plyr :-)
## Useful links and credits ## Useful links and credits
Credit to the PayPal HTML5 Video player from which Plyr's caption functionality is ported from: Credit to the PayPal HTML5 Video player from which Plyr's caption functionality is ported from:
- [PayPal's Accessible HTML5 Video Player](https://github.com/paypal/accessible-html5-video-player) - [PayPal's Accessible HTML5 Video Player](https://github.com/paypal/accessible-html5-video-player)
- The icons used in Plyr are [Vicons](https://dribbble.com/shots/1663443-60-Vicons-Free-Icon-Set) plus some ones I made
Also these links helped created Plyr: Also these links helped created Plyr:
- [Media Events - W3.org](http://www.w3.org/2010/05/video/mediaevents.html) - [Media Events - W3.org](http://www.w3.org/2010/05/video/mediaevents.html)

File diff suppressed because it is too large Load Diff

View File

@ -100,6 +100,9 @@ a {
&:focus { &:focus {
.tab-focus(); .tab-focus();
} }
&.logo {
border: 0;
}
} }
.btn { .btn {
display: inline-block; display: inline-block;
@ -110,6 +113,7 @@ a {
.font-smoothing(on); .font-smoothing(on);
font-weight: 600; font-weight: 600;
border-radius: 3px; border-radius: 3px;
user-select: none;
&:hover, &:hover,
&:focus { &:focus {
@ -135,6 +139,15 @@ a {
} }
} }
// Footer
footer {
margin-bottom: @padding-base;
p {
margin-bottom: (@padding-base / 2);
}
}
// Fonts // Fonts
// Last to not block rendering // Last to not block rendering
@import "docs/fontface.less"; @import "docs/fontface.less";

View File

@ -10,12 +10,19 @@
@gray: #565d64; @gray: #565d64;
@gray-light: #cbd0d3; @gray-light: #cbd0d3;
// Font sizes
@font-size-small: 14px;
@font-size-base: 16px;
@font-size-large: ceil((@font-size-base * 1.5));
// Controls // Controls
@controls-bg: @gray-dark;
@control-color: @gray-light;
@control-color-active: @blue;
@control-color-inactive: @gray;
@control-spacing: 10px; @control-spacing: 10px;
@controls-bg: @gray-dark;
@control-bg-hover: @blue;
@control-color: @gray-light;
@control-color-inactive: @gray;
@control-color-focus: #fff;
@control-color-hover: #fff;
// Progress // Progress
@progress-bg: lighten(@gray, 10%); @progress-bg: lighten(@gray, 10%);
@ -28,11 +35,11 @@
@range-thumb-height: (@range-track-height * 2); @range-thumb-height: (@range-track-height * 2);
@range-thumb-width: (@range-track-height * 2); @range-thumb-width: (@range-track-height * 2);
@range-thumb-bg: @control-color; @range-thumb-bg: @control-color;
@range-thumb-bg-focus: @control-color-active; @range-thumb-bg-focus: @control-bg-hover;
// Breakpoints // Breakpoints
@bp-control-split: 560px; // When controls split into left/right @bp-control-split: 560px; // When controls split into left/right
@bg-captions-large: 768px; // When captions jump to the larger font size @bp-captions-large: 768px; // When captions jump to the larger font size
// Utility classes & mixins // Utility classes & mixins
// ------------------------------- // -------------------------------
@ -127,7 +134,7 @@
padding: 20px; padding: 20px;
min-height: 2.5em; min-height: 2.5em;
color: #fff; color: #fff;
font-size: 16px; font-size: @font-size-base;
font-weight: 600; font-weight: 600;
text-shadow: text-shadow:
-1px -1px 0 @gray, -1px -1px 0 @gray,
@ -137,8 +144,8 @@
text-align: center; text-align: center;
.font-smoothing(); .font-smoothing();
@media (min-width: @bg-captions-large) { @media (min-width: @bp-captions-large) {
font-size: 24px; font-size: @font-size-large;
} }
} }
&.captions-active &-captions { &.captions-active &-captions {
@ -206,12 +213,12 @@
input:focus + label, input:focus + label,
button:focus { button:focus {
.tab-focus(); .tab-focus();
color: #fff; color: @control-color-focus;
} }
button:hover, button:hover,
input + label:hover { input + label:hover {
background: @control-color-active; background: @control-bg-hover;
color: #fff; color: @control-color-hover;
} }
.icon-exit-fullscreen, .icon-exit-fullscreen,
.icon-muted { .icon-muted {
@ -221,9 +228,9 @@
display: inline-block; display: inline-block;
vertical-align: middle; vertical-align: middle;
margin-left: @control-spacing; margin-left: @control-spacing;
color: #fff; color: @control-color;
font-weight: 600; font-weight: 600;
font-size: 14px; font-size: @font-size-small;
.font-smoothing(); .font-smoothing();
} }
} }
@ -254,7 +261,6 @@
border: none; border: none;
background: transparent; background: transparent;
&::-webkit-progress-bar { &::-webkit-progress-bar {
background: transparent; background: transparent;
} }
@ -262,11 +268,9 @@
// Inherit from currentColor; // Inherit from currentColor;
&::-webkit-progress-value { &::-webkit-progress-value {
background: currentColor; background: currentColor;
transition: width .1s ease;
} }
&::-moz-progress-bar { &::-moz-progress-bar {
background: currentColor; background: currentColor;
transition: width .1s ease;
} }
} }
} }
@ -302,11 +306,12 @@
// Volume control // Volume control
// <input[type='range']> element // <input[type='range']> element
&-volume { // Specificty is for bootstrap compatibility
&-volume[type=range] {
display: inline-block;
vertical-align: middle; vertical-align: middle;
-webkit-appearance: none; -webkit-appearance: none;
-moz-appearance: none; -moz-appearance: none;
//height: 6px;
width: 100px; width: 100px;
margin: 0 @control-spacing 0 0; margin: 0 @control-spacing 0 0;
padding: 0; padding: 0;
@ -373,6 +378,7 @@
height: 100%; height: 100%;
width: 100%; width: 100%;
z-index: 10000000; z-index: 10000000;
background: #000;
.player-video-wrapper { .player-video-wrapper {
height: 100%; height: 100%;
@ -385,10 +391,10 @@
top: auto; top: auto;
bottom: 90px; bottom: 90px;
@media (min-width: @bp-control-split) and (max-width: (@bg-captions-large - 1)) { @media (min-width: @bp-control-split) and (max-width: (@bp-captions-large - 1)) {
bottom: 60px; bottom: 60px;
} }
@media (min-width: @bg-captions-large) { @media (min-width: @bp-captions-large) {
bottom: 80px; bottom: 80px;
} }
} }
@ -398,14 +404,15 @@
bottom: 0; bottom: 0;
left: 0; left: 0;
right: 0; right: 0;
}
}
.icon-exit-fullscreen { // When true full screen, show exit fullscreen icon
display: block; &.fullscreen-active .icon-exit-fullscreen {
display: block;
& + svg { & + svg {
display: none; display: none;
}
}
} }
} }

View File

@ -14,7 +14,7 @@
</button> </button>
<button type="button" data-player="rewind"> <button type="button" data-player="rewind">
<svg><use xlink:href="#icon-rewind"></use></svg> <svg><use xlink:href="#icon-rewind"></use></svg>
<span class="sr-only">Rewind <span class="player-seek-time">10</span> seconds</span> <span class="sr-only">Rewind <span class="player-seek-time">{seek-time}</span> seconds</span>
</button> </button>
<button type="button" aria-label="{aria-label}" data-player="play"> <button type="button" aria-label="{aria-label}" data-player="play">
<svg><use xlink:href="#icon-play"></use></svg> <svg><use xlink:href="#icon-play"></use></svg>
@ -26,7 +26,7 @@
</button> </button>
<button type="button" data-player="fast-forward"> <button type="button" data-player="fast-forward">
<svg><use xlink:href="#icon-fast-forward"></use></svg> <svg><use xlink:href="#icon-fast-forward"></use></svg>
<span class="sr-only">Fast forward <span class="player-seek-time">10</span> seconds</span> <span class="sr-only">Fast forward <span class="player-seek-time">{seek-time}</span> seconds</span>
</button> </button>
<span class="player-time"> <span class="player-time">
<span class="sr-only">Time</span> <span class="sr-only">Time</span>