Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 33a11fb53a | |||
| d1d41ca49a | |||
| c06e0ee5e9 | |||
| 83f80ccc40 | |||
| 069065ea3a | |||
| 1672e78041 | |||
| f687b81b70 | |||
| bbb11e611e | |||
| 90919411e9 | |||
| 1491b017a0 |
@@ -1,3 +1,15 @@
|
|||||||
|
# v3.3.7
|
||||||
|
|
||||||
|
* Poster fixes (thanks @friday)
|
||||||
|
* Grid tweak
|
||||||
|
|
||||||
|
# v3.3.6
|
||||||
|
|
||||||
|
* Vimeo fixes for mute state
|
||||||
|
* Vimeo ID fix (fixes #945)
|
||||||
|
* Use `<div>` for poster container
|
||||||
|
* Tooltip fixes for unicode languages (fixes #943)
|
||||||
|
|
||||||
# v3.3.5
|
# v3.3.5
|
||||||
|
|
||||||
* Removed `.load()` call as it breaks HLS (see #870)
|
* Removed `.load()` call as it breaks HLS (see #870)
|
||||||
|
|||||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+33
@@ -3948,6 +3948,39 @@ singleton.Client = Client;
|
|||||||
'airplay',
|
'airplay',
|
||||||
'fullscreen',
|
'fullscreen',
|
||||||
], */
|
], */
|
||||||
|
/* i18n: {
|
||||||
|
restart: '重新開始',
|
||||||
|
rewind: '快退{seektime}秒',
|
||||||
|
play: '播放',
|
||||||
|
pause: '暫停',
|
||||||
|
fastForward: '快進{seektime}秒',
|
||||||
|
seek: '尋求',
|
||||||
|
played: '發揮',
|
||||||
|
buffered: '緩衝的',
|
||||||
|
currentTime: '當前時間戳',
|
||||||
|
duration: '長短',
|
||||||
|
volume: '音量',
|
||||||
|
mute: '靜音',
|
||||||
|
unmute: '取消靜音',
|
||||||
|
enableCaptions: '開啟字幕',
|
||||||
|
disableCaptions: '關閉字幕',
|
||||||
|
enterFullscreen: '進入全螢幕',
|
||||||
|
exitFullscreen: '退出全螢幕',
|
||||||
|
frameTitle: '球員為{title}',
|
||||||
|
captions: '字幕',
|
||||||
|
settings: '設定',
|
||||||
|
speed: '速度',
|
||||||
|
normal: '正常',
|
||||||
|
quality: '質量',
|
||||||
|
loop: '循環',
|
||||||
|
start: 'Start',
|
||||||
|
end: 'End',
|
||||||
|
all: 'All',
|
||||||
|
reset: '重啟',
|
||||||
|
disabled: '殘',
|
||||||
|
enabled: '啟用',
|
||||||
|
advertisement: '廣告',
|
||||||
|
}, */
|
||||||
captions: {
|
captions: {
|
||||||
active: true
|
active: true
|
||||||
},
|
},
|
||||||
|
|||||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -74,6 +74,39 @@ import Raven from 'raven-js';
|
|||||||
'airplay',
|
'airplay',
|
||||||
'fullscreen',
|
'fullscreen',
|
||||||
], */
|
], */
|
||||||
|
/* i18n: {
|
||||||
|
restart: '重新開始',
|
||||||
|
rewind: '快退{seektime}秒',
|
||||||
|
play: '播放',
|
||||||
|
pause: '暫停',
|
||||||
|
fastForward: '快進{seektime}秒',
|
||||||
|
seek: '尋求',
|
||||||
|
played: '發揮',
|
||||||
|
buffered: '緩衝的',
|
||||||
|
currentTime: '當前時間戳',
|
||||||
|
duration: '長短',
|
||||||
|
volume: '音量',
|
||||||
|
mute: '靜音',
|
||||||
|
unmute: '取消靜音',
|
||||||
|
enableCaptions: '開啟字幕',
|
||||||
|
disableCaptions: '關閉字幕',
|
||||||
|
enterFullscreen: '進入全螢幕',
|
||||||
|
exitFullscreen: '退出全螢幕',
|
||||||
|
frameTitle: '球員為{title}',
|
||||||
|
captions: '字幕',
|
||||||
|
settings: '設定',
|
||||||
|
speed: '速度',
|
||||||
|
normal: '正常',
|
||||||
|
quality: '質量',
|
||||||
|
loop: '循環',
|
||||||
|
start: 'Start',
|
||||||
|
end: 'End',
|
||||||
|
all: 'All',
|
||||||
|
reset: '重啟',
|
||||||
|
disabled: '殘',
|
||||||
|
enabled: '啟用',
|
||||||
|
advertisement: '廣告',
|
||||||
|
}, */
|
||||||
captions: {
|
captions: {
|
||||||
active: true,
|
active: true,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -2,4 +2,4 @@
|
|||||||
// Layout
|
// Layout
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
|
|
||||||
$container-max-width: 1280px;
|
$container-max-width: 1260px;
|
||||||
|
|||||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+46
-9
@@ -1214,7 +1214,7 @@ var utils = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Vimeo
|
// Vimeo
|
||||||
if (/^https?:\/\/player.vimeo.com\/video\/\d{8,}(?=\b|\/)/.test(url)) {
|
if (/^https?:\/\/player.vimeo.com\/video\/\d{0,9}(?=\b|\/)/.test(url)) {
|
||||||
return providers.vimeo;
|
return providers.vimeo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3747,7 +3747,7 @@ var defaults$1 = {
|
|||||||
// Sprite (for icons)
|
// Sprite (for icons)
|
||||||
loadSprite: true,
|
loadSprite: true,
|
||||||
iconPrefix: 'plyr',
|
iconPrefix: 'plyr',
|
||||||
iconUrl: 'https://cdn.plyr.io/3.3.5/plyr.svg',
|
iconUrl: 'https://cdn.plyr.io/3.3.7/plyr.svg',
|
||||||
|
|
||||||
// Blank video (used to prevent errors on source change)
|
// Blank video (used to prevent errors on source change)
|
||||||
blankVideo: 'https://cdn.plyr.io/static/blank.mp4',
|
blankVideo: 'https://cdn.plyr.io/static/blank.mp4',
|
||||||
@@ -3814,10 +3814,10 @@ var defaults$1 = {
|
|||||||
// Localisation
|
// Localisation
|
||||||
i18n: {
|
i18n: {
|
||||||
restart: 'Restart',
|
restart: 'Restart',
|
||||||
rewind: 'Rewind {seektime} secs',
|
rewind: 'Rewind {seektime}s',
|
||||||
play: 'Play',
|
play: 'Play',
|
||||||
pause: 'Pause',
|
pause: 'Pause',
|
||||||
fastForward: 'Forward {seektime} secs',
|
fastForward: 'Forward {seektime}s',
|
||||||
seek: 'Seek',
|
seek: 'Seek',
|
||||||
played: 'Played',
|
played: 'Played',
|
||||||
buffered: 'Buffered',
|
buffered: 'Buffered',
|
||||||
@@ -3946,13 +3946,14 @@ var defaults$1 = {
|
|||||||
|
|
||||||
// Class hooks added to the player in different states
|
// Class hooks added to the player in different states
|
||||||
classNames: {
|
classNames: {
|
||||||
|
type: 'plyr--{0}',
|
||||||
|
provider: 'plyr--{0}',
|
||||||
video: 'plyr__video-wrapper',
|
video: 'plyr__video-wrapper',
|
||||||
embed: 'plyr__video-embed',
|
embed: 'plyr__video-embed',
|
||||||
|
embedContainer: 'plyr__video-embed__container',
|
||||||
poster: 'plyr__poster',
|
poster: 'plyr__poster',
|
||||||
ads: 'plyr__ads',
|
ads: 'plyr__ads',
|
||||||
control: 'plyr__control',
|
control: 'plyr__control',
|
||||||
type: 'plyr--{0}',
|
|
||||||
provider: 'plyr--{0}',
|
|
||||||
playing: 'plyr--playing',
|
playing: 'plyr--playing',
|
||||||
paused: 'plyr--paused',
|
paused: 'plyr--paused',
|
||||||
stopped: 'plyr--stopped',
|
stopped: 'plyr--stopped',
|
||||||
@@ -4920,6 +4921,7 @@ var vimeo = {
|
|||||||
var options = {
|
var options = {
|
||||||
loop: player.config.loop.active,
|
loop: player.config.loop.active,
|
||||||
autoplay: player.autoplay,
|
autoplay: player.autoplay,
|
||||||
|
// muted: player.muted,
|
||||||
byline: false,
|
byline: false,
|
||||||
portrait: false,
|
portrait: false,
|
||||||
title: false,
|
title: false,
|
||||||
@@ -4949,7 +4951,7 @@ var vimeo = {
|
|||||||
iframe.setAttribute('allow', 'autoplay');
|
iframe.setAttribute('allow', 'autoplay');
|
||||||
|
|
||||||
// Inject the package
|
// Inject the package
|
||||||
var wrapper = utils.createElement('div');
|
var wrapper = utils.createElement('div', { class: player.config.classNames.embedContainer });
|
||||||
wrapper.appendChild(iframe);
|
wrapper.appendChild(iframe);
|
||||||
player.media = utils.replaceElement(wrapper, player.media);
|
player.media = utils.replaceElement(wrapper, player.media);
|
||||||
|
|
||||||
@@ -4974,7 +4976,10 @@ var vimeo = {
|
|||||||
|
|
||||||
// Setup instance
|
// Setup instance
|
||||||
// https://github.com/vimeo/player.js
|
// https://github.com/vimeo/player.js
|
||||||
player.embed = new window.Vimeo.Player(iframe);
|
player.embed = new window.Vimeo.Player(iframe, {
|
||||||
|
autopause: player.config.autopause,
|
||||||
|
muted: player.muted
|
||||||
|
});
|
||||||
|
|
||||||
player.media.paused = true;
|
player.media.paused = true;
|
||||||
player.media.currentTime = 0;
|
player.media.currentTime = 0;
|
||||||
@@ -5769,7 +5774,7 @@ var media = {
|
|||||||
utils.wrap(this.media, this.elements.wrapper);
|
utils.wrap(this.media, this.elements.wrapper);
|
||||||
|
|
||||||
// Faux poster container
|
// Faux poster container
|
||||||
this.elements.poster = utils.createElement('span', {
|
this.elements.poster = utils.createElement('div', {
|
||||||
class: this.config.classNames.poster
|
class: this.config.classNames.poster
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -8041,6 +8046,38 @@ var Plyr = function () {
|
|||||||
value: function loadSprite(url, id) {
|
value: function loadSprite(url, id) {
|
||||||
return utils.loadSprite(url, id);
|
return utils.loadSprite(url, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setup multiple instances
|
||||||
|
* @param {*} selector
|
||||||
|
* @param {object} options
|
||||||
|
*/
|
||||||
|
|
||||||
|
}, {
|
||||||
|
key: 'setup',
|
||||||
|
value: function setup(selector) {
|
||||||
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||||
|
|
||||||
|
var targets = null;
|
||||||
|
|
||||||
|
if (utils.is.string(selector)) {
|
||||||
|
targets = Array.from(document.querySelectorAll(selector));
|
||||||
|
} else if (utils.is.nodeList(selector)) {
|
||||||
|
targets = Array.from(selector);
|
||||||
|
} else if (utils.is.array(selector)) {
|
||||||
|
targets = selector.filter(function (i) {
|
||||||
|
return utils.is.element(i);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (utils.is.empty(targets)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return targets.map(function (t) {
|
||||||
|
return new Plyr(t, options);
|
||||||
|
});
|
||||||
|
}
|
||||||
}]);
|
}]);
|
||||||
return Plyr;
|
return Plyr;
|
||||||
}();
|
}();
|
||||||
|
|||||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+46
-9
@@ -6248,7 +6248,7 @@ var utils = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Vimeo
|
// Vimeo
|
||||||
if (/^https?:\/\/player.vimeo.com\/video\/\d{8,}(?=\b|\/)/.test(url)) {
|
if (/^https?:\/\/player.vimeo.com\/video\/\d{0,9}(?=\b|\/)/.test(url)) {
|
||||||
return providers.vimeo;
|
return providers.vimeo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -8781,7 +8781,7 @@ var defaults$1 = {
|
|||||||
// Sprite (for icons)
|
// Sprite (for icons)
|
||||||
loadSprite: true,
|
loadSprite: true,
|
||||||
iconPrefix: 'plyr',
|
iconPrefix: 'plyr',
|
||||||
iconUrl: 'https://cdn.plyr.io/3.3.5/plyr.svg',
|
iconUrl: 'https://cdn.plyr.io/3.3.7/plyr.svg',
|
||||||
|
|
||||||
// Blank video (used to prevent errors on source change)
|
// Blank video (used to prevent errors on source change)
|
||||||
blankVideo: 'https://cdn.plyr.io/static/blank.mp4',
|
blankVideo: 'https://cdn.plyr.io/static/blank.mp4',
|
||||||
@@ -8848,10 +8848,10 @@ var defaults$1 = {
|
|||||||
// Localisation
|
// Localisation
|
||||||
i18n: {
|
i18n: {
|
||||||
restart: 'Restart',
|
restart: 'Restart',
|
||||||
rewind: 'Rewind {seektime} secs',
|
rewind: 'Rewind {seektime}s',
|
||||||
play: 'Play',
|
play: 'Play',
|
||||||
pause: 'Pause',
|
pause: 'Pause',
|
||||||
fastForward: 'Forward {seektime} secs',
|
fastForward: 'Forward {seektime}s',
|
||||||
seek: 'Seek',
|
seek: 'Seek',
|
||||||
played: 'Played',
|
played: 'Played',
|
||||||
buffered: 'Buffered',
|
buffered: 'Buffered',
|
||||||
@@ -8980,13 +8980,14 @@ var defaults$1 = {
|
|||||||
|
|
||||||
// Class hooks added to the player in different states
|
// Class hooks added to the player in different states
|
||||||
classNames: {
|
classNames: {
|
||||||
|
type: 'plyr--{0}',
|
||||||
|
provider: 'plyr--{0}',
|
||||||
video: 'plyr__video-wrapper',
|
video: 'plyr__video-wrapper',
|
||||||
embed: 'plyr__video-embed',
|
embed: 'plyr__video-embed',
|
||||||
|
embedContainer: 'plyr__video-embed__container',
|
||||||
poster: 'plyr__poster',
|
poster: 'plyr__poster',
|
||||||
ads: 'plyr__ads',
|
ads: 'plyr__ads',
|
||||||
control: 'plyr__control',
|
control: 'plyr__control',
|
||||||
type: 'plyr--{0}',
|
|
||||||
provider: 'plyr--{0}',
|
|
||||||
playing: 'plyr--playing',
|
playing: 'plyr--playing',
|
||||||
paused: 'plyr--paused',
|
paused: 'plyr--paused',
|
||||||
stopped: 'plyr--stopped',
|
stopped: 'plyr--stopped',
|
||||||
@@ -9954,6 +9955,7 @@ var vimeo = {
|
|||||||
var options = {
|
var options = {
|
||||||
loop: player.config.loop.active,
|
loop: player.config.loop.active,
|
||||||
autoplay: player.autoplay,
|
autoplay: player.autoplay,
|
||||||
|
// muted: player.muted,
|
||||||
byline: false,
|
byline: false,
|
||||||
portrait: false,
|
portrait: false,
|
||||||
title: false,
|
title: false,
|
||||||
@@ -9983,7 +9985,7 @@ var vimeo = {
|
|||||||
iframe.setAttribute('allow', 'autoplay');
|
iframe.setAttribute('allow', 'autoplay');
|
||||||
|
|
||||||
// Inject the package
|
// Inject the package
|
||||||
var wrapper = utils.createElement('div');
|
var wrapper = utils.createElement('div', { class: player.config.classNames.embedContainer });
|
||||||
wrapper.appendChild(iframe);
|
wrapper.appendChild(iframe);
|
||||||
player.media = utils.replaceElement(wrapper, player.media);
|
player.media = utils.replaceElement(wrapper, player.media);
|
||||||
|
|
||||||
@@ -10008,7 +10010,10 @@ var vimeo = {
|
|||||||
|
|
||||||
// Setup instance
|
// Setup instance
|
||||||
// https://github.com/vimeo/player.js
|
// https://github.com/vimeo/player.js
|
||||||
player.embed = new window.Vimeo.Player(iframe);
|
player.embed = new window.Vimeo.Player(iframe, {
|
||||||
|
autopause: player.config.autopause,
|
||||||
|
muted: player.muted
|
||||||
|
});
|
||||||
|
|
||||||
player.media.paused = true;
|
player.media.paused = true;
|
||||||
player.media.currentTime = 0;
|
player.media.currentTime = 0;
|
||||||
@@ -10803,7 +10808,7 @@ var media = {
|
|||||||
utils.wrap(this.media, this.elements.wrapper);
|
utils.wrap(this.media, this.elements.wrapper);
|
||||||
|
|
||||||
// Faux poster container
|
// Faux poster container
|
||||||
this.elements.poster = utils.createElement('span', {
|
this.elements.poster = utils.createElement('div', {
|
||||||
class: this.config.classNames.poster
|
class: this.config.classNames.poster
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -13075,6 +13080,38 @@ var Plyr = function () {
|
|||||||
value: function loadSprite(url, id) {
|
value: function loadSprite(url, id) {
|
||||||
return utils.loadSprite(url, id);
|
return utils.loadSprite(url, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setup multiple instances
|
||||||
|
* @param {*} selector
|
||||||
|
* @param {object} options
|
||||||
|
*/
|
||||||
|
|
||||||
|
}, {
|
||||||
|
key: 'setup',
|
||||||
|
value: function setup(selector) {
|
||||||
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||||
|
|
||||||
|
var targets = null;
|
||||||
|
|
||||||
|
if (utils.is.string(selector)) {
|
||||||
|
targets = Array.from(document.querySelectorAll(selector));
|
||||||
|
} else if (utils.is.nodeList(selector)) {
|
||||||
|
targets = Array.from(selector);
|
||||||
|
} else if (utils.is.array(selector)) {
|
||||||
|
targets = selector.filter(function (i) {
|
||||||
|
return utils.is.element(i);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (utils.is.empty(targets)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return targets.map(function (t) {
|
||||||
|
return new Plyr(t, options);
|
||||||
|
});
|
||||||
|
}
|
||||||
}]);
|
}]);
|
||||||
return Plyr;
|
return Plyr;
|
||||||
}();
|
}();
|
||||||
|
|||||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "plyr",
|
"name": "plyr",
|
||||||
"version": "3.3.5",
|
"version": "3.3.7",
|
||||||
"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",
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ See [initialising](#initialising) for more information on advanced setups.
|
|||||||
If you want to use our CDN (provided by [Fastly](https://www.fastly.com/)) for the JavaScript, you can use the following:
|
If you want to use our CDN (provided by [Fastly](https://www.fastly.com/)) for the JavaScript, you can use the following:
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<script src="https://cdn.plyr.io/3.3.5/plyr.js"></script>
|
<script src="https://cdn.plyr.io/3.3.7/plyr.js"></script>
|
||||||
```
|
```
|
||||||
|
|
||||||
_Note_: Be sure to read the [polyfills](#polyfills) section below about browser compatibility
|
_Note_: Be sure to read the [polyfills](#polyfills) section below about browser compatibility
|
||||||
@@ -144,13 +144,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.5/plyr.css">
|
<link rel="stylesheet" href="https://cdn.plyr.io/3.3.7/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.5/plyr.svg`.
|
reference, the CDN hosted SVG sprite can be found at `https://cdn.plyr.io/3.3.7/plyr.svg`.
|
||||||
|
|
||||||
## Ads
|
## Ads
|
||||||
|
|
||||||
@@ -210,7 +210,7 @@ You can specify a range of arguments for the constructor to use:
|
|||||||
* A [`NodeList]`(https://developer.mozilla.org/en-US/docs/Web/API/NodeList)
|
* A [`NodeList]`(https://developer.mozilla.org/en-US/docs/Web/API/NodeList)
|
||||||
* A [jQuery](https://jquery.com) object
|
* A [jQuery](https://jquery.com) object
|
||||||
|
|
||||||
_Note_: If a `NodeList`, `Array`, or jQuery object are passed, the first element will be used for setup.
|
_Note_: If a `NodeList`, `Array`, or jQuery object are passed, the first element will be used for setup. To setup multiple players, see [setting up multiple players](#setting-up-multiple-players) below.
|
||||||
|
|
||||||
Here's some examples
|
Here's some examples
|
||||||
|
|
||||||
@@ -226,20 +226,32 @@ Passing a [HTMLElement](https://developer.mozilla.org/en/docs/Web/API/HTMLElemen
|
|||||||
const player = new Plyr(document.getElementById('player'));
|
const player = new Plyr(document.getElementById('player'));
|
||||||
```
|
```
|
||||||
|
|
||||||
Passing a [NodeList](https://developer.mozilla.org/en-US/docs/Web/API/NodeList):
|
Passing a [NodeList](https://developer.mozilla.org/en-US/docs/Web/API/NodeList) (see note below):
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
const player = new Plyr(document.querySelectorAll('.js-player'));
|
const player = new Plyr(document.querySelectorAll('.js-player'));
|
||||||
```
|
```
|
||||||
|
|
||||||
The NodeList, HTMLElement or string selector can be the target `<video>`, `<audio>`, or `<div>` wrapper for embeds
|
The NodeList, HTMLElement or string selector can be the target `<video>`, `<audio>`, or `<div>` wrapper for embeds.
|
||||||
|
|
||||||
##### Setting up multiple players
|
##### Setting up multiple players
|
||||||
|
|
||||||
|
You have two choices here. You can either use a simple array loop to map the constructor:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
const players = Array.from(document.querySelectorAll('.js-player')).map(player => new Plyr(player));
|
const players = Array.from(document.querySelectorAll('.js-player')).map(p => new Plyr(p));
|
||||||
```
|
```
|
||||||
|
|
||||||
|
...or use a static method where you can pass a [string selector](https://developer.mozilla.org/en-US/docs/Web/API/NodeList), a [NodeList](https://developer.mozilla.org/en-US/docs/Web/API/NodeList) or an [Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) of elements:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
const players = Plyr.setup('.js-player');
|
||||||
|
```
|
||||||
|
|
||||||
|
Both options will also return an array of instances in the order of they were in the DOM for the string selector or the source NodeList or Array.
|
||||||
|
|
||||||
|
##### Passing options
|
||||||
|
|
||||||
The second argument for the constructor is the [options](#options) object:
|
The second argument for the constructor is the [options](#options) object:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
@@ -248,7 +260,7 @@ const player = new Plyr('#player', {
|
|||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
The constructor will return a Plyr object that can be used with the [API](#api) methods. See the [API](#api) section for more info.
|
In all cases, the constructor will return a Plyr object that can be used with the [API](#api) methods. See the [API](#api) section for more info.
|
||||||
|
|
||||||
#### Options
|
#### Options
|
||||||
|
|
||||||
|
|||||||
+6
-5
@@ -56,7 +56,7 @@ const defaults = {
|
|||||||
// Sprite (for icons)
|
// Sprite (for icons)
|
||||||
loadSprite: true,
|
loadSprite: true,
|
||||||
iconPrefix: 'plyr',
|
iconPrefix: 'plyr',
|
||||||
iconUrl: 'https://cdn.plyr.io/3.3.5/plyr.svg',
|
iconUrl: 'https://cdn.plyr.io/3.3.7/plyr.svg',
|
||||||
|
|
||||||
// Blank video (used to prevent errors on source change)
|
// Blank video (used to prevent errors on source change)
|
||||||
blankVideo: 'https://cdn.plyr.io/static/blank.mp4',
|
blankVideo: 'https://cdn.plyr.io/static/blank.mp4',
|
||||||
@@ -157,10 +157,10 @@ const defaults = {
|
|||||||
// Localisation
|
// Localisation
|
||||||
i18n: {
|
i18n: {
|
||||||
restart: 'Restart',
|
restart: 'Restart',
|
||||||
rewind: 'Rewind {seektime} secs',
|
rewind: 'Rewind {seektime}s',
|
||||||
play: 'Play',
|
play: 'Play',
|
||||||
pause: 'Pause',
|
pause: 'Pause',
|
||||||
fastForward: 'Forward {seektime} secs',
|
fastForward: 'Forward {seektime}s',
|
||||||
seek: 'Seek',
|
seek: 'Seek',
|
||||||
played: 'Played',
|
played: 'Played',
|
||||||
buffered: 'Buffered',
|
buffered: 'Buffered',
|
||||||
@@ -326,13 +326,14 @@ const defaults = {
|
|||||||
|
|
||||||
// Class hooks added to the player in different states
|
// Class hooks added to the player in different states
|
||||||
classNames: {
|
classNames: {
|
||||||
|
type: 'plyr--{0}',
|
||||||
|
provider: 'plyr--{0}',
|
||||||
video: 'plyr__video-wrapper',
|
video: 'plyr__video-wrapper',
|
||||||
embed: 'plyr__video-embed',
|
embed: 'plyr__video-embed',
|
||||||
|
embedContainer: 'plyr__video-embed__container',
|
||||||
poster: 'plyr__poster',
|
poster: 'plyr__poster',
|
||||||
ads: 'plyr__ads',
|
ads: 'plyr__ads',
|
||||||
control: 'plyr__control',
|
control: 'plyr__control',
|
||||||
type: 'plyr--{0}',
|
|
||||||
provider: 'plyr--{0}',
|
|
||||||
playing: 'plyr--playing',
|
playing: 'plyr--playing',
|
||||||
paused: 'plyr--paused',
|
paused: 'plyr--paused',
|
||||||
stopped: 'plyr--stopped',
|
stopped: 'plyr--stopped',
|
||||||
|
|||||||
+1
-1
@@ -39,7 +39,7 @@ const media = {
|
|||||||
utils.wrap(this.media, this.elements.wrapper);
|
utils.wrap(this.media, this.elements.wrapper);
|
||||||
|
|
||||||
// Faux poster container
|
// Faux poster container
|
||||||
this.elements.poster = utils.createElement('span', {
|
this.elements.poster = utils.createElement('div', {
|
||||||
class: this.config.classNames.poster,
|
class: this.config.classNames.poster,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ const vimeo = {
|
|||||||
const options = {
|
const options = {
|
||||||
loop: player.config.loop.active,
|
loop: player.config.loop.active,
|
||||||
autoplay: player.autoplay,
|
autoplay: player.autoplay,
|
||||||
|
// muted: player.muted,
|
||||||
byline: false,
|
byline: false,
|
||||||
portrait: false,
|
portrait: false,
|
||||||
title: false,
|
title: false,
|
||||||
@@ -82,7 +83,7 @@ const vimeo = {
|
|||||||
iframe.setAttribute('allow', 'autoplay');
|
iframe.setAttribute('allow', 'autoplay');
|
||||||
|
|
||||||
// Inject the package
|
// Inject the package
|
||||||
const wrapper = utils.createElement('div');
|
const wrapper = utils.createElement('div', { class: player.config.classNames.embedContainer });
|
||||||
wrapper.appendChild(iframe);
|
wrapper.appendChild(iframe);
|
||||||
player.media = utils.replaceElement(wrapper, player.media);
|
player.media = utils.replaceElement(wrapper, player.media);
|
||||||
|
|
||||||
@@ -107,7 +108,10 @@ const vimeo = {
|
|||||||
|
|
||||||
// Setup instance
|
// Setup instance
|
||||||
// https://github.com/vimeo/player.js
|
// https://github.com/vimeo/player.js
|
||||||
player.embed = new window.Vimeo.Player(iframe);
|
player.embed = new window.Vimeo.Player(iframe, {
|
||||||
|
autopause: player.config.autopause,
|
||||||
|
muted: player.muted,
|
||||||
|
});
|
||||||
|
|
||||||
player.media.paused = true;
|
player.media.paused = true;
|
||||||
player.media.currentTime = 0;
|
player.media.currentTime = 0;
|
||||||
|
|||||||
+24
-1
@@ -1,6 +1,6 @@
|
|||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
// Plyr
|
// Plyr
|
||||||
// plyr.js v3.3.5
|
// plyr.js v3.3.7
|
||||||
// https://github.com/sampotts/plyr
|
// https://github.com/sampotts/plyr
|
||||||
// License: The MIT License (MIT)
|
// License: The MIT License (MIT)
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
@@ -1244,6 +1244,29 @@ class Plyr {
|
|||||||
static loadSprite(url, id) {
|
static loadSprite(url, id) {
|
||||||
return utils.loadSprite(url, id);
|
return utils.loadSprite(url, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setup multiple instances
|
||||||
|
* @param {*} selector
|
||||||
|
* @param {object} options
|
||||||
|
*/
|
||||||
|
static setup(selector, options = {}) {
|
||||||
|
let targets = null;
|
||||||
|
|
||||||
|
if (utils.is.string(selector)) {
|
||||||
|
targets = Array.from(document.querySelectorAll(selector));
|
||||||
|
} else if (utils.is.nodeList(selector)) {
|
||||||
|
targets = Array.from(selector);
|
||||||
|
} else if (utils.is.array(selector)) {
|
||||||
|
targets = selector.filter(i => utils.is.element(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (utils.is.empty(targets)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return targets.map(t => new Plyr(t, options));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Plyr;
|
export default Plyr;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
// Plyr Polyfilled Build
|
// Plyr Polyfilled Build
|
||||||
// plyr.js v3.3.5
|
// plyr.js v3.3.7
|
||||||
// https://github.com/sampotts/plyr
|
// https://github.com/sampotts/plyr
|
||||||
// License: The MIT License (MIT)
|
// License: The MIT License (MIT)
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
|
|||||||
+1
-1
@@ -723,7 +723,7 @@ const utils = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Vimeo
|
// Vimeo
|
||||||
if (/^https?:\/\/player.vimeo.com\/video\/\d{8,}(?=\b|\/)/.test(url)) {
|
if (/^https?:\/\/player.vimeo.com\/video\/\d{0,9}(?=\b|\/)/.test(url)) {
|
||||||
return providers.vimeo;
|
return providers.vimeo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,8 +32,8 @@ $embed-padding: ((100 / 16) * 9);
|
|||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Vimeo hack
|
// Only used for Vimeo
|
||||||
> div {
|
> .plyr__video-embed__container {
|
||||||
padding-bottom: to-percentage($height);
|
padding-bottom: to-percentage($height);
|
||||||
position: relative;
|
position: relative;
|
||||||
transform: translateY(-$offset);
|
transform: translateY(-$offset);
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
background-color: #000;
|
background-color: #000;
|
||||||
background-position: 50% 50%;
|
background-position: 50% 50%;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
background-size: 100% 100%;
|
background-size: contain;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
left: 0;
|
left: 0;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
@@ -15,6 +15,7 @@
|
|||||||
transition: opacity 0.3s ease;
|
transition: opacity 0.3s ease;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.plyr--stopped .plyr__poster {
|
.plyr--stopped .plyr__poster {
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
transform: translate(-50%, 10px) scale(0.8);
|
transform: translate(-50%, 10px) scale(0.8);
|
||||||
transform-origin: 50% 100%;
|
transform-origin: 50% 100%;
|
||||||
transition: transform 0.2s 0.1s ease, opacity 0.2s 0.1s ease;
|
transition: transform 0.2s 0.1s ease, opacity 0.2s 0.1s ease;
|
||||||
|
white-space: nowrap;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
|
|
||||||
// The background triangle
|
// The background triangle
|
||||||
|
|||||||
@@ -4857,8 +4857,8 @@ nanomatch@^1.2.9:
|
|||||||
to-regex "^3.0.1"
|
to-regex "^3.0.1"
|
||||||
|
|
||||||
natives@^1.1.0:
|
natives@^1.1.0:
|
||||||
version "1.1.1"
|
version "1.1.3"
|
||||||
resolved "https://registry.yarnpkg.com/natives/-/natives-1.1.1.tgz#011acce1f7cbd87f7ba6b3093d6cd9392be1c574"
|
resolved "https://registry.yarnpkg.com/natives/-/natives-1.1.3.tgz#44a579be64507ea2d6ed1ca04a9415915cf75558"
|
||||||
|
|
||||||
natural-compare@^1.4.0:
|
natural-compare@^1.4.0:
|
||||||
version "1.4.0"
|
version "1.4.0"
|
||||||
|
|||||||
Reference in New Issue
Block a user