Fix for local storage issue
This commit is contained in:
33
dist/plyr.js
vendored
33
dist/plyr.js
vendored
@ -77,7 +77,7 @@ var defaults = {
|
||||
// Sprite (for icons)
|
||||
loadSprite: true,
|
||||
iconPrefix: 'plyr',
|
||||
iconUrl: 'https://cdn.plyr.io/3.0.0/plyr.svg',
|
||||
iconUrl: 'https://cdn.plyr.io/3.0.1/plyr.svg',
|
||||
|
||||
// Blank video (used to prevent errors on source change)
|
||||
blankVideo: 'https://cdn.plyr.io/static/blank.mp4',
|
||||
@ -4306,9 +4306,13 @@ var Storage = function () {
|
||||
createClass(Storage, [{
|
||||
key: 'get',
|
||||
value: function get$$1(key) {
|
||||
if (!Storage.supported) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var store = window.localStorage.getItem(this.key);
|
||||
|
||||
if (!Storage.supported || utils.is.empty(store)) {
|
||||
if (utils.is.empty(store)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -4346,17 +4350,18 @@ var Storage = function () {
|
||||
}], [{
|
||||
key: 'supported',
|
||||
get: function get$$1() {
|
||||
if (!('localStorage' in window)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var test = '___test';
|
||||
|
||||
// Try to use it (it might be disabled, e.g. user is in private mode)
|
||||
// see: https://github.com/sampotts/plyr/issues/131
|
||||
try {
|
||||
if (!('localStorage' in window)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var test = '___test';
|
||||
|
||||
// Try to use it (it might be disabled, e.g. user is in private mode)
|
||||
// see: https://github.com/sampotts/plyr/issues/131
|
||||
window.localStorage.setItem(test, test);
|
||||
window.localStorage.removeItem(test);
|
||||
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
@ -6021,7 +6026,7 @@ var source = {
|
||||
|
||||
// ==========================================================================
|
||||
// Plyr
|
||||
// plyr.js v3.0.0
|
||||
// plyr.js v3.0.1
|
||||
// https://github.com/sampotts/plyr
|
||||
// License: The MIT License (MIT)
|
||||
// ==========================================================================
|
||||
@ -6305,6 +6310,10 @@ var Plyr = function () {
|
||||
value: function play() {
|
||||
var _this2 = this;
|
||||
|
||||
if (!utils.is.function(this.media.play)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// If ads are enabled, wait for them first
|
||||
if (this.ads.enabled && !this.ads.initialized) {
|
||||
return this.ads.managerPromise.then(function () {
|
||||
@ -6325,7 +6334,7 @@ var Plyr = function () {
|
||||
}, {
|
||||
key: 'pause',
|
||||
value: function pause() {
|
||||
if (!this.playing) {
|
||||
if (!this.playing || !utils.is.function(this.media.pause)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user