Compare commits
59 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e2fb922d73 | |||
| a6cc85c437 | |||
| d061be5d2b | |||
| dc2feedd79 | |||
| f8e4ba36e5 | |||
| f3d5389587 | |||
| d9ffb10b93 | |||
| 1186377b25 | |||
| 8616895e57 | |||
| 2cf5a22c85 | |||
| 763eb2df80 | |||
| 8bbf66a0fb | |||
| 676b46e4a7 | |||
| 82a119c67f | |||
| 6fd4389887 | |||
| 1e1a548459 | |||
| 8db9b53a8f | |||
| ba33fd8277 | |||
| 8071feda18 | |||
| a49b73cd01 | |||
| 8226493a9e | |||
| 38a8a0e8a1 | |||
| 6eeca8b5d1 | |||
| bf51ce4414 | |||
| 5ad614e251 | |||
| 93c890603d | |||
| 29fb4dfc2b | |||
| 7de9fd1d65 | |||
| 566c059832 | |||
| 0c9572f0a1 | |||
| c99607c85a | |||
| e2010bcd1a | |||
| e9f1b55f51 | |||
| 4f5152f526 | |||
| de9b53045a | |||
| df458c5e7a | |||
| e206554146 | |||
| e422806c44 | |||
| b6ddf144f4 | |||
| 86406ee59a | |||
| 81c5477f1d | |||
| ac64350a5f | |||
| 333619f1e3 | |||
| 17dcb63c26 | |||
| e04b90c9c0 | |||
| f62e1da01a | |||
| 2fe949629f | |||
| 20f2ddc11d | |||
| 004528a65c | |||
| 39c7bd40c2 | |||
| 43879e08f4 | |||
| 5ed7aa6620 | |||
| 47750b6aad | |||
| de7832eb8b | |||
| 52ea5bd0ab | |||
| 457d112df7 | |||
| 22cdec9d38 | |||
| d72e502107 | |||
| 94055f0772 |
+7
-12
@@ -5,8 +5,12 @@
|
|||||||
"browser": true,
|
"browser": true,
|
||||||
"es6": true
|
"es6": true
|
||||||
},
|
},
|
||||||
"globals": { "Plyr": false, "jQuery": false },
|
"globals": {
|
||||||
|
"Plyr": false,
|
||||||
|
"jQuery": false
|
||||||
|
},
|
||||||
"rules": {
|
"rules": {
|
||||||
|
"import/no-cycle": 1,
|
||||||
"no-const-assign": 1,
|
"no-const-assign": 1,
|
||||||
"no-shadow": 0,
|
"no-shadow": 0,
|
||||||
"no-this-before-super": 1,
|
"no-this-before-super": 1,
|
||||||
@@ -21,17 +25,8 @@
|
|||||||
"eqeqeq": [2, "always"],
|
"eqeqeq": [2, "always"],
|
||||||
"one-var": [2, "never"],
|
"one-var": [2, "never"],
|
||||||
"comma-dangle": [2, "always-multiline"],
|
"comma-dangle": [2, "always-multiline"],
|
||||||
"no-restricted-globals": [
|
"spaced-comment": [2, "always"],
|
||||||
"error",
|
"no-restricted-globals": 2,
|
||||||
{
|
|
||||||
"name": "event",
|
|
||||||
"message": "Use local parameter instead."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "error",
|
|
||||||
"message": "Use local parameter instead."
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"no-param-reassign": [2, { "props": false }]
|
"no-param-reassign": [2, { "props": false }]
|
||||||
},
|
},
|
||||||
"parserOptions": {
|
"parserOptions": {
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
<!---
|
*Please _use this issue template_ as it makes replicating and fixing the issue easier for us. If you decide not to use it or you are vague your issue may be close instantly.*
|
||||||
Please use this issue template as it makes replicating and fixing the issue easier!
|
|
||||||
--->
|
|
||||||
|
|
||||||
### Expected behaviour
|
### Expected behaviour
|
||||||
|
|
||||||
@@ -14,4 +12,4 @@ Please use this issue template as it makes replicating and fixing the issue easi
|
|||||||
- Version:
|
- Version:
|
||||||
|
|
||||||
### Steps to reproduce
|
### Steps to reproduce
|
||||||
-
|
-
|
||||||
|
|||||||
@@ -4,5 +4,5 @@
|
|||||||
|
|
||||||
### Checklist
|
### Checklist
|
||||||
- [ ] Use `develop` as the base branch
|
- [ ] Use `develop` as the base branch
|
||||||
- [ ] Exclude the gulp build from the PR
|
- [ ] Exclude the gulp build (`/dist` changes) from the PR
|
||||||
- [ ] Test on [supported browsers](https://github.com/sampotts/plyr#browser-support)
|
- [ ] Test on [supported browsers](https://github.com/sampotts/plyr#browser-support)
|
||||||
|
|||||||
+3
-3
@@ -5,7 +5,7 @@ aws.json
|
|||||||
!dist/blank.mp4
|
!dist/blank.mp4
|
||||||
index-*.html
|
index-*.html
|
||||||
npm-debug.log
|
npm-debug.log
|
||||||
|
yarn-error.log
|
||||||
|
package-lock.json
|
||||||
*.webm
|
*.webm
|
||||||
/package-lock.json
|
.idea/
|
||||||
.idea/
|
|
||||||
|
|
||||||
@@ -2,3 +2,10 @@ demo
|
|||||||
.github
|
.github
|
||||||
.vscode
|
.vscode
|
||||||
*.code-workspace
|
*.code-workspace
|
||||||
|
aws.json
|
||||||
|
bundles.json
|
||||||
|
yarn.lock
|
||||||
|
package-lock.json
|
||||||
|
*.mp4
|
||||||
|
*.webm
|
||||||
|
!dist/blank.mp4
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
{
|
{
|
||||||
"useTabs": false,
|
"useTabs": false,
|
||||||
"tabWidth": 4,
|
"tabWidth": 4,
|
||||||
"printWidth": 120,
|
|
||||||
"singleQuote": true,
|
"singleQuote": true,
|
||||||
"trailingComma": "all"
|
"trailingComma": "all"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
linters:
|
||||||
|
eslint:
|
||||||
|
files:
|
||||||
|
ignore:
|
||||||
|
- 'node_modules/*'
|
||||||
+5
-4
@@ -1,7 +1,8 @@
|
|||||||
language: node_js
|
language: node_js
|
||||||
node_js:
|
node_js: lts/*
|
||||||
- 'lts/*'
|
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- npm run lint
|
- bash .travis/prevent-base-master.sh
|
||||||
- npm run build
|
- bash .travis/omit-dist.sh
|
||||||
|
- npm run lint
|
||||||
|
- npm run build
|
||||||
|
|||||||
Executable
+5
@@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
if [ $TRAVIS_BRANCH == "develop" ] && $(git diff --name-only $TRAVIS_COMMIT_RANGE | grep -qE "^(demo/)?dist/"); then
|
||||||
|
echo 'Build output ("dist" and "demo/dist") not permitted in develop' >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
Executable
+5
@@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
if [ "$TRAVIS_PULL_REQUEST" != "false" ] && [ $TRAVIS_BRANCH == "master" ] && $(git diff --name-only $TRAVIS_COMMIT_RANGE | grep -q "^src/"); then
|
||||||
|
echo 'The base branch for pull requests must be "develop"' >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
-33
@@ -1,33 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "plyr",
|
|
||||||
"description": "A simple HTML5 media player using custom controls",
|
|
||||||
"homepage": "http://plyr.io",
|
|
||||||
"keywords": [
|
|
||||||
"Audio",
|
|
||||||
"Video",
|
|
||||||
"HTML5 Audio",
|
|
||||||
"HTML5 Video"
|
|
||||||
],
|
|
||||||
"authors": [
|
|
||||||
"Sam Potts <sam@potts.es>"
|
|
||||||
],
|
|
||||||
"dependencies": {},
|
|
||||||
"main": [
|
|
||||||
"dist/plyr.css",
|
|
||||||
"dist/plyr.js",
|
|
||||||
"dist/plyr.svg",
|
|
||||||
"src/less/plyr.less",
|
|
||||||
"src/scss/plyr.scss",
|
|
||||||
"src/js/plyr.js"
|
|
||||||
],
|
|
||||||
"ignore": [
|
|
||||||
"node_modules",
|
|
||||||
"bower_components",
|
|
||||||
".gitignore"
|
|
||||||
],
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git://github.com/sampotts/plyr.git"
|
|
||||||
},
|
|
||||||
"license": "MIT"
|
|
||||||
}
|
|
||||||
@@ -1,3 +1,34 @@
|
|||||||
|
# v3.3.22
|
||||||
|
|
||||||
|
- Travis & CI improvements (thanks @friday)
|
||||||
|
- Add navigator.languages fallback for iOS 9 (thanks @friday)
|
||||||
|
|
||||||
|
# v3.3.21
|
||||||
|
|
||||||
|
- Hide currentTime and progress for streams (thanks @mimse)
|
||||||
|
- Fixed condition check (thanks @mimse)
|
||||||
|
- Handle undefined this.player.elements.buttons.play (thanks @klassicd)
|
||||||
|
- Fix captions.toggle() if there is no toggle button (thanks @friday)
|
||||||
|
|
||||||
|
# v3.3.20
|
||||||
|
|
||||||
|
- Fix for bug where controls wouldn't show on hover over YouTube video
|
||||||
|
|
||||||
|
# v3.3.19
|
||||||
|
|
||||||
|
- Remove `pointer-events: none` on embed `<iframe>` to comply with YouTube ToS
|
||||||
|
|
||||||
|
# 3.3.18
|
||||||
|
|
||||||
|
- Ads are now only supported on HTML5 videos as it violates terms of service for YouTube and Vimeo 😢
|
||||||
|
- Fix i18n defaults path on README (thanks @meyt!)
|
||||||
|
- Minor increaseVolume and decreaseVolume changes (thanks @friday!)
|
||||||
|
|
||||||
|
# v3.3.17
|
||||||
|
|
||||||
|
- Fix YouTube muting after seeking with the progress slider (thanks @friday!)
|
||||||
|
- Respect preload="none" when setting quality if the media hasn't been loaded some other way (thanks @friday!)
|
||||||
|
|
||||||
# v3.3.16
|
# v3.3.16
|
||||||
|
|
||||||
- Fixed regression relating the play button status (fixes #1048)
|
- Fixed regression relating the play button status (fixes #1048)
|
||||||
|
|||||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+10
-2
@@ -1874,7 +1874,7 @@ typeof navigator === "object" && (function () {
|
|||||||
// webpack (using a build step causes webpack #1617). Grunt verifies that
|
// webpack (using a build step causes webpack #1617). Grunt verifies that
|
||||||
// this value matches package.json during build.
|
// this value matches package.json during build.
|
||||||
// See: https://github.com/getsentry/raven-js/issues/465
|
// See: https://github.com/getsentry/raven-js/issues/465
|
||||||
VERSION: '3.26.2',
|
VERSION: '3.26.3',
|
||||||
|
|
||||||
debug: false,
|
debug: false,
|
||||||
|
|
||||||
@@ -2351,7 +2351,9 @@ typeof navigator === "object" && (function () {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._globalOptions.stacktrace || (options && options.stacktrace)) {
|
// Always attempt to get stacktrace if message is empty.
|
||||||
|
// It's the only way to provide any helpful information to the user.
|
||||||
|
if (this._globalOptions.stacktrace || options.stacktrace || data.message === '') {
|
||||||
// fingerprint on msg, not stack trace (legacy behavior, could be revisited)
|
// fingerprint on msg, not stack trace (legacy behavior, could be revisited)
|
||||||
data.fingerprint = data.fingerprint == null ? msg : data.fingerprint;
|
data.fingerprint = data.fingerprint == null ? msg : data.fingerprint;
|
||||||
|
|
||||||
@@ -3508,6 +3510,11 @@ typeof navigator === "object" && (function () {
|
|||||||
options
|
options
|
||||||
);
|
);
|
||||||
|
|
||||||
|
var ex = data.exception.values[0];
|
||||||
|
if (ex.type == null && ex.value === '') {
|
||||||
|
ex.value = 'Unrecoverable error caught';
|
||||||
|
}
|
||||||
|
|
||||||
// Move mechanism from options to exception interface
|
// Move mechanism from options to exception interface
|
||||||
// We do this, as requiring user to pass `{exception:{mechanism:{ ... }}}` would be
|
// We do this, as requiring user to pass `{exception:{mechanism:{ ... }}}` would be
|
||||||
// too much
|
// too much
|
||||||
@@ -4130,6 +4137,7 @@ typeof navigator === "object" && (function () {
|
|||||||
tooltips: {
|
tooltips: {
|
||||||
controls: true
|
controls: true
|
||||||
},
|
},
|
||||||
|
clickToPlay: false,
|
||||||
/* controls: [
|
/* controls: [
|
||||||
'play-large',
|
'play-large',
|
||||||
'restart',
|
'restart',
|
||||||
|
|||||||
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
@@ -57,6 +57,7 @@ import Raven from 'raven-js';
|
|||||||
tooltips: {
|
tooltips: {
|
||||||
controls: true,
|
controls: true,
|
||||||
},
|
},
|
||||||
|
clickToPlay: false,
|
||||||
/* controls: [
|
/* controls: [
|
||||||
'play-large',
|
'play-large',
|
||||||
'restart',
|
'restart',
|
||||||
|
|||||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+152
-109
@@ -11,60 +11,92 @@ typeof navigator === "object" && (function (global, factory) {
|
|||||||
var getConstructor = function getConstructor(input) {
|
var getConstructor = function getConstructor(input) {
|
||||||
return input !== null && typeof input !== 'undefined' ? input.constructor : null;
|
return input !== null && typeof input !== 'undefined' ? input.constructor : null;
|
||||||
};
|
};
|
||||||
|
|
||||||
var instanceOf = function instanceOf(input, constructor) {
|
var instanceOf = function instanceOf(input, constructor) {
|
||||||
return Boolean(input && constructor && input instanceof constructor);
|
return Boolean(input && constructor && input instanceof constructor);
|
||||||
};
|
};
|
||||||
|
var isNullOrUndefined = function isNullOrUndefined(input) {
|
||||||
|
return input === null || typeof input === 'undefined';
|
||||||
|
};
|
||||||
|
var isObject = function isObject(input) {
|
||||||
|
return getConstructor(input) === Object;
|
||||||
|
};
|
||||||
|
var isNumber = function isNumber(input) {
|
||||||
|
return getConstructor(input) === Number && !Number.isNaN(input);
|
||||||
|
};
|
||||||
|
var isString = function isString(input) {
|
||||||
|
return getConstructor(input) === String;
|
||||||
|
};
|
||||||
|
var isBoolean = function isBoolean(input) {
|
||||||
|
return getConstructor(input) === Boolean;
|
||||||
|
};
|
||||||
|
var isFunction = function isFunction(input) {
|
||||||
|
return getConstructor(input) === Function;
|
||||||
|
};
|
||||||
|
var isArray = function isArray(input) {
|
||||||
|
return Array.isArray(input);
|
||||||
|
};
|
||||||
|
var isWeakMap = function isWeakMap(input) {
|
||||||
|
return instanceOf(input, WeakMap);
|
||||||
|
};
|
||||||
|
var isNodeList = function isNodeList(input) {
|
||||||
|
return instanceOf(input, NodeList);
|
||||||
|
};
|
||||||
|
var isElement = function isElement(input) {
|
||||||
|
return instanceOf(input, Element);
|
||||||
|
};
|
||||||
|
var isTextNode = function isTextNode(input) {
|
||||||
|
return getConstructor(input) === Text;
|
||||||
|
};
|
||||||
|
var isEvent = function isEvent(input) {
|
||||||
|
return instanceOf(input, Event);
|
||||||
|
};
|
||||||
|
var isCue = function isCue(input) {
|
||||||
|
return instanceOf(input, window.TextTrackCue) || instanceOf(input, window.VTTCue);
|
||||||
|
};
|
||||||
|
var isTrack = function isTrack(input) {
|
||||||
|
return instanceOf(input, TextTrack) || !isNullOrUndefined(input) && isString(input.kind);
|
||||||
|
};
|
||||||
|
|
||||||
|
var isEmpty = function isEmpty(input) {
|
||||||
|
return isNullOrUndefined(input) || (isString(input) || isArray(input) || isNodeList(input)) && !input.length || isObject(input) && !Object.keys(input).length;
|
||||||
|
};
|
||||||
|
|
||||||
|
var isUrl = function isUrl(input) {
|
||||||
|
// Accept a URL object
|
||||||
|
if (instanceOf(input, window.URL)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add the protocol if required
|
||||||
|
var string = input;
|
||||||
|
if (!input.startsWith('http://') || !input.startsWith('https://')) {
|
||||||
|
string = 'http://' + input;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
return !isEmpty(new URL(string).hostname);
|
||||||
|
} catch (e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
var is = {
|
var is = {
|
||||||
object: function object(input) {
|
nullOrUndefined: isNullOrUndefined,
|
||||||
return getConstructor(input) === Object;
|
object: isObject,
|
||||||
},
|
number: isNumber,
|
||||||
number: function number(input) {
|
string: isString,
|
||||||
return getConstructor(input) === Number && !Number.isNaN(input);
|
boolean: isBoolean,
|
||||||
},
|
function: isFunction,
|
||||||
string: function string(input) {
|
array: isArray,
|
||||||
return getConstructor(input) === String;
|
weakMap: isWeakMap,
|
||||||
},
|
nodeList: isNodeList,
|
||||||
boolean: function boolean(input) {
|
element: isElement,
|
||||||
return getConstructor(input) === Boolean;
|
textNode: isTextNode,
|
||||||
},
|
event: isEvent,
|
||||||
function: function _function(input) {
|
cue: isCue,
|
||||||
return getConstructor(input) === Function;
|
track: isTrack,
|
||||||
},
|
url: isUrl,
|
||||||
array: function array(input) {
|
empty: isEmpty
|
||||||
return !is.nullOrUndefined(input) && Array.isArray(input);
|
|
||||||
},
|
|
||||||
weakMap: function weakMap(input) {
|
|
||||||
return instanceOf(input, WeakMap);
|
|
||||||
},
|
|
||||||
nodeList: function nodeList(input) {
|
|
||||||
return instanceOf(input, NodeList);
|
|
||||||
},
|
|
||||||
element: function element(input) {
|
|
||||||
return instanceOf(input, Element);
|
|
||||||
},
|
|
||||||
textNode: function textNode(input) {
|
|
||||||
return getConstructor(input) === Text;
|
|
||||||
},
|
|
||||||
event: function event(input) {
|
|
||||||
return instanceOf(input, Event);
|
|
||||||
},
|
|
||||||
cue: function cue(input) {
|
|
||||||
return instanceOf(input, window.TextTrackCue) || instanceOf(input, window.VTTCue);
|
|
||||||
},
|
|
||||||
track: function track(input) {
|
|
||||||
return instanceOf(input, TextTrack) || !is.nullOrUndefined(input) && is.string(input.kind);
|
|
||||||
},
|
|
||||||
url: function url(input) {
|
|
||||||
return !is.nullOrUndefined(input) && /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-/]))?/.test(input);
|
|
||||||
},
|
|
||||||
nullOrUndefined: function nullOrUndefined(input) {
|
|
||||||
return input === null || typeof input === 'undefined';
|
|
||||||
},
|
|
||||||
empty: function empty(input) {
|
|
||||||
return is.nullOrUndefined(input) || (is.string(input) || is.array(input) || is.nodeList(input)) && !input.length || is.object(input) && !Object.keys(input).length;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
@@ -769,22 +801,17 @@ typeof navigator === "object" && (function (global, factory) {
|
|||||||
|
|
||||||
// Quality
|
// Quality
|
||||||
Object.defineProperty(player.media, 'quality', {
|
Object.defineProperty(player.media, 'quality', {
|
||||||
get: function get$$1() {
|
get: function get() {
|
||||||
// Get sources
|
// Get sources
|
||||||
var sources = html5.getSources.call(player);
|
var sources = html5.getSources.call(player);
|
||||||
|
var source = sources.find(function (source) {
|
||||||
var _sources$filter = sources.filter(function (source) {
|
|
||||||
return source.getAttribute('src') === player.source;
|
return source.getAttribute('src') === player.source;
|
||||||
}),
|
});
|
||||||
_sources$filter2 = slicedToArray(_sources$filter, 1),
|
|
||||||
source = _sources$filter2[0];
|
|
||||||
|
|
||||||
// Return size, if match is found
|
// Return size, if match is found
|
||||||
|
|
||||||
|
|
||||||
return source && Number(source.getAttribute('size'));
|
return source && Number(source.getAttribute('size'));
|
||||||
},
|
},
|
||||||
set: function set$$1(input) {
|
set: function set(input) {
|
||||||
// Get sources
|
// Get sources
|
||||||
var sources = html5.getSources.call(player);
|
var sources = html5.getSources.call(player);
|
||||||
|
|
||||||
@@ -799,25 +826,30 @@ typeof navigator === "object" && (function (global, factory) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get current state
|
// Get current state
|
||||||
var currentTime = player.currentTime,
|
var _player$media = player.media,
|
||||||
playing = player.playing;
|
currentTime = _player$media.currentTime,
|
||||||
|
paused = _player$media.paused,
|
||||||
|
preload = _player$media.preload,
|
||||||
|
readyState = _player$media.readyState;
|
||||||
|
|
||||||
// Set new source
|
// Set new source
|
||||||
|
|
||||||
player.media.src = source.getAttribute('src');
|
player.media.src = source.getAttribute('src');
|
||||||
|
|
||||||
// Restore time
|
// Prevent loading if preload="none" and the current source isn't loaded (#1044)
|
||||||
var onLoadedMetaData = function onLoadedMetaData() {
|
if (preload !== 'none' || readyState) {
|
||||||
player.currentTime = currentTime;
|
// Restore time
|
||||||
};
|
player.once('loadedmetadata', function () {
|
||||||
player.once('loadedmetadata', onLoadedMetaData);
|
player.currentTime = currentTime;
|
||||||
|
|
||||||
// Load new source
|
// Resume playing
|
||||||
player.media.load();
|
if (!paused) {
|
||||||
|
player.play();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Resume playing
|
// Load new source
|
||||||
if (playing) {
|
player.media.load();
|
||||||
player.play();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Trigger change event
|
// Trigger change event
|
||||||
@@ -1451,7 +1483,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ('class' in attributes) {
|
if ('class' in attributes) {
|
||||||
if (attributes.class.includes(this.config.classNames.control)) {
|
if (!attributes.class.includes(this.config.classNames.control)) {
|
||||||
attributes.class += ' ' + this.config.classNames.control;
|
attributes.class += ' ' + this.config.classNames.control;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -1900,6 +1932,16 @@ typeof navigator === "object" && (function (global, factory) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If duration is the 2**32 (shaka), Infinity (HLS), DASH-IF (Number.MAX_SAFE_INTEGER || Number.MAX_VALUE) indicating live we hide the currentTime and progressbar.
|
||||||
|
// https://github.com/video-dev/hls.js/blob/5820d29d3c4c8a46e8b75f1e3afa3e68c1a9a2db/src/controller/buffer-controller.js#L415
|
||||||
|
// https://github.com/google/shaka-player/blob/4d889054631f4e1cf0fbd80ddd2b71887c02e232/lib/media/streaming_engine.js#L1062
|
||||||
|
// https://github.com/Dash-Industry-Forum/dash.js/blob/69859f51b969645b234666800d4cb596d89c602d/src/dash/models/DashManifestModel.js#L338
|
||||||
|
if (this.duration >= Math.pow(2, 32)) {
|
||||||
|
toggleHidden(this.elements.display.currentTime, true);
|
||||||
|
toggleHidden(this.elements.progress, true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Update ARIA values
|
// Update ARIA values
|
||||||
if (is.element(this.elements.inputs.seek)) {
|
if (is.element(this.elements.inputs.seek)) {
|
||||||
this.elements.inputs.seek.setAttribute('aria-valuemax', this.duration);
|
this.elements.inputs.seek.setAttribute('aria-valuemax', this.duration);
|
||||||
@@ -2849,7 +2891,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|||||||
// * active: The state preferred by user settings or config
|
// * active: The state preferred by user settings or config
|
||||||
// * toggled: The real captions state
|
// * toggled: The real captions state
|
||||||
|
|
||||||
var languages = dedupe(Array.from(navigator.languages || navigator.userLanguage).map(function (language) {
|
var languages = dedupe(Array.from(navigator.languages || navigator.language || navigator.userLanguage).map(function (language) {
|
||||||
return language.split('-')[0];
|
return language.split('-')[0];
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@@ -2977,8 +3019,10 @@ typeof navigator === "object" && (function (global, factory) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Toggle state
|
// Toggle button if it's enabled
|
||||||
this.elements.buttons.captions.pressed = active;
|
if (this.elements.buttons.captions) {
|
||||||
|
this.elements.buttons.captions.pressed = active;
|
||||||
|
}
|
||||||
|
|
||||||
// Add class hook
|
// Add class hook
|
||||||
toggleClass(this.elements.container, activeClass, active);
|
toggleClass(this.elements.container, activeClass, active);
|
||||||
@@ -4573,9 +4617,11 @@ typeof navigator === "object" && (function (global, factory) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Play/pause toggle
|
// Play/pause toggle
|
||||||
Array.from(this.player.elements.buttons.play).forEach(function (button) {
|
if (this.player.elements.buttons.play) {
|
||||||
bind(button, 'click', _this4.player.togglePlay, 'play');
|
Array.from(this.player.elements.buttons.play).forEach(function (button) {
|
||||||
});
|
bind(button, 'click', _this4.player.togglePlay, 'play');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Pause
|
// Pause
|
||||||
bind(this.player.elements.buttons.restart, 'click', this.player.restart, 'restart');
|
bind(this.player.elements.buttons.restart, 'click', this.player.restart, 'restart');
|
||||||
@@ -4777,33 +4823,28 @@ typeof navigator === "object" && (function (global, factory) {
|
|||||||
// Detect "natural" scroll - suppored on OS X Safari only
|
// Detect "natural" scroll - suppored on OS X Safari only
|
||||||
// Other browsers on OS X will be inverted until support improves
|
// Other browsers on OS X will be inverted until support improves
|
||||||
var inverted = event.webkitDirectionInvertedFromDevice;
|
var inverted = event.webkitDirectionInvertedFromDevice;
|
||||||
var step = 1 / 50;
|
|
||||||
var direction = 0;
|
|
||||||
|
|
||||||
// Scroll down (or up on natural) to decrease
|
// Get delta from event. Invert if `inverted` is true
|
||||||
if (event.deltaY < 0 || event.deltaX > 0) {
|
|
||||||
if (inverted) {
|
|
||||||
_this4.player.decreaseVolume(step);
|
|
||||||
direction = -1;
|
|
||||||
} else {
|
|
||||||
_this4.player.increaseVolume(step);
|
|
||||||
direction = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Scroll up (or down on natural) to increase
|
var _map = [event.deltaX, -event.deltaY].map(function (value) {
|
||||||
if (event.deltaY > 0 || event.deltaX < 0) {
|
return inverted ? -value : value;
|
||||||
if (inverted) {
|
}),
|
||||||
_this4.player.increaseVolume(step);
|
_map2 = slicedToArray(_map, 2),
|
||||||
direction = 1;
|
x = _map2[0],
|
||||||
} else {
|
y = _map2[1];
|
||||||
_this4.player.decreaseVolume(step);
|
|
||||||
direction = -1;
|
// Using the biggest delta, normalize to 1 or -1 (or 0 if no delta)
|
||||||
}
|
|
||||||
}
|
|
||||||
|
var direction = Math.sign(Math.abs(x) > Math.abs(y) ? x : y);
|
||||||
|
|
||||||
|
// Change the volume by 2%
|
||||||
|
_this4.player.increaseVolume(direction / 50);
|
||||||
|
|
||||||
// Don't break page scrolling at max and min
|
// Don't break page scrolling at max and min
|
||||||
if (direction === 1 && _this4.player.media.volume < 1 || direction === -1 && _this4.player.media.volume > 0) {
|
var volume = _this4.player.media.volume;
|
||||||
|
|
||||||
|
if (direction === 1 && volume < 1 || direction === -1 && volume > 0) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
}, 'volume', false);
|
}, 'volume', false);
|
||||||
@@ -5822,8 +5863,8 @@ typeof navigator === "object" && (function (global, factory) {
|
|||||||
return Number(instance.getCurrentTime());
|
return Number(instance.getCurrentTime());
|
||||||
},
|
},
|
||||||
set: function set(time) {
|
set: function set(time) {
|
||||||
// If paused, mute audio preventively (YouTube starts playing on seek if the video hasn't been played yet).
|
// If paused and never played, mute audio preventively (YouTube starts playing on seek if the video hasn't been played yet).
|
||||||
if (player.paused) {
|
if (player.paused && !player.embed.hasPlayed) {
|
||||||
player.embed.mute();
|
player.embed.mute();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6742,7 +6783,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|||||||
}, {
|
}, {
|
||||||
key: 'enabled',
|
key: 'enabled',
|
||||||
get: function get$$1() {
|
get: function get$$1() {
|
||||||
return this.player.isVideo && this.player.config.ads.enabled && !is.empty(this.publisherId);
|
return this.player.isHTML5 && this.player.isVideo && this.player.config.ads.enabled && !is.empty(this.publisherId);
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
key: 'tagUrl',
|
key: 'tagUrl',
|
||||||
@@ -6750,7 +6791,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|||||||
var params = {
|
var params = {
|
||||||
AV_PUBLISHERID: '58c25bb0073ef448b1087ad6',
|
AV_PUBLISHERID: '58c25bb0073ef448b1087ad6',
|
||||||
AV_CHANNELID: '5a0458dc28a06145e4519d21',
|
AV_CHANNELID: '5a0458dc28a06145e4519d21',
|
||||||
AV_URL: location.hostname,
|
AV_URL: window.location.hostname,
|
||||||
cb: Date.now(),
|
cb: Date.now(),
|
||||||
AV_WIDTH: 640,
|
AV_WIDTH: 640,
|
||||||
AV_HEIGHT: 480,
|
AV_HEIGHT: 480,
|
||||||
@@ -7299,7 +7340,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|||||||
*/
|
*/
|
||||||
value: function increaseVolume(step) {
|
value: function increaseVolume(step) {
|
||||||
var volume = this.media.muted ? 0 : this.volume;
|
var volume = this.media.muted ? 0 : this.volume;
|
||||||
this.volume = volume + (is.number(step) ? step : 1);
|
this.volume = volume + (is.number(step) ? step : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -7310,8 +7351,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|||||||
}, {
|
}, {
|
||||||
key: 'decreaseVolume',
|
key: 'decreaseVolume',
|
||||||
value: function decreaseVolume(step) {
|
value: function decreaseVolume(step) {
|
||||||
var volume = this.media.muted ? 0 : this.volume;
|
this.increaseVolume(-step);
|
||||||
this.volume = volume - (is.number(step) ? step : 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -7395,6 +7435,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|||||||
value: function on$$1(event, callback) {
|
value: function on$$1(event, callback) {
|
||||||
on.call(this, this.elements.container, event, callback);
|
on.call(this, this.elements.container, event, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add event listeners once
|
* Add event listeners once
|
||||||
* @param {string} event - Event type
|
* @param {string} event - Event type
|
||||||
@@ -7406,6 +7447,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|||||||
value: function once$$1(event, callback) {
|
value: function once$$1(event, callback) {
|
||||||
once.call(this, this.elements.container, event, callback);
|
once.call(this, this.elements.container, event, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove event listeners
|
* Remove event listeners
|
||||||
* @param {string} event - Event type
|
* @param {string} event - Event type
|
||||||
@@ -7681,8 +7723,9 @@ typeof navigator === "object" && (function (global, factory) {
|
|||||||
// Faux duration set via config
|
// Faux duration set via config
|
||||||
var fauxDuration = parseFloat(this.config.duration);
|
var fauxDuration = parseFloat(this.config.duration);
|
||||||
|
|
||||||
// Media duration can be NaN before the media has loaded
|
// Media duration can be NaN or Infinity before the media has loaded
|
||||||
var duration = (this.media || {}).duration || 0;
|
var realDuration = (this.media || {}).duration;
|
||||||
|
var duration = !is.number(realDuration) || realDuration === Infinity ? 0 : realDuration;
|
||||||
|
|
||||||
// If config duration is funky, use regular duration
|
// If config duration is funky, use regular duration
|
||||||
return fauxDuration || duration;
|
return fauxDuration || duration;
|
||||||
|
|||||||
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
+150
-107
@@ -5397,60 +5397,92 @@ typeof navigator === "object" && (function (global, factory) {
|
|||||||
var getConstructor = function getConstructor(input) {
|
var getConstructor = function getConstructor(input) {
|
||||||
return input !== null && typeof input !== 'undefined' ? input.constructor : null;
|
return input !== null && typeof input !== 'undefined' ? input.constructor : null;
|
||||||
};
|
};
|
||||||
|
|
||||||
var instanceOf = function instanceOf(input, constructor) {
|
var instanceOf = function instanceOf(input, constructor) {
|
||||||
return Boolean(input && constructor && input instanceof constructor);
|
return Boolean(input && constructor && input instanceof constructor);
|
||||||
};
|
};
|
||||||
|
var isNullOrUndefined = function isNullOrUndefined(input) {
|
||||||
|
return input === null || typeof input === 'undefined';
|
||||||
|
};
|
||||||
|
var isObject = function isObject(input) {
|
||||||
|
return getConstructor(input) === Object;
|
||||||
|
};
|
||||||
|
var isNumber = function isNumber(input) {
|
||||||
|
return getConstructor(input) === Number && !Number.isNaN(input);
|
||||||
|
};
|
||||||
|
var isString = function isString(input) {
|
||||||
|
return getConstructor(input) === String;
|
||||||
|
};
|
||||||
|
var isBoolean = function isBoolean(input) {
|
||||||
|
return getConstructor(input) === Boolean;
|
||||||
|
};
|
||||||
|
var isFunction = function isFunction(input) {
|
||||||
|
return getConstructor(input) === Function;
|
||||||
|
};
|
||||||
|
var isArray = function isArray(input) {
|
||||||
|
return Array.isArray(input);
|
||||||
|
};
|
||||||
|
var isWeakMap = function isWeakMap(input) {
|
||||||
|
return instanceOf(input, WeakMap);
|
||||||
|
};
|
||||||
|
var isNodeList = function isNodeList(input) {
|
||||||
|
return instanceOf(input, NodeList);
|
||||||
|
};
|
||||||
|
var isElement = function isElement(input) {
|
||||||
|
return instanceOf(input, Element);
|
||||||
|
};
|
||||||
|
var isTextNode = function isTextNode(input) {
|
||||||
|
return getConstructor(input) === Text;
|
||||||
|
};
|
||||||
|
var isEvent = function isEvent(input) {
|
||||||
|
return instanceOf(input, Event);
|
||||||
|
};
|
||||||
|
var isCue = function isCue(input) {
|
||||||
|
return instanceOf(input, window.TextTrackCue) || instanceOf(input, window.VTTCue);
|
||||||
|
};
|
||||||
|
var isTrack = function isTrack(input) {
|
||||||
|
return instanceOf(input, TextTrack) || !isNullOrUndefined(input) && isString(input.kind);
|
||||||
|
};
|
||||||
|
|
||||||
|
var isEmpty = function isEmpty(input) {
|
||||||
|
return isNullOrUndefined(input) || (isString(input) || isArray(input) || isNodeList(input)) && !input.length || isObject(input) && !Object.keys(input).length;
|
||||||
|
};
|
||||||
|
|
||||||
|
var isUrl = function isUrl(input) {
|
||||||
|
// Accept a URL object
|
||||||
|
if (instanceOf(input, window.URL)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add the protocol if required
|
||||||
|
var string = input;
|
||||||
|
if (!input.startsWith('http://') || !input.startsWith('https://')) {
|
||||||
|
string = 'http://' + input;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
return !isEmpty(new URL(string).hostname);
|
||||||
|
} catch (e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
var is$1 = {
|
var is$1 = {
|
||||||
object: function object(input) {
|
nullOrUndefined: isNullOrUndefined,
|
||||||
return getConstructor(input) === Object;
|
object: isObject,
|
||||||
},
|
number: isNumber,
|
||||||
number: function number(input) {
|
string: isString,
|
||||||
return getConstructor(input) === Number && !Number.isNaN(input);
|
boolean: isBoolean,
|
||||||
},
|
function: isFunction,
|
||||||
string: function string(input) {
|
array: isArray,
|
||||||
return getConstructor(input) === String;
|
weakMap: isWeakMap,
|
||||||
},
|
nodeList: isNodeList,
|
||||||
boolean: function boolean(input) {
|
element: isElement,
|
||||||
return getConstructor(input) === Boolean;
|
textNode: isTextNode,
|
||||||
},
|
event: isEvent,
|
||||||
function: function _function(input) {
|
cue: isCue,
|
||||||
return getConstructor(input) === Function;
|
track: isTrack,
|
||||||
},
|
url: isUrl,
|
||||||
array: function array(input) {
|
empty: isEmpty
|
||||||
return !is$1.nullOrUndefined(input) && Array.isArray(input);
|
|
||||||
},
|
|
||||||
weakMap: function weakMap(input) {
|
|
||||||
return instanceOf(input, WeakMap);
|
|
||||||
},
|
|
||||||
nodeList: function nodeList(input) {
|
|
||||||
return instanceOf(input, NodeList);
|
|
||||||
},
|
|
||||||
element: function element(input) {
|
|
||||||
return instanceOf(input, Element);
|
|
||||||
},
|
|
||||||
textNode: function textNode(input) {
|
|
||||||
return getConstructor(input) === Text;
|
|
||||||
},
|
|
||||||
event: function event(input) {
|
|
||||||
return instanceOf(input, Event);
|
|
||||||
},
|
|
||||||
cue: function cue(input) {
|
|
||||||
return instanceOf(input, window.TextTrackCue) || instanceOf(input, window.VTTCue);
|
|
||||||
},
|
|
||||||
track: function track(input) {
|
|
||||||
return instanceOf(input, TextTrack) || !is$1.nullOrUndefined(input) && is$1.string(input.kind);
|
|
||||||
},
|
|
||||||
url: function url(input) {
|
|
||||||
return !is$1.nullOrUndefined(input) && /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-/]))?/.test(input);
|
|
||||||
},
|
|
||||||
nullOrUndefined: function nullOrUndefined(input) {
|
|
||||||
return input === null || typeof input === 'undefined';
|
|
||||||
},
|
|
||||||
empty: function empty(input) {
|
|
||||||
return is$1.nullOrUndefined(input) || (is$1.string(input) || is$1.array(input) || is$1.nodeList(input)) && !input.length || is$1.object(input) && !Object.keys(input).length;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
@@ -6158,16 +6190,11 @@ typeof navigator === "object" && (function (global, factory) {
|
|||||||
get: function get() {
|
get: function get() {
|
||||||
// Get sources
|
// Get sources
|
||||||
var sources = html5.getSources.call(player);
|
var sources = html5.getSources.call(player);
|
||||||
|
var source = sources.find(function (source) {
|
||||||
var _sources$filter = sources.filter(function (source) {
|
|
||||||
return source.getAttribute('src') === player.source;
|
return source.getAttribute('src') === player.source;
|
||||||
}),
|
});
|
||||||
_sources$filter2 = slicedToArray(_sources$filter, 1),
|
|
||||||
source = _sources$filter2[0];
|
|
||||||
|
|
||||||
// Return size, if match is found
|
// Return size, if match is found
|
||||||
|
|
||||||
|
|
||||||
return source && Number(source.getAttribute('size'));
|
return source && Number(source.getAttribute('size'));
|
||||||
},
|
},
|
||||||
set: function set(input) {
|
set: function set(input) {
|
||||||
@@ -6185,25 +6212,30 @@ typeof navigator === "object" && (function (global, factory) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get current state
|
// Get current state
|
||||||
var currentTime = player.currentTime,
|
var _player$media = player.media,
|
||||||
playing = player.playing;
|
currentTime = _player$media.currentTime,
|
||||||
|
paused = _player$media.paused,
|
||||||
|
preload = _player$media.preload,
|
||||||
|
readyState = _player$media.readyState;
|
||||||
|
|
||||||
// Set new source
|
// Set new source
|
||||||
|
|
||||||
player.media.src = source.getAttribute('src');
|
player.media.src = source.getAttribute('src');
|
||||||
|
|
||||||
// Restore time
|
// Prevent loading if preload="none" and the current source isn't loaded (#1044)
|
||||||
var onLoadedMetaData = function onLoadedMetaData() {
|
if (preload !== 'none' || readyState) {
|
||||||
player.currentTime = currentTime;
|
// Restore time
|
||||||
};
|
player.once('loadedmetadata', function () {
|
||||||
player.once('loadedmetadata', onLoadedMetaData);
|
player.currentTime = currentTime;
|
||||||
|
|
||||||
// Load new source
|
// Resume playing
|
||||||
player.media.load();
|
if (!paused) {
|
||||||
|
player.play();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Resume playing
|
// Load new source
|
||||||
if (playing) {
|
player.media.load();
|
||||||
player.play();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Trigger change event
|
// Trigger change event
|
||||||
@@ -6837,7 +6869,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ('class' in attributes) {
|
if ('class' in attributes) {
|
||||||
if (attributes.class.includes(this.config.classNames.control)) {
|
if (!attributes.class.includes(this.config.classNames.control)) {
|
||||||
attributes.class += ' ' + this.config.classNames.control;
|
attributes.class += ' ' + this.config.classNames.control;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -7286,6 +7318,16 @@ typeof navigator === "object" && (function (global, factory) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If duration is the 2**32 (shaka), Infinity (HLS), DASH-IF (Number.MAX_SAFE_INTEGER || Number.MAX_VALUE) indicating live we hide the currentTime and progressbar.
|
||||||
|
// https://github.com/video-dev/hls.js/blob/5820d29d3c4c8a46e8b75f1e3afa3e68c1a9a2db/src/controller/buffer-controller.js#L415
|
||||||
|
// https://github.com/google/shaka-player/blob/4d889054631f4e1cf0fbd80ddd2b71887c02e232/lib/media/streaming_engine.js#L1062
|
||||||
|
// https://github.com/Dash-Industry-Forum/dash.js/blob/69859f51b969645b234666800d4cb596d89c602d/src/dash/models/DashManifestModel.js#L338
|
||||||
|
if (this.duration >= Math.pow(2, 32)) {
|
||||||
|
toggleHidden(this.elements.display.currentTime, true);
|
||||||
|
toggleHidden(this.elements.progress, true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Update ARIA values
|
// Update ARIA values
|
||||||
if (is$1.element(this.elements.inputs.seek)) {
|
if (is$1.element(this.elements.inputs.seek)) {
|
||||||
this.elements.inputs.seek.setAttribute('aria-valuemax', this.duration);
|
this.elements.inputs.seek.setAttribute('aria-valuemax', this.duration);
|
||||||
@@ -8235,7 +8277,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|||||||
// * active: The state preferred by user settings or config
|
// * active: The state preferred by user settings or config
|
||||||
// * toggled: The real captions state
|
// * toggled: The real captions state
|
||||||
|
|
||||||
var languages = dedupe(Array.from(navigator.languages || navigator.userLanguage).map(function (language) {
|
var languages = dedupe(Array.from(navigator.languages || navigator.language || navigator.userLanguage).map(function (language) {
|
||||||
return language.split('-')[0];
|
return language.split('-')[0];
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@@ -8363,8 +8405,10 @@ typeof navigator === "object" && (function (global, factory) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Toggle state
|
// Toggle button if it's enabled
|
||||||
this.elements.buttons.captions.pressed = active;
|
if (this.elements.buttons.captions) {
|
||||||
|
this.elements.buttons.captions.pressed = active;
|
||||||
|
}
|
||||||
|
|
||||||
// Add class hook
|
// Add class hook
|
||||||
toggleClass(this.elements.container, activeClass, active);
|
toggleClass(this.elements.container, activeClass, active);
|
||||||
@@ -9959,9 +10003,11 @@ typeof navigator === "object" && (function (global, factory) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Play/pause toggle
|
// Play/pause toggle
|
||||||
Array.from(this.player.elements.buttons.play).forEach(function (button) {
|
if (this.player.elements.buttons.play) {
|
||||||
bind(button, 'click', _this4.player.togglePlay, 'play');
|
Array.from(this.player.elements.buttons.play).forEach(function (button) {
|
||||||
});
|
bind(button, 'click', _this4.player.togglePlay, 'play');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Pause
|
// Pause
|
||||||
bind(this.player.elements.buttons.restart, 'click', this.player.restart, 'restart');
|
bind(this.player.elements.buttons.restart, 'click', this.player.restart, 'restart');
|
||||||
@@ -10163,33 +10209,28 @@ typeof navigator === "object" && (function (global, factory) {
|
|||||||
// Detect "natural" scroll - suppored on OS X Safari only
|
// Detect "natural" scroll - suppored on OS X Safari only
|
||||||
// Other browsers on OS X will be inverted until support improves
|
// Other browsers on OS X will be inverted until support improves
|
||||||
var inverted = event.webkitDirectionInvertedFromDevice;
|
var inverted = event.webkitDirectionInvertedFromDevice;
|
||||||
var step = 1 / 50;
|
|
||||||
var direction = 0;
|
|
||||||
|
|
||||||
// Scroll down (or up on natural) to decrease
|
// Get delta from event. Invert if `inverted` is true
|
||||||
if (event.deltaY < 0 || event.deltaX > 0) {
|
|
||||||
if (inverted) {
|
|
||||||
_this4.player.decreaseVolume(step);
|
|
||||||
direction = -1;
|
|
||||||
} else {
|
|
||||||
_this4.player.increaseVolume(step);
|
|
||||||
direction = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Scroll up (or down on natural) to increase
|
var _map = [event.deltaX, -event.deltaY].map(function (value) {
|
||||||
if (event.deltaY > 0 || event.deltaX < 0) {
|
return inverted ? -value : value;
|
||||||
if (inverted) {
|
}),
|
||||||
_this4.player.increaseVolume(step);
|
_map2 = slicedToArray(_map, 2),
|
||||||
direction = 1;
|
x = _map2[0],
|
||||||
} else {
|
y = _map2[1];
|
||||||
_this4.player.decreaseVolume(step);
|
|
||||||
direction = -1;
|
// Using the biggest delta, normalize to 1 or -1 (or 0 if no delta)
|
||||||
}
|
|
||||||
}
|
|
||||||
|
var direction = Math.sign(Math.abs(x) > Math.abs(y) ? x : y);
|
||||||
|
|
||||||
|
// Change the volume by 2%
|
||||||
|
_this4.player.increaseVolume(direction / 50);
|
||||||
|
|
||||||
// Don't break page scrolling at max and min
|
// Don't break page scrolling at max and min
|
||||||
if (direction === 1 && _this4.player.media.volume < 1 || direction === -1 && _this4.player.media.volume > 0) {
|
var volume = _this4.player.media.volume;
|
||||||
|
|
||||||
|
if (direction === 1 && volume < 1 || direction === -1 && volume > 0) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
}, 'volume', false);
|
}, 'volume', false);
|
||||||
@@ -11202,8 +11243,8 @@ typeof navigator === "object" && (function (global, factory) {
|
|||||||
return Number(instance.getCurrentTime());
|
return Number(instance.getCurrentTime());
|
||||||
},
|
},
|
||||||
set: function set(time) {
|
set: function set(time) {
|
||||||
// If paused, mute audio preventively (YouTube starts playing on seek if the video hasn't been played yet).
|
// If paused and never played, mute audio preventively (YouTube starts playing on seek if the video hasn't been played yet).
|
||||||
if (player.paused) {
|
if (player.paused && !player.embed.hasPlayed) {
|
||||||
player.embed.mute();
|
player.embed.mute();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -12122,7 +12163,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|||||||
}, {
|
}, {
|
||||||
key: 'enabled',
|
key: 'enabled',
|
||||||
get: function get() {
|
get: function get() {
|
||||||
return this.player.isVideo && this.player.config.ads.enabled && !is$1.empty(this.publisherId);
|
return this.player.isHTML5 && this.player.isVideo && this.player.config.ads.enabled && !is$1.empty(this.publisherId);
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
key: 'tagUrl',
|
key: 'tagUrl',
|
||||||
@@ -12130,7 +12171,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|||||||
var params = {
|
var params = {
|
||||||
AV_PUBLISHERID: '58c25bb0073ef448b1087ad6',
|
AV_PUBLISHERID: '58c25bb0073ef448b1087ad6',
|
||||||
AV_CHANNELID: '5a0458dc28a06145e4519d21',
|
AV_CHANNELID: '5a0458dc28a06145e4519d21',
|
||||||
AV_URL: location.hostname,
|
AV_URL: window.location.hostname,
|
||||||
cb: Date.now(),
|
cb: Date.now(),
|
||||||
AV_WIDTH: 640,
|
AV_WIDTH: 640,
|
||||||
AV_HEIGHT: 480,
|
AV_HEIGHT: 480,
|
||||||
@@ -12679,7 +12720,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|||||||
*/
|
*/
|
||||||
value: function increaseVolume(step) {
|
value: function increaseVolume(step) {
|
||||||
var volume = this.media.muted ? 0 : this.volume;
|
var volume = this.media.muted ? 0 : this.volume;
|
||||||
this.volume = volume + (is$1.number(step) ? step : 1);
|
this.volume = volume + (is$1.number(step) ? step : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -12690,8 +12731,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|||||||
}, {
|
}, {
|
||||||
key: 'decreaseVolume',
|
key: 'decreaseVolume',
|
||||||
value: function decreaseVolume(step) {
|
value: function decreaseVolume(step) {
|
||||||
var volume = this.media.muted ? 0 : this.volume;
|
this.increaseVolume(-step);
|
||||||
this.volume = volume - (is$1.number(step) ? step : 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -12775,6 +12815,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|||||||
value: function on$$1(event, callback) {
|
value: function on$$1(event, callback) {
|
||||||
on.call(this, this.elements.container, event, callback);
|
on.call(this, this.elements.container, event, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add event listeners once
|
* Add event listeners once
|
||||||
* @param {string} event - Event type
|
* @param {string} event - Event type
|
||||||
@@ -12786,6 +12827,7 @@ typeof navigator === "object" && (function (global, factory) {
|
|||||||
value: function once$$1(event, callback) {
|
value: function once$$1(event, callback) {
|
||||||
once.call(this, this.elements.container, event, callback);
|
once.call(this, this.elements.container, event, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove event listeners
|
* Remove event listeners
|
||||||
* @param {string} event - Event type
|
* @param {string} event - Event type
|
||||||
@@ -13061,8 +13103,9 @@ typeof navigator === "object" && (function (global, factory) {
|
|||||||
// Faux duration set via config
|
// Faux duration set via config
|
||||||
var fauxDuration = parseFloat(this.config.duration);
|
var fauxDuration = parseFloat(this.config.duration);
|
||||||
|
|
||||||
// Media duration can be NaN before the media has loaded
|
// Media duration can be NaN or Infinity before the media has loaded
|
||||||
var duration = (this.media || {}).duration || 0;
|
var realDuration = (this.media || {}).duration;
|
||||||
|
var duration = !is$1.number(realDuration) || realDuration === Infinity ? 0 : realDuration;
|
||||||
|
|
||||||
// If config duration is funky, use regular duration
|
// If config duration is funky, use regular duration
|
||||||
return fauxDuration || duration;
|
return fauxDuration || duration;
|
||||||
|
|||||||
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
+41
-29
@@ -1,26 +1,54 @@
|
|||||||
{
|
{
|
||||||
"name": "plyr",
|
"name": "plyr",
|
||||||
"version": "3.3.16",
|
"version": "3.3.22",
|
||||||
"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",
|
||||||
|
"author": "Sam Potts <sam@potts.es>",
|
||||||
|
"keywords": [
|
||||||
|
"HTML5 Video",
|
||||||
|
"HTML5 Audio",
|
||||||
|
"Media Player",
|
||||||
|
"DASH",
|
||||||
|
"Shaka",
|
||||||
|
"WordPress",
|
||||||
|
"HLS"
|
||||||
|
],
|
||||||
"main": "./dist/plyr.js",
|
"main": "./dist/plyr.js",
|
||||||
"browser": "./dist/plyr.min.js",
|
"browser": "./dist/plyr.min.js",
|
||||||
"sass": "./src/sass/plyr.scss",
|
"sass": "./src/sass/plyr.scss",
|
||||||
"style": "./dist/plyr.css",
|
"style": "./dist/plyr.css",
|
||||||
|
"license": "MIT",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git://github.com/sampotts/plyr.git"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/sampotts/plyr/issues"
|
||||||
|
},
|
||||||
|
"directories": {
|
||||||
|
"doc": "readme.md"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"build": "gulp build",
|
||||||
|
"lint": "eslint src/js && npm run-script remark",
|
||||||
|
"remark": "remark -f --use 'validate-links=repository:\"sampotts/plyr\"' '{,!(node_modules),.?**/}*.md'",
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"babel-core": "^6.26.3",
|
"babel-core": "^6.26.3",
|
||||||
"babel-eslint": "^8.2.3",
|
"babel-eslint": "^8.2.6",
|
||||||
"babel-plugin-external-helpers": "^6.22.0",
|
"babel-plugin-external-helpers": "^6.22.0",
|
||||||
"babel-preset-env": "^1.7.0",
|
"babel-preset-env": "^1.7.0",
|
||||||
"del": "^3.0.0",
|
"del": "^3.0.0",
|
||||||
"eslint": "^4.19.1",
|
"eslint": "^5.1.0",
|
||||||
"eslint-config-airbnb-base": "^12.1.0",
|
"eslint-config-airbnb-base": "^13.0.0",
|
||||||
"eslint-config-prettier": "^2.9.0",
|
"eslint-config-prettier": "^2.9.0",
|
||||||
"eslint-plugin-import": "^2.12.0",
|
"eslint-plugin-import": "^2.13.0",
|
||||||
"git-branch": "^2.0.1",
|
"git-branch": "^2.0.1",
|
||||||
"gulp": "^3.9.1",
|
"gulp": "^3.9.1",
|
||||||
"gulp-autoprefixer": "^5.0.0",
|
"gulp-autoprefixer": "^5.0.0",
|
||||||
"gulp-better-rollup": "^3.2.1",
|
"gulp-better-rollup": "^3.3.0",
|
||||||
"gulp-clean-css": "^3.9.4",
|
"gulp-clean-css": "^3.9.4",
|
||||||
"gulp-concat": "^2.6.1",
|
"gulp-concat": "^2.6.1",
|
||||||
"gulp-filter": "^5.1.0",
|
"gulp-filter": "^5.1.0",
|
||||||
@@ -38,43 +66,27 @@
|
|||||||
"gulp-uglify-es": "^1.0.4",
|
"gulp-uglify-es": "^1.0.4",
|
||||||
"gulp-util": "^3.0.8",
|
"gulp-util": "^3.0.8",
|
||||||
"postcss-custom-properties": "^7.0.0",
|
"postcss-custom-properties": "^7.0.0",
|
||||||
"prettier-eslint": "^8.8.1",
|
"prettier-eslint": "^8.8.2",
|
||||||
"prettier-stylelint": "^0.4.2",
|
"prettier-stylelint": "^0.4.2",
|
||||||
"rollup-plugin-babel": "^3.0.4",
|
"remark-cli": "^5.0.0",
|
||||||
|
"remark-validate-links": "^7.0.0",
|
||||||
|
"rollup-plugin-babel": "^3.0.7",
|
||||||
"rollup-plugin-commonjs": "^9.1.3",
|
"rollup-plugin-commonjs": "^9.1.3",
|
||||||
"rollup-plugin-node-resolve": "^3.3.0",
|
"rollup-plugin-node-resolve": "^3.3.0",
|
||||||
"run-sequence": "^2.2.1",
|
"run-sequence": "^2.2.1",
|
||||||
"stylelint": "^9.3.0",
|
"stylelint": "^9.3.0",
|
||||||
"stylelint-config-prettier": "^3.2.0",
|
"stylelint-config-prettier": "^3.3.0",
|
||||||
"stylelint-config-recommended": "^2.1.0",
|
"stylelint-config-recommended": "^2.1.0",
|
||||||
"stylelint-config-sass-guidelines": "^5.0.0",
|
"stylelint-config-sass-guidelines": "^5.0.0",
|
||||||
"stylelint-order": "^0.8.1",
|
"stylelint-order": "^0.8.1",
|
||||||
"stylelint-scss": "^3.1.3",
|
"stylelint-scss": "^3.1.3",
|
||||||
"stylelint-selector-bem-pattern": "^2.0.0"
|
"stylelint-selector-bem-pattern": "^2.0.0"
|
||||||
},
|
},
|
||||||
"keywords": ["HTML5 Video", "HTML5 Audio", "Media Player", "DASH", "Shaka", "WordPress", "HLS"],
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git://github.com/sampotts/plyr.git"
|
|
||||||
},
|
|
||||||
"license": "MIT",
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/sampotts/plyr/issues"
|
|
||||||
},
|
|
||||||
"directories": {
|
|
||||||
"doc": "readme.md"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"build": "gulp build",
|
|
||||||
"lint": "eslint src/js",
|
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
|
||||||
},
|
|
||||||
"author": "Sam Potts <sam@potts.es>",
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"babel-polyfill": "^6.26.0",
|
"babel-polyfill": "^6.26.0",
|
||||||
"custom-event-polyfill": "^0.3.0",
|
"custom-event-polyfill": "^0.3.0",
|
||||||
"loadjs": "^3.5.4",
|
"loadjs": "^3.5.4",
|
||||||
"raven-js": "^3.26.2",
|
"raven-js": "^3.26.3",
|
||||||
"url-polyfill": "^1.0.13"
|
"url-polyfill": "^1.0.13"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ A simple, lightweight, accessible and customizable HTML5, YouTube and Vimeo medi
|
|||||||
* **HTML Video & Audio** - support for both formats
|
* **HTML Video & Audio** - support for both formats
|
||||||
* **[Embedded Video](#embeds)** - support for YouTube and Vimeo video playback
|
* **[Embedded Video](#embeds)** - support for YouTube and Vimeo video playback
|
||||||
* **[Monetization](#ads)** - make money from your videos
|
* **[Monetization](#ads)** - make money from your videos
|
||||||
* **[Streaming](#streaming)** - support for hls.js, Shaka and dash.js streaming playback
|
* **[Streaming](#try-plyr-online)** - support for hls.js, Shaka and dash.js streaming playback
|
||||||
* **[API](#api)** - toggle playback, volume, seeking, and more through a standardized API
|
* **[API](#api)** - toggle playback, volume, seeking, and more through a standardized API
|
||||||
* **[Events](#events)** - no messing around with Vimeo and YouTube APIs, all events are standardized across formats
|
* **[Events](#events)** - no messing around with Vimeo and YouTube APIs, all events are standardized across formats
|
||||||
* **[Fullscreen](#fullscreen)** - supports native fullscreen with fallback to "full window" modes
|
* **[Fullscreen](#fullscreen)** - supports native fullscreen with fallback to "full window" modes
|
||||||
@@ -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.16/plyr.js"></script>
|
<script src="https://cdn.plyr.io/3.3.22/plyr.js"></script>
|
||||||
```
|
```
|
||||||
|
|
||||||
...or...
|
...or...
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<script src="https://cdn.plyr.io/3.3.16/plyr.polyfilled.js"></script>
|
<script src="https://cdn.plyr.io/3.3.22/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.16/plyr.css">
|
<link rel="stylesheet" href="https://cdn.plyr.io/3.3.22/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.16/plyr.svg`.
|
reference, the CDN hosted SVG sprite can be found at `https://cdn.plyr.io/3.3.22/plyr.svg`.
|
||||||
|
|
||||||
## Ads
|
## Ads
|
||||||
|
|
||||||
@@ -286,7 +286,7 @@ Note the single quotes encapsulating the JSON and double quotes on the object ke
|
|||||||
| `debug` | Boolean | `false` | Display debugging information in the console |
|
| `debug` | Boolean | `false` | Display debugging information in the console |
|
||||||
| `controls` | Array, Function or Element | `['play-large', 'play', 'progress', 'current-time', 'mute', 'volume', 'captions', 'settings', 'pip', 'airplay', 'fullscreen']` | If a function is passed, it is assumed your method will return either an element or HTML string for the controls. Three arguments will be passed to your function; `id` (the unique id for the player), `seektime` (the seektime step in seconds), and `title` (the media title). See [controls.md](controls.md) for more info on how the html needs to be structured. |
|
| `controls` | Array, Function or Element | `['play-large', 'play', 'progress', 'current-time', 'mute', 'volume', 'captions', 'settings', 'pip', 'airplay', 'fullscreen']` | If a function is passed, it is assumed your method will return either an element or HTML string for the controls. Three arguments will be passed to your function; `id` (the unique id for the player), `seektime` (the seektime step in seconds), and `title` (the media title). See [controls.md](controls.md) for more info on how the html needs to be structured. |
|
||||||
| `settings` | Array | `['captions', 'quality', 'speed', 'loop']` | If you're using the default controls are used then you can specify which settings to show in the menu |
|
| `settings` | Array | `['captions', 'quality', 'speed', 'loop']` | If you're using the default controls are used then you can specify which settings to show in the menu |
|
||||||
| `i18n` | Object | See [defaults.js](/src/js/defaults.js) | Used for internationalization (i18n) of the text within the UI. |
|
| `i18n` | Object | See [defaults.js](/src/js/config/defaults.js) | Used for internationalization (i18n) of the text within the UI. |
|
||||||
| `loadSprite` | Boolean | `true` | Load the SVG sprite specified as the `iconUrl` option (if a URL). If `false`, it is assumed you are handling sprite loading yourself. |
|
| `loadSprite` | Boolean | `true` | Load the SVG sprite specified as the `iconUrl` option (if a URL). If `false`, it is assumed you are handling sprite loading yourself. |
|
||||||
| `iconUrl` | String | `null` | Specify a URL or path to the SVG sprite. See the [SVG section](#svg) for more info. |
|
| `iconUrl` | String | `null` | Specify a URL or path to the SVG sprite. See the [SVG section](#svg) for more info. |
|
||||||
| `iconPrefix` | String | `plyr` | Specify the id prefix for the icons used in the default controls (e.g. "plyr-play" would be "plyr"). This is to prevent clashes if you're using your own SVG sprite but with the default controls. Most people can ignore this option. |
|
| `iconPrefix` | String | `plyr` | Specify the id prefix for the icons used in the default controls (e.g. "plyr-play" would be "plyr"). This is to prevent clashes if you're using your own SVG sprite but with the default controls. Most people can ignore this option. |
|
||||||
@@ -409,7 +409,7 @@ player.fullscreen.active; // false;
|
|||||||
| `speed` | ✓ | ✓ | Gets or sets the speed for the player. The setter accepts a value in the options specified in your config. Generally the minimum should be 0.5. |
|
| `speed` | ✓ | ✓ | Gets or sets the speed for the player. The setter accepts a value in the options specified in your config. Generally the minimum should be 0.5. |
|
||||||
| `quality`¹ | ✓ | ✓ | Gets or sets the quality for the player. The setter accepts a value from the options specified in your config. |
|
| `quality`¹ | ✓ | ✓ | Gets or sets the quality for the player. The setter accepts a value from the options specified in your config. |
|
||||||
| `loop` | ✓ | ✓ | Gets or sets the current loop state of the player. The setter accepts a boolean. |
|
| `loop` | ✓ | ✓ | Gets or sets the current loop state of the player. The setter accepts a boolean. |
|
||||||
| `source` | ✓ | ✓ | Gets or sets the current source for the player. The setter accepts an object. See [source setter](#source-setter) below for examples. |
|
| `source` | ✓ | ✓ | Gets or sets the current source for the player. The setter accepts an object. See [source setter](#the-source-setter) below for examples. |
|
||||||
| `poster` | ✓ | ✓ | Gets or sets the current poster image for the player. The setter accepts a string; the URL for the updated poster image. |
|
| `poster` | ✓ | ✓ | Gets or sets the current poster image for the player. The setter accepts a string; the URL for the updated poster image. |
|
||||||
| `autoplay` | ✓ | ✓ | Gets or sets the autoplay state of the player. The setter accepts a boolean. |
|
| `autoplay` | ✓ | ✓ | Gets or sets the autoplay state of the player. The setter accepts a boolean. |
|
||||||
| `currentTrack` | ✓ | ✓ | Gets or sets the caption track by index. `-1` means the track is missing or captions is not active |
|
| `currentTrack` | ✓ | ✓ | Gets or sets the caption track by index. `-1` means the track is missing or captions is not active |
|
||||||
@@ -435,10 +435,12 @@ player.source = {
|
|||||||
{
|
{
|
||||||
src: '/path/to/movie.mp4',
|
src: '/path/to/movie.mp4',
|
||||||
type: 'video/mp4',
|
type: 'video/mp4',
|
||||||
|
size: 720,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
src: '/path/to/movie.webm',
|
src: '/path/to/movie.webm',
|
||||||
type: 'video/webm',
|
type: 'video/webm',
|
||||||
|
size: 1080,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
poster: '/path/to/poster.jpg',
|
poster: '/path/to/poster.jpg',
|
||||||
|
|||||||
+5
-3
@@ -84,7 +84,7 @@ const captions = {
|
|||||||
// * toggled: The real captions state
|
// * toggled: The real captions state
|
||||||
|
|
||||||
const languages = dedupe(
|
const languages = dedupe(
|
||||||
Array.from(navigator.languages || navigator.userLanguage).map(language => language.split('-')[0]),
|
Array.from(navigator.languages || navigator.language || navigator.userLanguage).map(language => language.split('-')[0]),
|
||||||
);
|
);
|
||||||
|
|
||||||
let language = (this.storage.get('language') || this.config.captions.language || 'auto').toLowerCase();
|
let language = (this.storage.get('language') || this.config.captions.language || 'auto').toLowerCase();
|
||||||
@@ -191,8 +191,10 @@ const captions = {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Toggle state
|
// Toggle button if it's enabled
|
||||||
this.elements.buttons.captions.pressed = active;
|
if (this.elements.buttons.captions) {
|
||||||
|
this.elements.buttons.captions.pressed = active;
|
||||||
|
}
|
||||||
|
|
||||||
// Add class hook
|
// Add class hook
|
||||||
toggleClass(this.elements.container, activeClass, active);
|
toggleClass(this.elements.container, activeClass, active);
|
||||||
|
|||||||
@@ -17,10 +17,12 @@ export default class Console {
|
|||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
return this.enabled ? Function.prototype.bind.call(console.log, console) : noop;
|
return this.enabled ? Function.prototype.bind.call(console.log, console) : noop;
|
||||||
}
|
}
|
||||||
|
|
||||||
get warn() {
|
get warn() {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
return this.enabled ? Function.prototype.bind.call(console.warn, console) : noop;
|
return this.enabled ? Function.prototype.bind.call(console.warn, console) : noop;
|
||||||
}
|
}
|
||||||
|
|
||||||
get error() {
|
get error() {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
return this.enabled ? Function.prototype.bind.call(console.error, console) : noop;
|
return this.enabled ? Function.prototype.bind.call(console.error, console) : noop;
|
||||||
|
|||||||
Vendored
+12
-2
@@ -16,11 +16,11 @@ import {
|
|||||||
getElement,
|
getElement,
|
||||||
getElements,
|
getElements,
|
||||||
hasClass,
|
hasClass,
|
||||||
|
matches,
|
||||||
removeElement,
|
removeElement,
|
||||||
setAttributes,
|
setAttributes,
|
||||||
toggleClass,
|
toggleClass,
|
||||||
toggleHidden,
|
toggleHidden,
|
||||||
matches,
|
|
||||||
} from './utils/elements';
|
} from './utils/elements';
|
||||||
import { off, on } from './utils/events';
|
import { off, on } from './utils/events';
|
||||||
import is from './utils/is';
|
import is from './utils/is';
|
||||||
@@ -187,7 +187,7 @@ const controls = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ('class' in attributes) {
|
if ('class' in attributes) {
|
||||||
if (attributes.class.includes(this.config.classNames.control)) {
|
if (!attributes.class.includes(this.config.classNames.control)) {
|
||||||
attributes.class += ` ${this.config.classNames.control}`;
|
attributes.class += ` ${this.config.classNames.control}`;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -633,6 +633,16 @@ const controls = {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If duration is the 2**32 (shaka), Infinity (HLS), DASH-IF (Number.MAX_SAFE_INTEGER || Number.MAX_VALUE) indicating live we hide the currentTime and progressbar.
|
||||||
|
// https://github.com/video-dev/hls.js/blob/5820d29d3c4c8a46e8b75f1e3afa3e68c1a9a2db/src/controller/buffer-controller.js#L415
|
||||||
|
// https://github.com/google/shaka-player/blob/4d889054631f4e1cf0fbd80ddd2b71887c02e232/lib/media/streaming_engine.js#L1062
|
||||||
|
// https://github.com/Dash-Industry-Forum/dash.js/blob/69859f51b969645b234666800d4cb596d89c602d/src/dash/models/DashManifestModel.js#L338
|
||||||
|
if (this.duration >= 2**32) {
|
||||||
|
toggleHidden(this.elements.display.currentTime, true);
|
||||||
|
toggleHidden(this.elements.progress, true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Update ARIA values
|
// Update ARIA values
|
||||||
if (is.element(this.elements.inputs.seek)) {
|
if (is.element(this.elements.inputs.seek)) {
|
||||||
this.elements.inputs.seek.setAttribute('aria-valuemax', this.duration);
|
this.elements.inputs.seek.setAttribute('aria-valuemax', this.duration);
|
||||||
|
|||||||
+14
-12
@@ -39,7 +39,7 @@ const html5 = {
|
|||||||
get() {
|
get() {
|
||||||
// Get sources
|
// Get sources
|
||||||
const sources = html5.getSources.call(player);
|
const sources = html5.getSources.call(player);
|
||||||
const [source] = sources.filter(source => source.getAttribute('src') === player.source);
|
const source = sources.find(source => source.getAttribute('src') === player.source);
|
||||||
|
|
||||||
// Return size, if match is found
|
// Return size, if match is found
|
||||||
return source && Number(source.getAttribute('size'));
|
return source && Number(source.getAttribute('size'));
|
||||||
@@ -57,23 +57,25 @@ const html5 = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get current state
|
// Get current state
|
||||||
const { currentTime, playing } = player;
|
const { currentTime, paused, preload, readyState } = player.media;
|
||||||
|
|
||||||
// Set new source
|
// Set new source
|
||||||
player.media.src = source.getAttribute('src');
|
player.media.src = source.getAttribute('src');
|
||||||
|
|
||||||
// Restore time
|
// Prevent loading if preload="none" and the current source isn't loaded (#1044)
|
||||||
const onLoadedMetaData = () => {
|
if (preload !== 'none' || readyState) {
|
||||||
player.currentTime = currentTime;
|
// Restore time
|
||||||
};
|
player.once('loadedmetadata', () => {
|
||||||
player.once('loadedmetadata', onLoadedMetaData);
|
player.currentTime = currentTime;
|
||||||
|
|
||||||
// Load new source
|
// Resume playing
|
||||||
player.media.load();
|
if (!paused) {
|
||||||
|
player.play();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Resume playing
|
// Load new source
|
||||||
if (playing) {
|
player.media.load();
|
||||||
player.play();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Trigger change event
|
// Trigger change event
|
||||||
|
|||||||
+14
-29
@@ -431,9 +431,11 @@ class Listeners {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Play/pause toggle
|
// Play/pause toggle
|
||||||
Array.from(this.player.elements.buttons.play).forEach(button => {
|
if (this.player.elements.buttons.play) {
|
||||||
bind(button, 'click', this.player.togglePlay, 'play');
|
Array.from(this.player.elements.buttons.play).forEach(button => {
|
||||||
});
|
bind(button, 'click', this.player.togglePlay, 'play');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Pause
|
// Pause
|
||||||
bind(this.player.elements.buttons.restart, 'click', this.player.restart, 'restart');
|
bind(this.player.elements.buttons.restart, 'click', this.player.restart, 'restart');
|
||||||
@@ -665,36 +667,19 @@ class Listeners {
|
|||||||
// Detect "natural" scroll - suppored on OS X Safari only
|
// Detect "natural" scroll - suppored on OS X Safari only
|
||||||
// Other browsers on OS X will be inverted until support improves
|
// Other browsers on OS X will be inverted until support improves
|
||||||
const inverted = event.webkitDirectionInvertedFromDevice;
|
const inverted = event.webkitDirectionInvertedFromDevice;
|
||||||
const step = 1 / 50;
|
|
||||||
let direction = 0;
|
|
||||||
|
|
||||||
// Scroll down (or up on natural) to decrease
|
// Get delta from event. Invert if `inverted` is true
|
||||||
if (event.deltaY < 0 || event.deltaX > 0) {
|
const [x, y] = [event.deltaX, -event.deltaY].map(value => (inverted ? -value : value));
|
||||||
if (inverted) {
|
|
||||||
this.player.decreaseVolume(step);
|
|
||||||
direction = -1;
|
|
||||||
} else {
|
|
||||||
this.player.increaseVolume(step);
|
|
||||||
direction = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Scroll up (or down on natural) to increase
|
// Using the biggest delta, normalize to 1 or -1 (or 0 if no delta)
|
||||||
if (event.deltaY > 0 || event.deltaX < 0) {
|
const direction = Math.sign(Math.abs(x) > Math.abs(y) ? x : y);
|
||||||
if (inverted) {
|
|
||||||
this.player.increaseVolume(step);
|
// Change the volume by 2%
|
||||||
direction = 1;
|
this.player.increaseVolume(direction / 50);
|
||||||
} else {
|
|
||||||
this.player.decreaseVolume(step);
|
|
||||||
direction = -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Don't break page scrolling at max and min
|
// Don't break page scrolling at max and min
|
||||||
if (
|
const { volume } = this.player.media;
|
||||||
(direction === 1 && this.player.media.volume < 1) ||
|
if ((direction === 1 && volume < 1) || (direction === -1 && volume > 0)) {
|
||||||
(direction === -1 && this.player.media.volume > 0)
|
|
||||||
) {
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
+10
-8
@@ -7,12 +7,12 @@
|
|||||||
/* global google */
|
/* global google */
|
||||||
|
|
||||||
import i18n from '../i18n';
|
import i18n from '../i18n';
|
||||||
import { createElement } from './../utils/elements';
|
import { createElement } from '../utils/elements';
|
||||||
import { triggerEvent } from './../utils/events';
|
import { triggerEvent } from '../utils/events';
|
||||||
import is from './../utils/is';
|
import is from '../utils/is';
|
||||||
import loadScript from './../utils/loadScript';
|
import loadScript from '../utils/loadScript';
|
||||||
import { formatTime } from './../utils/time';
|
import { formatTime } from '../utils/time';
|
||||||
import { buildUrlParams } from './../utils/urls';
|
import { buildUrlParams } from '../utils/urls';
|
||||||
|
|
||||||
class Ads {
|
class Ads {
|
||||||
/**
|
/**
|
||||||
@@ -49,7 +49,9 @@ class Ads {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get enabled() {
|
get enabled() {
|
||||||
return this.player.isVideo && this.player.config.ads.enabled && !is.empty(this.publisherId);
|
return (
|
||||||
|
this.player.isHTML5 && this.player.isVideo && this.player.config.ads.enabled && !is.empty(this.publisherId)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -98,7 +100,7 @@ class Ads {
|
|||||||
const params = {
|
const params = {
|
||||||
AV_PUBLISHERID: '58c25bb0073ef448b1087ad6',
|
AV_PUBLISHERID: '58c25bb0073ef448b1087ad6',
|
||||||
AV_CHANNELID: '5a0458dc28a06145e4519d21',
|
AV_CHANNELID: '5a0458dc28a06145e4519d21',
|
||||||
AV_URL: location.hostname,
|
AV_URL: window.location.hostname,
|
||||||
cb: Date.now(),
|
cb: Date.now(),
|
||||||
AV_WIDTH: 640,
|
AV_WIDTH: 640,
|
||||||
AV_HEIGHT: 480,
|
AV_HEIGHT: 480,
|
||||||
|
|||||||
+10
-10
@@ -2,16 +2,16 @@
|
|||||||
// Vimeo plugin
|
// Vimeo plugin
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
|
|
||||||
import captions from './../captions';
|
import captions from '../captions';
|
||||||
import controls from './../controls';
|
import controls from '../controls';
|
||||||
import ui from './../ui';
|
import ui from '../ui';
|
||||||
import { createElement, replaceElement, toggleClass } from './../utils/elements';
|
import { createElement, replaceElement, toggleClass } from '../utils/elements';
|
||||||
import { triggerEvent } from './../utils/events';
|
import { triggerEvent } from '../utils/events';
|
||||||
import fetch from './../utils/fetch';
|
import fetch from '../utils/fetch';
|
||||||
import is from './../utils/is';
|
import is from '../utils/is';
|
||||||
import loadScript from './../utils/loadScript';
|
import loadScript from '../utils/loadScript';
|
||||||
import { format, stripHTML } from './../utils/strings';
|
import { format, stripHTML } from '../utils/strings';
|
||||||
import { buildUrlParams } from './../utils/urls';
|
import { buildUrlParams } from '../utils/urls';
|
||||||
|
|
||||||
// Parse Vimeo ID from URL
|
// Parse Vimeo ID from URL
|
||||||
function parseId(url) {
|
function parseId(url) {
|
||||||
|
|||||||
+12
-12
@@ -2,16 +2,16 @@
|
|||||||
// YouTube plugin
|
// YouTube plugin
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
|
|
||||||
import controls from './../controls';
|
import controls from '../controls';
|
||||||
import ui from './../ui';
|
import ui from '../ui';
|
||||||
import { dedupe } from './../utils/arrays';
|
import { dedupe } from '../utils/arrays';
|
||||||
import { createElement, replaceElement, toggleClass } from './../utils/elements';
|
import { createElement, replaceElement, toggleClass } from '../utils/elements';
|
||||||
import { triggerEvent } from './../utils/events';
|
import { triggerEvent } from '../utils/events';
|
||||||
import fetch from './../utils/fetch';
|
import fetch from '../utils/fetch';
|
||||||
import is from './../utils/is';
|
import is from '../utils/is';
|
||||||
import loadImage from './../utils/loadImage';
|
import loadImage from '../utils/loadImage';
|
||||||
import loadScript from './../utils/loadScript';
|
import loadScript from '../utils/loadScript';
|
||||||
import { format, generateId } from './../utils/strings';
|
import { format, generateId } from '../utils/strings';
|
||||||
|
|
||||||
// Parse YouTube ID from URL
|
// Parse YouTube ID from URL
|
||||||
function parseId(url) {
|
function parseId(url) {
|
||||||
@@ -270,8 +270,8 @@ const youtube = {
|
|||||||
return Number(instance.getCurrentTime());
|
return Number(instance.getCurrentTime());
|
||||||
},
|
},
|
||||||
set(time) {
|
set(time) {
|
||||||
// If paused, mute audio preventively (YouTube starts playing on seek if the video hasn't been played yet).
|
// If paused and never played, mute audio preventively (YouTube starts playing on seek if the video hasn't been played yet).
|
||||||
if (player.paused) {
|
if (player.paused && !player.embed.hasPlayed) {
|
||||||
player.embed.mute();
|
player.embed.mute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+13
-6
@@ -1,6 +1,6 @@
|
|||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
// Plyr
|
// Plyr
|
||||||
// plyr.js v3.3.16
|
// plyr.js v3.3.22
|
||||||
// https://github.com/sampotts/plyr
|
// https://github.com/sampotts/plyr
|
||||||
// License: The MIT License (MIT)
|
// License: The MIT License (MIT)
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
@@ -310,18 +310,23 @@ class Plyr {
|
|||||||
get isHTML5() {
|
get isHTML5() {
|
||||||
return Boolean(this.provider === providers.html5);
|
return Boolean(this.provider === providers.html5);
|
||||||
}
|
}
|
||||||
|
|
||||||
get isEmbed() {
|
get isEmbed() {
|
||||||
return Boolean(this.isYouTube || this.isVimeo);
|
return Boolean(this.isYouTube || this.isVimeo);
|
||||||
}
|
}
|
||||||
|
|
||||||
get isYouTube() {
|
get isYouTube() {
|
||||||
return Boolean(this.provider === providers.youtube);
|
return Boolean(this.provider === providers.youtube);
|
||||||
}
|
}
|
||||||
|
|
||||||
get isVimeo() {
|
get isVimeo() {
|
||||||
return Boolean(this.provider === providers.vimeo);
|
return Boolean(this.provider === providers.vimeo);
|
||||||
}
|
}
|
||||||
|
|
||||||
get isVideo() {
|
get isVideo() {
|
||||||
return Boolean(this.type === types.video);
|
return Boolean(this.type === types.video);
|
||||||
}
|
}
|
||||||
|
|
||||||
get isAudio() {
|
get isAudio() {
|
||||||
return Boolean(this.type === types.audio);
|
return Boolean(this.type === types.audio);
|
||||||
}
|
}
|
||||||
@@ -489,8 +494,9 @@ class Plyr {
|
|||||||
// Faux duration set via config
|
// Faux duration set via config
|
||||||
const fauxDuration = parseFloat(this.config.duration);
|
const fauxDuration = parseFloat(this.config.duration);
|
||||||
|
|
||||||
// Media duration can be NaN before the media has loaded
|
// Media duration can be NaN or Infinity before the media has loaded
|
||||||
const duration = (this.media || {}).duration || 0;
|
const realDuration = (this.media || {}).duration;
|
||||||
|
const duration = !is.number(realDuration) || realDuration === Infinity ? 0 : realDuration;
|
||||||
|
|
||||||
// If config duration is funky, use regular duration
|
// If config duration is funky, use regular duration
|
||||||
return fauxDuration || duration;
|
return fauxDuration || duration;
|
||||||
@@ -553,7 +559,7 @@ class Plyr {
|
|||||||
*/
|
*/
|
||||||
increaseVolume(step) {
|
increaseVolume(step) {
|
||||||
const volume = this.media.muted ? 0 : this.volume;
|
const volume = this.media.muted ? 0 : this.volume;
|
||||||
this.volume = volume + (is.number(step) ? step : 1);
|
this.volume = volume + (is.number(step) ? step : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -561,8 +567,7 @@ class Plyr {
|
|||||||
* @param {boolean} step - How much to decrease by (between 0 and 1)
|
* @param {boolean} step - How much to decrease by (between 0 and 1)
|
||||||
*/
|
*/
|
||||||
decreaseVolume(step) {
|
decreaseVolume(step) {
|
||||||
const volume = this.media.muted ? 0 : this.volume;
|
this.increaseVolume(-step);
|
||||||
this.volume = volume - (is.number(step) ? step : 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -945,6 +950,7 @@ class Plyr {
|
|||||||
on(event, callback) {
|
on(event, callback) {
|
||||||
on.call(this, this.elements.container, event, callback);
|
on.call(this, this.elements.container, event, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add event listeners once
|
* Add event listeners once
|
||||||
* @param {string} event - Event type
|
* @param {string} event - Event type
|
||||||
@@ -953,6 +959,7 @@ class Plyr {
|
|||||||
once(event, callback) {
|
once(event, callback) {
|
||||||
once.call(this, this.elements.container, event, callback);
|
once.call(this, this.elements.container, event, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove event listeners
|
* Remove event listeners
|
||||||
* @param {string} event - Event type
|
* @param {string} event - Event type
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
// Plyr Polyfilled Build
|
// Plyr Polyfilled Build
|
||||||
// plyr.js v3.3.16
|
// plyr.js v3.3.22
|
||||||
// https://github.com/sampotts/plyr
|
// https://github.com/sampotts/plyr
|
||||||
// License: The MIT License (MIT)
|
// License: The MIT License (MIT)
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
|
|||||||
+54
-58
@@ -3,65 +3,61 @@
|
|||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
|
|
||||||
const getConstructor = input => (input !== null && typeof input !== 'undefined' ? input.constructor : null);
|
const getConstructor = input => (input !== null && typeof input !== 'undefined' ? input.constructor : null);
|
||||||
|
|
||||||
const instanceOf = (input, constructor) => Boolean(input && constructor && input instanceof constructor);
|
const instanceOf = (input, constructor) => Boolean(input && constructor && input instanceof constructor);
|
||||||
|
const isNullOrUndefined = input => input === null || typeof input === 'undefined';
|
||||||
|
const isObject = input => getConstructor(input) === Object;
|
||||||
|
const isNumber = input => getConstructor(input) === Number && !Number.isNaN(input);
|
||||||
|
const isString = input => getConstructor(input) === String;
|
||||||
|
const isBoolean = input => getConstructor(input) === Boolean;
|
||||||
|
const isFunction = input => getConstructor(input) === Function;
|
||||||
|
const isArray = input => Array.isArray(input);
|
||||||
|
const isWeakMap = input => instanceOf(input, WeakMap);
|
||||||
|
const isNodeList = input => instanceOf(input, NodeList);
|
||||||
|
const isElement = input => instanceOf(input, Element);
|
||||||
|
const isTextNode = input => getConstructor(input) === Text;
|
||||||
|
const isEvent = input => instanceOf(input, Event);
|
||||||
|
const isCue = input => instanceOf(input, window.TextTrackCue) || instanceOf(input, window.VTTCue);
|
||||||
|
const isTrack = input => instanceOf(input, TextTrack) || (!isNullOrUndefined(input) && isString(input.kind));
|
||||||
|
|
||||||
const is = {
|
const isEmpty = input =>
|
||||||
object(input) {
|
isNullOrUndefined(input) ||
|
||||||
return getConstructor(input) === Object;
|
((isString(input) || isArray(input) || isNodeList(input)) && !input.length) ||
|
||||||
},
|
(isObject(input) && !Object.keys(input).length);
|
||||||
number(input) {
|
|
||||||
return getConstructor(input) === Number && !Number.isNaN(input);
|
const isUrl = input => {
|
||||||
},
|
// Accept a URL object
|
||||||
string(input) {
|
if (instanceOf(input, window.URL)) {
|
||||||
return getConstructor(input) === String;
|
return true;
|
||||||
},
|
}
|
||||||
boolean(input) {
|
|
||||||
return getConstructor(input) === Boolean;
|
// Add the protocol if required
|
||||||
},
|
let string = input;
|
||||||
function(input) {
|
if (!input.startsWith('http://') || !input.startsWith('https://')) {
|
||||||
return getConstructor(input) === Function;
|
string = `http://${input}`;
|
||||||
},
|
}
|
||||||
array(input) {
|
|
||||||
return !is.nullOrUndefined(input) && Array.isArray(input);
|
try {
|
||||||
},
|
return !isEmpty(new URL(string).hostname);
|
||||||
weakMap(input) {
|
} catch (e) {
|
||||||
return instanceOf(input, WeakMap);
|
return false;
|
||||||
},
|
}
|
||||||
nodeList(input) {
|
|
||||||
return instanceOf(input, NodeList);
|
|
||||||
},
|
|
||||||
element(input) {
|
|
||||||
return instanceOf(input, Element);
|
|
||||||
},
|
|
||||||
textNode(input) {
|
|
||||||
return getConstructor(input) === Text;
|
|
||||||
},
|
|
||||||
event(input) {
|
|
||||||
return instanceOf(input, Event);
|
|
||||||
},
|
|
||||||
cue(input) {
|
|
||||||
return instanceOf(input, window.TextTrackCue) || instanceOf(input, window.VTTCue);
|
|
||||||
},
|
|
||||||
track(input) {
|
|
||||||
return instanceOf(input, TextTrack) || (!is.nullOrUndefined(input) && is.string(input.kind));
|
|
||||||
},
|
|
||||||
url(input) {
|
|
||||||
return (
|
|
||||||
!is.nullOrUndefined(input) &&
|
|
||||||
/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-/]))?/.test(input)
|
|
||||||
);
|
|
||||||
},
|
|
||||||
nullOrUndefined(input) {
|
|
||||||
return input === null || typeof input === 'undefined';
|
|
||||||
},
|
|
||||||
empty(input) {
|
|
||||||
return (
|
|
||||||
is.nullOrUndefined(input) ||
|
|
||||||
((is.string(input) || is.array(input) || is.nodeList(input)) && !input.length) ||
|
|
||||||
(is.object(input) && !Object.keys(input).length)
|
|
||||||
);
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default is;
|
export default {
|
||||||
|
nullOrUndefined: isNullOrUndefined,
|
||||||
|
object: isObject,
|
||||||
|
number: isNumber,
|
||||||
|
string: isString,
|
||||||
|
boolean: isBoolean,
|
||||||
|
function: isFunction,
|
||||||
|
array: isArray,
|
||||||
|
weakMap: isWeakMap,
|
||||||
|
nodeList: isNodeList,
|
||||||
|
element: isElement,
|
||||||
|
textNode: isTextNode,
|
||||||
|
event: isEvent,
|
||||||
|
cue: isCue,
|
||||||
|
track: isTrack,
|
||||||
|
url: isUrl,
|
||||||
|
empty: isEmpty,
|
||||||
|
};
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
// Sprite loader
|
// Sprite loader
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
|
|
||||||
import Storage from './../storage';
|
import Storage from '../storage';
|
||||||
import fetch from './fetch';
|
import fetch from './fetch';
|
||||||
import is from './is';
|
import is from './is';
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
.plyr__controls {
|
.plyr__controls {
|
||||||
align-items: center;
|
align-items: center;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
||||||
// Spacing
|
// Spacing
|
||||||
@@ -23,6 +24,7 @@
|
|||||||
&:first-child,
|
&:first-child,
|
||||||
&:first-child + [data-plyr='pause'] {
|
&:first-child + [data-plyr='pause'] {
|
||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
|
margin-right: auto;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,13 +50,17 @@
|
|||||||
|
|
||||||
// Video controls
|
// Video controls
|
||||||
.plyr--video .plyr__controls {
|
.plyr--video .plyr__controls {
|
||||||
background: linear-gradient(rgba($plyr-video-controls-bg, 0), rgba($plyr-video-controls-bg, 0.7));
|
background: linear-gradient(
|
||||||
|
rgba($plyr-video-controls-bg, 0),
|
||||||
|
rgba($plyr-video-controls-bg, 0.7)
|
||||||
|
);
|
||||||
border-bottom-left-radius: inherit;
|
border-bottom-left-radius: inherit;
|
||||||
border-bottom-right-radius: inherit;
|
border-bottom-right-radius: inherit;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
color: $plyr-video-control-color;
|
color: $plyr-video-control-color;
|
||||||
left: 0;
|
left: 0;
|
||||||
padding: ($plyr-control-spacing * 3.5) $plyr-control-spacing $plyr-control-spacing;
|
padding: ($plyr-control-spacing * 3.5) $plyr-control-spacing
|
||||||
|
$plyr-control-spacing;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 0;
|
right: 0;
|
||||||
transition: opacity 0.4s ease-in-out, transform 0.4s ease-in-out;
|
transition: opacity 0.4s ease-in-out, transform 0.4s ease-in-out;
|
||||||
|
|||||||
@@ -27,11 +27,6 @@ $embed-padding: ((100 / 16) * 9);
|
|||||||
$height: 240;
|
$height: 240;
|
||||||
$offset: to-percentage(($height - $embed-padding) / ($height / 50));
|
$offset: to-percentage(($height - $embed-padding) / ($height / 50));
|
||||||
|
|
||||||
// To allow mouse events to be captured if full support
|
|
||||||
iframe {
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Only used for Vimeo
|
// Only used for Vimeo
|
||||||
> .plyr__video-embed__container {
|
> .plyr__video-embed__container {
|
||||||
padding-bottom: to-percentage($height);
|
padding-bottom: to-percentage($height);
|
||||||
|
|||||||
@@ -15,9 +15,9 @@
|
|||||||
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-enabled .plyr__poster {
|
.plyr--stopped.plyr__poster-enabled .plyr__poster {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user