Volume storage fix (Fixes #171)

This commit is contained in:
Sam Potts 2016-02-25 19:35:03 +11:00
parent ab329b99df
commit 1ecbec4044
4 changed files with 13 additions and 9 deletions

2
dist/plyr.js vendored

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{ {
"name": "plyr", "name": "plyr",
"version": "1.5.13", "version": "1.5.14",
"description": "A simple, accessible and customizable HTML5, YouTube and Vimeo media player", "description": "A simple, accessible and customizable HTML5, YouTube and Vimeo media player",
"homepage": "http://plyr.io", "homepage": "http://plyr.io",
"main": "src/js/plyr.js", "main": "src/js/plyr.js",

View File

@ -40,7 +40,7 @@ If you have any cool ideas or features, please let me know by [creating an issue
Check `docs/index.html` and `docs/dist/docs.js` for an example setup. Check `docs/index.html` and `docs/dist/docs.js` for an example setup.
**Heads up:** the example `index.html` file needs to be served from a webserver (such as Apache, Nginx, IIS or similar) unless you change the file sources to include http or https. e.g. change `//cdn.plyr.io/1.5.13/plyr.js` to `https://cdn.plyr.io/1.5.13/plyr.js` **Heads up:** the example `index.html` file needs to be served from a webserver (such as Apache, Nginx, IIS or similar) unless you change the file sources to include http or https. e.g. change `//cdn.plyr.io/1.5.14/plyr.js` to `https://cdn.plyr.io/1.5.14/plyr.js`
### Node Package Manager (NPM) ### Node Package Manager (NPM)
Using NPM, you can grab Plyr: Using NPM, you can grab Plyr:
@ -69,11 +69,11 @@ More info is on [npm](https://www.npmjs.com/package/ember-cli-plyr) and [GitHub]
If you want to use our CDN, you can use the following: If you want to use our CDN, you can use the following:
```html ```html
<link rel="stylesheet" href="https://cdn.plyr.io/1.5.13/plyr.css"> <link rel="stylesheet" href="https://cdn.plyr.io/1.5.14/plyr.css">
<script src="https://cdn.plyr.io/1.5.13/plyr.js"></script> <script src="https://cdn.plyr.io/1.5.14/plyr.js"></script>
``` ```
You can also access the `sprite.svg` file at `https://cdn.plyr.io/1.5.13/sprite.svg`. You can also access the `sprite.svg` file at `https://cdn.plyr.io/1.5.14/sprite.svg`.
### CSS & Styling ### CSS & Styling
If you want to use the default css, add the `plyr.css` file from `/dist` into your head, or even better use `plyr.less` or `plyr.sass` file included in `/src` in your build to save a request. If you want to use the default css, add the `plyr.css` file from `/dist` into your head, or even better use `plyr.less` or `plyr.sass` file included in `/src` in your build to save a request.
@ -175,7 +175,7 @@ Be sure to [validate your caption files](https://quuz.org/webvtt/)
Here's an example of a default setup: Here's an example of a default setup:
```html ```html
<script src="https://cdn.plyr.io/1.5.13/plyr.js"></script> <script src="https://cdn.plyr.io/1.5.14/plyr.js"></script>
<script>plyr.setup();</script> <script>plyr.setup();</script>
``` ```

View File

@ -107,7 +107,7 @@
}, },
storage: { storage: {
enabled: true, enabled: true,
key: 'plyr_volume' key: 'plyr'
}, },
controls: ['restart', 'rewind', 'play', 'fast-forward', 'current-time', 'duration', 'mute', 'volume', 'captions', 'fullscreen'], controls: ['restart', 'rewind', 'play', 'fast-forward', 'current-time', 'duration', 'mute', 'volume', 'captions', 'fullscreen'],
i18n: { i18n: {
@ -1869,11 +1869,15 @@
if (config.storage.enabled && _storage().supported) { if (config.storage.enabled && _storage().supported) {
volume = window.localStorage.getItem(config.storage.key); volume = window.localStorage.getItem(config.storage.key);
// Clean up old volume
// https://github.com/Selz/plyr/issues/171
window.localStorage.removeItem('plyr-volume');
} }
} }
// Use config if all else fails // Use config if all else fails
if(isNaN(volume)) { if(volume === null || isNaN(volume)) {
volume = config.volume; volume = config.volume;
} }