This commit is contained in:
Sam Potts
2018-06-18 22:01:56 +10:00
parent 08df96a149
commit 8584f6a1db
18 changed files with 135 additions and 122 deletions
+4
View File
@@ -1,3 +1,7 @@
# v3.3.14
- Fix sprite loading regression
# v3.3.13 # v3.3.13
You guessed it, a load of awesome changes from contributors: You guessed it, a load of awesome changes from contributors:
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+17 -9
View File
@@ -143,7 +143,11 @@ import Raven from 'raven-js';
// Set a new source // Set a new source
function newSource(type, init) { function newSource(type, init) {
// Bail if new type isn't known, it's the current type, or current type is empty (video is default) and new type is video // Bail if new type isn't known, it's the current type, or current type is empty (video is default) and new type is video
if (!(type in types) || (!init && type === currentType) || (!currentType.length && type === types.video)) { if (
!(type in types) ||
(!init && type === currentType) ||
(!currentType.length && type === types.video)
) {
return; return;
} }
@@ -215,10 +219,12 @@ import Raven from 'raven-js';
case types.youtube: case types.youtube:
player.source = { player.source = {
type: 'video', type: 'video',
sources: [{ sources: [
src: 'https://youtube.com/watch?v=bTqVqk7FSmY', {
provider: 'youtube', src: 'https://youtube.com/watch?v=bTqVqk7FSmY',
}], provider: 'youtube',
},
],
}; };
break; break;
@@ -226,10 +232,12 @@ import Raven from 'raven-js';
case types.vimeo: case types.vimeo:
player.source = { player.source = {
type: 'video', type: 'video',
sources: [{ sources: [
src: 'https://vimeo.com/76979871', {
provider: 'vimeo', src: 'https://vimeo.com/76979871',
}], provider: 'vimeo',
},
],
}; };
break; break;
+48 -48
View File
@@ -1137,6 +1137,51 @@ typeof navigator === "object" && (function (global, factory) {
return Storage; return Storage;
}(); }();
// ==========================================================================
// Fetch wrapper
// Using XHR to avoid issues with older browsers
// ==========================================================================
function fetch(url) {
var responseType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'text';
return new Promise(function (resolve, reject) {
try {
var request = new XMLHttpRequest();
// Check for CORS support
if (!('withCredentials' in request)) {
return;
}
request.addEventListener('load', function () {
if (responseType === 'text') {
try {
resolve(JSON.parse(request.responseText));
} catch (e) {
resolve(request.responseText);
}
} else {
resolve(request.response);
}
});
request.addEventListener('error', function () {
throw new Error(request.status);
});
request.open('GET', url, true);
// Set the required response type
request.responseType = responseType;
request.send();
} catch (e) {
reject(e);
}
});
}
// ========================================================================== // ==========================================================================
// Load an external SVG sprite // Load an external SVG sprite
@@ -2709,51 +2754,6 @@ typeof navigator === "object" && (function (global, factory) {
} }
}; };
// ==========================================================================
// Fetch wrapper
// Using XHR to avoid issues with older browsers
// ==========================================================================
function fetch$1(url) {
var responseType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'text';
return new Promise(function (resolve, reject) {
try {
var request = new XMLHttpRequest();
// Check for CORS support
if (!('withCredentials' in request)) {
return;
}
request.addEventListener('load', function () {
if (responseType === 'text') {
try {
resolve(JSON.parse(request.responseText));
} catch (e) {
resolve(request.responseText);
}
} else {
resolve(request.response);
}
});
request.addEventListener('error', function () {
throw new Error(request.statusText);
});
request.open('GET', url, true);
// Set the required response type
request.responseType = responseType;
request.send();
} catch (e) {
reject(e);
}
});
}
// ========================================================================== // ==========================================================================
/** /**
@@ -2833,7 +2833,7 @@ typeof navigator === "object" && (function (global, factory) {
var url = parseUrl(src); var url = parseUrl(src);
if (url !== null && url.hostname !== window.location.href.hostname && ['http:', 'https:'].includes(url.protocol)) { if (url !== null && url.hostname !== window.location.href.hostname && ['http:', 'https:'].includes(url.protocol)) {
fetch$1(src, 'blob').then(function (blob) { fetch(src, 'blob').then(function (blob) {
track.setAttribute('src', window.URL.createObjectURL(blob)); track.setAttribute('src', window.URL.createObjectURL(blob));
}).catch(function () { }).catch(function () {
removeElement(track); removeElement(track);
@@ -5253,7 +5253,7 @@ typeof navigator === "object" && (function (global, factory) {
player.media = replaceElement(wrapper, player.media); player.media = replaceElement(wrapper, player.media);
// Get poster image // Get poster image
fetch$1(format(player.config.urls.vimeo.api, id), 'json').then(function (response) { fetch(format(player.config.urls.vimeo.api, id), 'json').then(function (response) {
if (is.empty(response)) { if (is.empty(response)) {
return; return;
} }
@@ -5668,7 +5668,7 @@ typeof navigator === "object" && (function (global, factory) {
if (is.string(key) && !is.empty(key)) { if (is.string(key) && !is.empty(key)) {
var url = format(this.config.urls.youtube.api, videoId, key); var url = format(this.config.urls.youtube.api, videoId, key);
fetch$1(url).then(function (result) { fetch(url).then(function (result) {
if (is.object(result)) { if (is.object(result)) {
_this2.config.title = result.items[0].snippet.title; _this2.config.title = result.items[0].snippet.title;
ui.setTitle.call(_this2); ui.setTitle.call(_this2);
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+49 -49
View File
@@ -2979,7 +2979,7 @@ typeof navigator === "object" && (function (global, factory) {
var defineProperty = _objectDp.f; var defineProperty = _objectDp.f;
var _wksDefine = function (name) { var _wksDefine = function (name) {
var $Symbol = _core.Symbol || (_core.Symbol = _global.Symbol || {}); var $Symbol = _core.Symbol || (_core.Symbol = _library ? {} : _global.Symbol || {});
if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty($Symbol, name, { value: _wksExt.f(name) }); if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty($Symbol, name, { value: _wksExt.f(name) });
}; };
@@ -6523,6 +6523,51 @@ typeof navigator === "object" && (function (global, factory) {
return Storage; return Storage;
}(); }();
// ==========================================================================
// Fetch wrapper
// Using XHR to avoid issues with older browsers
// ==========================================================================
function fetch(url) {
var responseType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'text';
return new Promise(function (resolve, reject) {
try {
var request = new XMLHttpRequest();
// Check for CORS support
if (!('withCredentials' in request)) {
return;
}
request.addEventListener('load', function () {
if (responseType === 'text') {
try {
resolve(JSON.parse(request.responseText));
} catch (e) {
resolve(request.responseText);
}
} else {
resolve(request.response);
}
});
request.addEventListener('error', function () {
throw new Error(request.status);
});
request.open('GET', url, true);
// Set the required response type
request.responseType = responseType;
request.send();
} catch (e) {
reject(e);
}
});
}
// ========================================================================== // ==========================================================================
// Load an external SVG sprite // Load an external SVG sprite
@@ -8095,51 +8140,6 @@ typeof navigator === "object" && (function (global, factory) {
} }
}; };
// ==========================================================================
// Fetch wrapper
// Using XHR to avoid issues with older browsers
// ==========================================================================
function fetch$1(url) {
var responseType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'text';
return new Promise(function (resolve, reject) {
try {
var request = new XMLHttpRequest();
// Check for CORS support
if (!('withCredentials' in request)) {
return;
}
request.addEventListener('load', function () {
if (responseType === 'text') {
try {
resolve(JSON.parse(request.responseText));
} catch (e) {
resolve(request.responseText);
}
} else {
resolve(request.response);
}
});
request.addEventListener('error', function () {
throw new Error(request.statusText);
});
request.open('GET', url, true);
// Set the required response type
request.responseType = responseType;
request.send();
} catch (e) {
reject(e);
}
});
}
// ========================================================================== // ==========================================================================
/** /**
@@ -8219,7 +8219,7 @@ typeof navigator === "object" && (function (global, factory) {
var url = parseUrl(src); var url = parseUrl(src);
if (url !== null && url.hostname !== window.location.href.hostname && ['http:', 'https:'].includes(url.protocol)) { if (url !== null && url.hostname !== window.location.href.hostname && ['http:', 'https:'].includes(url.protocol)) {
fetch$1(src, 'blob').then(function (blob) { fetch(src, 'blob').then(function (blob) {
track.setAttribute('src', window.URL.createObjectURL(blob)); track.setAttribute('src', window.URL.createObjectURL(blob));
}).catch(function () { }).catch(function () {
removeElement(track); removeElement(track);
@@ -10633,7 +10633,7 @@ typeof navigator === "object" && (function (global, factory) {
player.media = replaceElement(wrapper, player.media); player.media = replaceElement(wrapper, player.media);
// Get poster image // Get poster image
fetch$1(format(player.config.urls.vimeo.api, id), 'json').then(function (response) { fetch(format(player.config.urls.vimeo.api, id), 'json').then(function (response) {
if (is$1.empty(response)) { if (is$1.empty(response)) {
return; return;
} }
@@ -11048,7 +11048,7 @@ typeof navigator === "object" && (function (global, factory) {
if (is$1.string(key) && !is$1.empty(key)) { if (is$1.string(key) && !is$1.empty(key)) {
var url = format(this.config.urls.youtube.api, videoId, key); var url = format(this.config.urls.youtube.api, videoId, key);
fetch$1(url).then(function (result) { fetch(url).then(function (result) {
if (is$1.object(result)) { if (is$1.object(result)) {
_this2.config.title = result.items[0].snippet.title; _this2.config.title = result.items[0].snippet.title;
ui.setTitle.call(_this2); ui.setTitle.call(_this2);
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "plyr", "name": "plyr",
"version": "3.3.13", "version": "3.3.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": "https://plyr.io", "homepage": "https://plyr.io",
"main": "./dist/plyr.js", "main": "./dist/plyr.js",
+4 -4
View File
@@ -132,13 +132,13 @@ See [initialising](#initialising) for more information on advanced setups.
You can use our CDN (provided by [Fastly](https://www.fastly.com/)) for the JavaScript. There's 2 versions; one with and one without [polyfills](#polyfills). My recommendation would be to manage polyfills seperately as part of your application but to make life easier you can use the polyfilled build. You can use our CDN (provided by [Fastly](https://www.fastly.com/)) for the JavaScript. There's 2 versions; one with and one without [polyfills](#polyfills). My recommendation would be to manage polyfills seperately as part of your application but to make life easier you can use the polyfilled build.
```html ```html
<script src="https://cdn.plyr.io/3.3.13/plyr.js"></script> <script src="https://cdn.plyr.io/3.3.14/plyr.js"></script>
``` ```
...or... ...or...
```html ```html
<script src="https://cdn.plyr.io/3.3.13/plyr.polyfilled.js"></script> <script src="https://cdn.plyr.io/3.3.14/plyr.polyfilled.js"></script>
``` ```
### CSS ### CSS
@@ -152,13 +152,13 @@ Include the `plyr.css` stylsheet into your `<head>`
If you want to use our CDN (provided by [Fastly](https://www.fastly.com/)) for the default CSS, you can use the following: If you want to use our CDN (provided by [Fastly](https://www.fastly.com/)) for the default CSS, you can use the following:
```html ```html
<link rel="stylesheet" href="https://cdn.plyr.io/3.3.13/plyr.css"> <link rel="stylesheet" href="https://cdn.plyr.io/3.3.14/plyr.css">
``` ```
### SVG Sprite ### SVG Sprite
The SVG sprite is loaded automatically from our CDN (provided by [Fastly](https://www.fastly.com/)). To change this, see the [options](#options) below. For The SVG sprite is loaded automatically from our CDN (provided by [Fastly](https://www.fastly.com/)). To change this, see the [options](#options) below. For
reference, the CDN hosted SVG sprite can be found at `https://cdn.plyr.io/3.3.13/plyr.svg`. reference, the CDN hosted SVG sprite can be found at `https://cdn.plyr.io/3.3.14/plyr.svg`.
## Ads ## Ads
+1 -1
View File
@@ -1,6 +1,6 @@
// ========================================================================== // ==========================================================================
// Plyr // Plyr
// plyr.js v3.3.13 // plyr.js v3.3.14
// https://github.com/sampotts/plyr // https://github.com/sampotts/plyr
// License: The MIT License (MIT) // License: The MIT License (MIT)
// ========================================================================== // ==========================================================================
+1 -1
View File
@@ -1,6 +1,6 @@
// ========================================================================== // ==========================================================================
// Plyr Polyfilled Build // Plyr Polyfilled Build
// plyr.js v3.3.13 // plyr.js v3.3.14
// https://github.com/sampotts/plyr // https://github.com/sampotts/plyr
// License: The MIT License (MIT) // License: The MIT License (MIT)
// ========================================================================== // ==========================================================================
+1 -1
View File
@@ -26,7 +26,7 @@ export default function fetch(url, responseType = 'text') {
}); });
request.addEventListener('error', () => { request.addEventListener('error', () => {
throw new Error(request.statusText); throw new Error(request.status);
}); });
request.open('GET', url, true); request.open('GET', url, true);
+1
View File
@@ -3,6 +3,7 @@
// ========================================================================== // ==========================================================================
import Storage from './../storage'; import Storage from './../storage';
import fetch from './fetch';
import is from './is'; import is from './is';
// Load an external SVG sprite // Load an external SVG sprite