Updates to docs, fix for seek time in controls
This commit is contained in:
parent
dd17100a53
commit
35ac236a00
80
controls.md
Normal file
80
controls.md
Normal 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/js/docs.js
vendored
2
dist/js/docs.js
vendored
File diff suppressed because one or more lines are too long
2
dist/js/plyr.js
vendored
2
dist/js/plyr.js
vendored
File diff suppressed because one or more lines are too long
2
dist/js/templates.js
vendored
2
dist/js/templates.js
vendored
@ -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: { }});
|
66
readme.md
66
readme.md
@ -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:
|
||||||
@ -112,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>
|
||||||
@ -141,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>—</code></td>
|
<td><code>—</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>
|
||||||
@ -154,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>
|
||||||
@ -175,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>—</td>
|
<td>—</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>
|
||||||
@ -283,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>✖¹</td>
|
||||||
|
<td>✔²</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
¹ Native player used (no support for `<progress>` or `<input type="range">`)
|
||||||
|
² 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:
|
||||||
|
|
||||||
@ -305,6 +323,16 @@ If you find anything weird with Plyr, please let us know using the Github issues
|
|||||||
## Author
|
## Author
|
||||||
Plyr is developed by Sam Potts ([@sam_potts](https://twitter.com/sam_potts)) ([sampotts.me](http://sampotts.me))
|
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)
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
var defaults = {
|
var defaults = {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
debug: false,
|
debug: false,
|
||||||
seekInterval: 10,
|
seekTime: 10,
|
||||||
volume: 5,
|
volume: 5,
|
||||||
click: true,
|
click: true,
|
||||||
selectors: {
|
selectors: {
|
||||||
@ -435,6 +435,9 @@
|
|||||||
// Replace aria label instances
|
// Replace aria label instances
|
||||||
html = _replaceAll(html, "{aria-label}", config.playAriaLabel);
|
html = _replaceAll(html, "{aria-label}", config.playAriaLabel);
|
||||||
|
|
||||||
|
// Replace seek time instances
|
||||||
|
html = _replaceAll(html, "{seek-time}", config.seekTime);
|
||||||
|
|
||||||
// Replace all id references
|
// Replace all id references
|
||||||
html = _replaceAll(html, "{id}", player.random);
|
html = _replaceAll(html, "{id}", player.random);
|
||||||
|
|
||||||
@ -688,8 +691,8 @@
|
|||||||
// Setup seeking
|
// Setup seeking
|
||||||
function _setupSeeking() {
|
function _setupSeeking() {
|
||||||
// Update number of seconds in rewind and fast forward buttons
|
// Update number of seconds in rewind and fast forward buttons
|
||||||
player.seekTime[0].innerHTML = config.seekInterval;
|
player.seekTime[0].innerHTML = config.seekTime;
|
||||||
player.seekTime[1].innerHTML = config.seekInterval;
|
player.seekTime[1].innerHTML = config.seekTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup fullscreen
|
// Setup fullscreen
|
||||||
@ -735,13 +738,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Rewind
|
// Rewind
|
||||||
function _rewind(seekInterval) {
|
function _rewind(seekTime) {
|
||||||
// Use default if needed
|
// Use default if needed
|
||||||
if(typeof seekInterval !== "number") {
|
if(typeof seekTime !== "number") {
|
||||||
seekInterval = config.seekInterval;
|
seekTime = config.seekTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
var targetTime = player.media.currentTime - seekInterval;
|
var targetTime = player.media.currentTime - seekTime;
|
||||||
|
|
||||||
if (targetTime < 0) {
|
if (targetTime < 0) {
|
||||||
player.media.currentTime = 0;
|
player.media.currentTime = 0;
|
||||||
@ -756,13 +759,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fast forward
|
// Fast forward
|
||||||
function _forward(seekInterval) {
|
function _forward(seekTime) {
|
||||||
// Use default if needed
|
// Use default if needed
|
||||||
if(typeof seekInterval !== "number") {
|
if(typeof seekTime !== "number") {
|
||||||
seekInterval = config.seekInterval;
|
seekTime = config.seekTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
var targetTime = player.media.currentTime + seekInterval;
|
var targetTime = player.media.currentTime + seekTime;
|
||||||
|
|
||||||
if (targetTime > player.media.duration) {
|
if (targetTime > player.media.duration) {
|
||||||
player.media.currentTime = player.media.duration;
|
player.media.currentTime = player.media.duration;
|
||||||
|
@ -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>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user