aboutsummaryrefslogtreecommitdiffstats
path: root/src/js/plyr.js
diff options
context:
space:
mode:
authorSam Potts <me@sampotts.me>2017-11-05 11:45:02 +1100
committerSam Potts <me@sampotts.me>2017-11-05 11:45:02 +1100
commit1c693df00b44961674a35243f5172716a3735b71 (patch)
tree2df8dd8d252d1f80688cd3a3549de7374dca676c /src/js/plyr.js
parent8aaa9320505baec3575bc1e92f37225729ee88f6 (diff)
downloadplyr-1c693df00b44961674a35243f5172716a3735b71.tar.lz
plyr-1c693df00b44961674a35243f5172716a3735b71.tar.xz
plyr-1c693df00b44961674a35243f5172716a3735b71.zip
src getter fix, local storage fix
Diffstat (limited to 'src/js/plyr.js')
-rw-r--r--src/js/plyr.js32
1 files changed, 7 insertions, 25 deletions
diff --git a/src/js/plyr.js b/src/js/plyr.js
index 224545a6..ce0ccdc8 100644
--- a/src/js/plyr.js
+++ b/src/js/plyr.js
@@ -196,7 +196,7 @@ class Plyr {
this.browser = utils.getBrowser();
// Load saved settings from localStorage
- this.storage = storage.setup.call(this);
+ storage.setup.call(this);
// Check for support again but with type
this.supported = support.check(this.type, this.config.inline);
@@ -350,12 +350,12 @@ class Plyr {
const isSet = !utils.is.undefined(volume);
if (utils.is.string(volume)) {
- volume = parseFloat(volume);
+ volume = Number(volume);
}
// Load volume from storage if no value specified
if (!utils.is.number(volume)) {
- ({ volume } = this.storage);
+ ({ volume } = storage.get.call(this));
}
// Use config if all else fails
@@ -446,7 +446,7 @@ class Plyr {
// Load speed from storage or default value
let speed = utils.is.number(input)
? input
- : parseFloat(this.storage.speed || this.speed.selected || this.config.speed.default);
+ : parseFloat(storage.get.call(this).speed || this.speed.selected || this.config.speed.default);
// Set min/max
if (speed < 0.1) {
@@ -474,7 +474,7 @@ class Plyr {
// Load speed from storage or default value
const quality = utils.is.string(input)
? input
- : parseFloat(this.storage.quality || this.config.quality.selected);
+ : parseFloat(storage.get.call(this).quality || this.config.quality.selected);
if (!this.config.quality.options.includes(quality)) {
this.warn(`Unsupported quality option (${quality})`);
@@ -567,25 +567,7 @@ class Plyr {
}
get src() {
- let url;
-
- switch (this.type) {
- case 'youtube':
- url = this.embed.getVideoUrl();
- break;
-
- case 'vimeo':
- this.embed.getVideoUrl.then(value => {
- url = value;
- });
- break;
-
- default:
- url = this.media.currentSrc;
- break;
- }
-
- return url;
+ return this.media.currentSrc;
}
// Poster image
@@ -668,7 +650,7 @@ class Plyr {
utils.dispatchEvent.call(this, this.media, 'captionchange');
// Clear caption
- captions.setCaption.call(this);
+ captions.set.call(this);
// Re-run setup
captions.setup.call(this);