commit
4d3b6b882e
@ -2,8 +2,9 @@ demo
|
|||||||
.github
|
.github
|
||||||
.vscode
|
.vscode
|
||||||
*.code-workspace
|
*.code-workspace
|
||||||
|
build.json
|
||||||
credentials.json
|
credentials.json
|
||||||
bundles.json
|
deploy.json
|
||||||
yarn.lock
|
yarn.lock
|
||||||
package-lock.json
|
package-lock.json
|
||||||
*.mp4
|
*.mp4
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
## v3.5.1
|
||||||
|
|
||||||
|
- Fixed build issues with babel and browserslist
|
||||||
|
|
||||||
## v3.5.0
|
## v3.5.0
|
||||||
|
|
||||||
- Preview seek/scrubbing thumbnails (thanks @jamesoflol)
|
- Preview seek/scrubbing thumbnails (thanks @jamesoflol)
|
||||||
|
82
gulpfile.js
82
gulpfile.js
@ -30,6 +30,7 @@ const header = require('gulp-header');
|
|||||||
const gitbranch = require('git-branch');
|
const gitbranch = require('git-branch');
|
||||||
const rename = require('gulp-rename');
|
const rename = require('gulp-rename');
|
||||||
const replace = require('gulp-replace');
|
const replace = require('gulp-replace');
|
||||||
|
const ansi = require('ansi-colors');
|
||||||
const log = require('fancy-log');
|
const log = require('fancy-log');
|
||||||
const open = require('gulp-open');
|
const open = require('gulp-open');
|
||||||
const plumber = require('gulp-plumber');
|
const plumber = require('gulp-plumber');
|
||||||
@ -104,32 +105,14 @@ const tasks = {
|
|||||||
css: [],
|
css: [],
|
||||||
js: [],
|
js: [],
|
||||||
sprite: [],
|
sprite: [],
|
||||||
clean: ['clean'],
|
clean: 'clean',
|
||||||
};
|
};
|
||||||
|
|
||||||
// Size plugin
|
// Size plugin
|
||||||
const sizeOptions = { showFiles: true, gzip: true };
|
const sizeOptions = { showFiles: true, gzip: true };
|
||||||
|
|
||||||
// Babel config
|
|
||||||
const babelrc = (polyfill = false) => ({
|
|
||||||
presets: [
|
|
||||||
[
|
|
||||||
'@babel/preset-env',
|
|
||||||
{
|
|
||||||
targets: {
|
|
||||||
browsers,
|
|
||||||
},
|
|
||||||
useBuiltIns: polyfill ? 'usage' : false,
|
|
||||||
modules: false,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
],
|
|
||||||
babelrc: false,
|
|
||||||
exclude: 'node_modules/**',
|
|
||||||
});
|
|
||||||
|
|
||||||
// Clean out /dist
|
// Clean out /dist
|
||||||
gulp.task('clean', done => {
|
gulp.task(tasks.clean, done => {
|
||||||
const dirs = [paths.plyr.output, paths.demo.output].map(dir => path.join(dir, '**/*'));
|
const dirs = [paths.plyr.output, paths.demo.output].map(dir => path.join(dir, '**/*'));
|
||||||
|
|
||||||
// Don't delete the mp4
|
// Don't delete the mp4
|
||||||
@ -148,19 +131,34 @@ Object.entries(build.js).forEach(([filename, entry]) => {
|
|||||||
const polyfill = filename.includes('polyfilled');
|
const polyfill = filename.includes('polyfilled');
|
||||||
const extension = format === 'es' ? 'mjs' : 'js';
|
const extension = format === 'es' ? 'mjs' : 'js';
|
||||||
|
|
||||||
gulp.task(name, () => {
|
gulp.task(name, () =>
|
||||||
return gulp
|
gulp
|
||||||
.src(entry.src)
|
.src(entry.src)
|
||||||
.pipe(plumber())
|
.pipe(plumber())
|
||||||
.pipe(sourcemaps.init())
|
.pipe(sourcemaps.init())
|
||||||
.pipe(
|
.pipe(
|
||||||
rollup(
|
rollup(
|
||||||
{
|
{
|
||||||
plugins: [resolve(), commonjs(), babel(babelrc(polyfill))],
|
plugins: [
|
||||||
|
resolve(),
|
||||||
|
commonjs(),
|
||||||
|
babel({
|
||||||
|
presets: [
|
||||||
|
[
|
||||||
|
'@babel/env',
|
||||||
|
{
|
||||||
|
// debug: true,
|
||||||
|
useBuiltIns: polyfill ? 'usage' : false,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
],
|
||||||
|
babelrc: false,
|
||||||
|
exclude: [/\/core-js\//],
|
||||||
|
}),
|
||||||
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: entry.namespace,
|
name: entry.namespace,
|
||||||
// exports: 'named',
|
|
||||||
format,
|
format,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -172,13 +170,13 @@ Object.entries(build.js).forEach(([filename, entry]) => {
|
|||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.pipe(gulp.dest(entry.dist))
|
.pipe(gulp.dest(entry.dist))
|
||||||
.pipe(filter(`**/*${extension}`))
|
.pipe(filter(`**/*.${extension}`))
|
||||||
.pipe(terser())
|
.pipe(terser())
|
||||||
.pipe(rename({ suffix: minSuffix }))
|
.pipe(rename({ suffix: minSuffix }))
|
||||||
.pipe(size(sizeOptions))
|
.pipe(size(sizeOptions))
|
||||||
.pipe(sourcemaps.write(''))
|
.pipe(sourcemaps.write(''))
|
||||||
.pipe(gulp.dest(entry.dist));
|
.pipe(gulp.dest(entry.dist)),
|
||||||
});
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -187,8 +185,8 @@ Object.entries(build.css).forEach(([filename, entry]) => {
|
|||||||
const name = `css:${filename}`;
|
const name = `css:${filename}`;
|
||||||
tasks.css.push(name);
|
tasks.css.push(name);
|
||||||
|
|
||||||
gulp.task(name, () => {
|
gulp.task(name, () =>
|
||||||
return gulp
|
gulp
|
||||||
.src(entry.src)
|
.src(entry.src)
|
||||||
.pipe(plumber())
|
.pipe(plumber())
|
||||||
.pipe(sass())
|
.pipe(sass())
|
||||||
@ -199,8 +197,8 @@ Object.entries(build.css).forEach(([filename, entry]) => {
|
|||||||
)
|
)
|
||||||
.pipe(clean())
|
.pipe(clean())
|
||||||
.pipe(size(sizeOptions))
|
.pipe(size(sizeOptions))
|
||||||
.pipe(gulp.dest(entry.dist));
|
.pipe(gulp.dest(entry.dist)),
|
||||||
});
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
// SVG Sprites
|
// SVG Sprites
|
||||||
@ -208,18 +206,16 @@ Object.entries(build.sprite).forEach(([filename, entry]) => {
|
|||||||
const name = `sprite:${filename}`;
|
const name = `sprite:${filename}`;
|
||||||
tasks.sprite.push(name);
|
tasks.sprite.push(name);
|
||||||
|
|
||||||
log(path.basename(filename));
|
gulp.task(name, () =>
|
||||||
|
gulp
|
||||||
gulp.task(name, () => {
|
|
||||||
return gulp
|
|
||||||
.src(entry.src)
|
.src(entry.src)
|
||||||
.pipe(plumber())
|
.pipe(plumber())
|
||||||
.pipe(imagemin())
|
.pipe(imagemin())
|
||||||
.pipe(svgstore())
|
.pipe(svgstore())
|
||||||
.pipe(rename({ basename: path.parse(filename).name }))
|
.pipe(rename({ basename: path.parse(filename).name }))
|
||||||
.pipe(size(sizeOptions))
|
.pipe(size(sizeOptions))
|
||||||
.pipe(gulp.dest(entry.dist));
|
.pipe(gulp.dest(entry.dist)),
|
||||||
});
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Build all JS
|
// Build all JS
|
||||||
@ -317,7 +313,7 @@ gulp.task('version', done => {
|
|||||||
|
|
||||||
const { domain } = deploy.cdn;
|
const { domain } = deploy.cdn;
|
||||||
|
|
||||||
console.log(`Updating versions to '${version}'...`);
|
log(`Uploading ${ansi.green.bold(version)} to ${ansi.cyan(domain)}...`);
|
||||||
|
|
||||||
// Replace versioned URLs in source
|
// Replace versioned URLs in source
|
||||||
const files = ['plyr.js', 'plyr.polyfilled.js', 'config/defaults.js'];
|
const files = ['plyr.js', 'plyr.polyfilled.js', 'config/defaults.js'];
|
||||||
@ -342,7 +338,7 @@ gulp.task('cdn', done => {
|
|||||||
throw new Error('No publisher instance. Check AWS configuration.');
|
throw new Error('No publisher instance. Check AWS configuration.');
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(`Uploading '${version}' to ${domain}...`);
|
log(`Uploading ${ansi.green.bold(pkg.version)} to ${ansi.cyan(domain)}...`);
|
||||||
|
|
||||||
// Upload to CDN
|
// Upload to CDN
|
||||||
return (
|
return (
|
||||||
@ -385,13 +381,13 @@ gulp.task('purge', () => {
|
|||||||
const purge = new FastlyPurge(fastly.token);
|
const purge = new FastlyPurge(fastly.token);
|
||||||
|
|
||||||
list.forEach(url => {
|
list.forEach(url => {
|
||||||
console.log(`Purging ${url}...`);
|
log(`Purging ${ansi.cyan(url)}...`);
|
||||||
|
|
||||||
purge.url(url, (error, result) => {
|
purge.url(url, (error, result) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
console.log(error);
|
log.error(error);
|
||||||
} else if (result) {
|
} else if (result) {
|
||||||
console.log(result);
|
log(result);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -412,7 +408,7 @@ gulp.task('demo', done => {
|
|||||||
throw new Error('No publisher instance. Check AWS configuration.');
|
throw new Error('No publisher instance. Check AWS configuration.');
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(`Uploading '${version}' demo to ${deploy.demo.domain}...`);
|
log(`Uploading ${ansi.green.bold(pkg.version)} to ${ansi.cyan(domain)}...`);
|
||||||
|
|
||||||
// Replace versioned files in readme.md
|
// Replace versioned files in readme.md
|
||||||
gulp.src([`${__dirname}/readme.md`])
|
gulp.src([`${__dirname}/readme.md`])
|
||||||
|
19
package.json
19
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "plyr",
|
"name": "plyr",
|
||||||
"version": "3.5.0",
|
"version": "3.5.1",
|
||||||
"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>",
|
"author": "Sam Potts <sam@potts.es>",
|
||||||
@ -27,10 +27,7 @@
|
|||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/sampotts/plyr/issues"
|
"url": "https://github.com/sampotts/plyr/issues"
|
||||||
},
|
},
|
||||||
"browserslist": [
|
"browserslist": "> 1%",
|
||||||
"> 1%",
|
|
||||||
"not dead"
|
|
||||||
],
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "gulp build",
|
"build": "gulp build",
|
||||||
"lint": "eslint src/js && npm run-script remark",
|
"lint": "eslint src/js && npm run-script remark",
|
||||||
@ -38,13 +35,13 @@
|
|||||||
"deploy": "yarn lint && gulp deploy"
|
"deploy": "yarn lint && gulp deploy"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"aws-sdk": "^2.404.0",
|
"ansi-colors": "^3.2.3",
|
||||||
|
"aws-sdk": "^2.409.0",
|
||||||
"@babel/core": "^7.3.3",
|
"@babel/core": "^7.3.3",
|
||||||
"@babel/preset-env": "^7.3.1",
|
"@babel/preset-env": "^7.3.1",
|
||||||
"babel-eslint": "^10.0.1",
|
"babel-eslint": "^10.0.1",
|
||||||
"babel-preset-minify": "^0.5.0",
|
|
||||||
"del": "^3.0.0",
|
"del": "^3.0.0",
|
||||||
"eslint": "^5.14.0",
|
"eslint": "^5.14.1",
|
||||||
"eslint-config-airbnb-base": "^13.1.0",
|
"eslint-config-airbnb-base": "^13.1.0",
|
||||||
"eslint-config-prettier": "^4.0.0",
|
"eslint-config-prettier": "^4.0.0",
|
||||||
"eslint-plugin-import": "^2.16.0",
|
"eslint-plugin-import": "^2.16.0",
|
||||||
@ -66,7 +63,7 @@
|
|||||||
"gulp-replace": "^1.0.0",
|
"gulp-replace": "^1.0.0",
|
||||||
"gulp-sass": "^4.0.2",
|
"gulp-sass": "^4.0.2",
|
||||||
"gulp-size": "^3.0.0",
|
"gulp-size": "^3.0.0",
|
||||||
"gulp-sourcemaps": "^2.6.4",
|
"gulp-sourcemaps": "^2.6.5",
|
||||||
"gulp-svgstore": "^7.0.1",
|
"gulp-svgstore": "^7.0.1",
|
||||||
"gulp-terser": "^1.1.7",
|
"gulp-terser": "^1.1.7",
|
||||||
"postcss-custom-properties": "^8.0.9",
|
"postcss-custom-properties": "^8.0.9",
|
||||||
@ -76,13 +73,13 @@
|
|||||||
"remark-validate-links": "^8.0.0",
|
"remark-validate-links": "^8.0.0",
|
||||||
"rollup-plugin-babel": "^4.3.2",
|
"rollup-plugin-babel": "^4.3.2",
|
||||||
"rollup-plugin-commonjs": "^9.2.0",
|
"rollup-plugin-commonjs": "^9.2.0",
|
||||||
"rollup-plugin-node-resolve": "^4.0.0",
|
"rollup-plugin-node-resolve": "^4.0.1",
|
||||||
"stylelint": "^9.10.1",
|
"stylelint": "^9.10.1",
|
||||||
"stylelint-config-prettier": "^4.0.0",
|
"stylelint-config-prettier": "^4.0.0",
|
||||||
"stylelint-config-recommended": "^2.1.0",
|
"stylelint-config-recommended": "^2.1.0",
|
||||||
"stylelint-config-sass-guidelines": "^5.3.0",
|
"stylelint-config-sass-guidelines": "^5.3.0",
|
||||||
"stylelint-order": "^2.0.0",
|
"stylelint-order": "^2.0.0",
|
||||||
"stylelint-scss": "^3.5.3",
|
"stylelint-scss": "^3.5.4",
|
||||||
"stylelint-selector-bem-pattern": "^2.0.0",
|
"stylelint-selector-bem-pattern": "^2.0.0",
|
||||||
"through2": "^3.0.0"
|
"through2": "^3.0.0"
|
||||||
},
|
},
|
||||||
|
@ -17,7 +17,7 @@ import { buildUrlParams } from '../utils/urls';
|
|||||||
class Ads {
|
class Ads {
|
||||||
/**
|
/**
|
||||||
* Ads constructor.
|
* Ads constructor.
|
||||||
* @param {object} player
|
* @param {Object} player
|
||||||
* @return {Ads}
|
* @return {Ads}
|
||||||
*/
|
*/
|
||||||
constructor(player) {
|
constructor(player) {
|
||||||
@ -198,7 +198,7 @@ class Ads {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the ad countdown
|
* Update the ad countdown
|
||||||
* @param {boolean} start
|
* @param {Boolean} start
|
||||||
*/
|
*/
|
||||||
pollCountdown(start = false) {
|
pollCountdown(start = false) {
|
||||||
if (!start) {
|
if (!start) {
|
||||||
@ -559,7 +559,7 @@ class Ads {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles callbacks after an ad event was invoked
|
* Handles callbacks after an ad event was invoked
|
||||||
* @param {string} event - Event type
|
* @param {String} event - Event type
|
||||||
*/
|
*/
|
||||||
trigger(event, ...args) {
|
trigger(event, ...args) {
|
||||||
const handlers = this.events[event];
|
const handlers = this.events[event];
|
||||||
@ -575,8 +575,8 @@ class Ads {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Add event listeners
|
* Add event listeners
|
||||||
* @param {string} event - Event type
|
* @param {String} event - Event type
|
||||||
* @param {function} callback - Callback for when event occurs
|
* @param {Function} callback - Callback for when event occurs
|
||||||
* @return {Ads}
|
* @return {Ads}
|
||||||
*/
|
*/
|
||||||
on(event, callback) {
|
on(event, callback) {
|
||||||
@ -594,8 +594,8 @@ class Ads {
|
|||||||
* The advertisement has 12 seconds to get its things together. We stop this timer when the
|
* The advertisement has 12 seconds to get its things together. We stop this timer when the
|
||||||
* advertisement is playing, or when a user action is required to start, then we clear the
|
* advertisement is playing, or when a user action is required to start, then we clear the
|
||||||
* timer on ad ready
|
* timer on ad ready
|
||||||
* @param {number} time
|
* @param {Number} time
|
||||||
* @param {string} from
|
* @param {String} from
|
||||||
*/
|
*/
|
||||||
startSafetyTimer(time, from) {
|
startSafetyTimer(time, from) {
|
||||||
this.player.debug.log(`Safety timer invoked from: ${from}`);
|
this.player.debug.log(`Safety timer invoked from: ${from}`);
|
||||||
@ -608,7 +608,7 @@ class Ads {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear our safety timer(s)
|
* Clear our safety timer(s)
|
||||||
* @param {string} from
|
* @param {String} from
|
||||||
*/
|
*/
|
||||||
clearSafetyTimer(from) {
|
clearSafetyTimer(from) {
|
||||||
if (!is.nullOrUndefined(this.safetyTimer)) {
|
if (!is.nullOrUndefined(this.safetyTimer)) {
|
||||||
|
@ -403,7 +403,7 @@ class Plyr {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Toggle playback based on current status
|
* Toggle playback based on current status
|
||||||
* @param {boolean} input
|
* @param {Boolean} input
|
||||||
*/
|
*/
|
||||||
togglePlay(input) {
|
togglePlay(input) {
|
||||||
// Toggle based on current state if nothing passed
|
// Toggle based on current state if nothing passed
|
||||||
@ -437,7 +437,7 @@ class Plyr {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Rewind
|
* Rewind
|
||||||
* @param {number} seekTime - how far to rewind in seconds. Defaults to the config.seekTime
|
* @param {Number} seekTime - how far to rewind in seconds. Defaults to the config.seekTime
|
||||||
*/
|
*/
|
||||||
rewind(seekTime) {
|
rewind(seekTime) {
|
||||||
this.currentTime = this.currentTime - (is.number(seekTime) ? seekTime : this.config.seekTime);
|
this.currentTime = this.currentTime - (is.number(seekTime) ? seekTime : this.config.seekTime);
|
||||||
@ -445,7 +445,7 @@ class Plyr {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Fast forward
|
* Fast forward
|
||||||
* @param {number} seekTime - how far to fast forward in seconds. Defaults to the config.seekTime
|
* @param {Number} seekTime - how far to fast forward in seconds. Defaults to the config.seekTime
|
||||||
*/
|
*/
|
||||||
forward(seekTime) {
|
forward(seekTime) {
|
||||||
this.currentTime = this.currentTime + (is.number(seekTime) ? seekTime : this.config.seekTime);
|
this.currentTime = this.currentTime + (is.number(seekTime) ? seekTime : this.config.seekTime);
|
||||||
@ -453,7 +453,7 @@ class Plyr {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Seek to a time
|
* Seek to a time
|
||||||
* @param {number} input - where to seek to in seconds. Defaults to 0 (the start)
|
* @param {Number} input - where to seek to in seconds. Defaults to 0 (the start)
|
||||||
*/
|
*/
|
||||||
set currentTime(input) {
|
set currentTime(input) {
|
||||||
// Bail if media duration isn't available yet
|
// Bail if media duration isn't available yet
|
||||||
@ -523,7 +523,7 @@ class Plyr {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the player volume
|
* Set the player volume
|
||||||
* @param {number} value - must be between 0 and 1. Defaults to the value from local storage and config.volume if not set in storage
|
* @param {Number} value - must be between 0 and 1. Defaults to the value from local storage and config.volume if not set in storage
|
||||||
*/
|
*/
|
||||||
set volume(value) {
|
set volume(value) {
|
||||||
let volume = value;
|
let volume = value;
|
||||||
@ -574,7 +574,7 @@ class Plyr {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Increase volume
|
* Increase volume
|
||||||
* @param {boolean} step - How much to decrease by (between 0 and 1)
|
* @param {Boolean} step - How much to decrease by (between 0 and 1)
|
||||||
*/
|
*/
|
||||||
increaseVolume(step) {
|
increaseVolume(step) {
|
||||||
const volume = this.media.muted ? 0 : this.volume;
|
const volume = this.media.muted ? 0 : this.volume;
|
||||||
@ -583,7 +583,7 @@ class Plyr {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Decrease volume
|
* Decrease volume
|
||||||
* @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) {
|
||||||
this.increaseVolume(-step);
|
this.increaseVolume(-step);
|
||||||
@ -591,7 +591,7 @@ class Plyr {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set muted state
|
* Set muted state
|
||||||
* @param {boolean} mute
|
* @param {Boolean} mute
|
||||||
*/
|
*/
|
||||||
set muted(mute) {
|
set muted(mute) {
|
||||||
let toggle = mute;
|
let toggle = mute;
|
||||||
@ -643,7 +643,7 @@ class Plyr {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set playback speed
|
* Set playback speed
|
||||||
* @param {number} speed - the speed of playback (0.5-2.0)
|
* @param {Number} speed - the speed of playback (0.5-2.0)
|
||||||
*/
|
*/
|
||||||
set speed(input) {
|
set speed(input) {
|
||||||
let speed = null;
|
let speed = null;
|
||||||
@ -690,7 +690,7 @@ class Plyr {
|
|||||||
/**
|
/**
|
||||||
* Set playback quality
|
* Set playback quality
|
||||||
* Currently HTML5 & YouTube only
|
* Currently HTML5 & YouTube only
|
||||||
* @param {number} input - Quality level
|
* @param {Number} input - Quality level
|
||||||
*/
|
*/
|
||||||
set quality(input) {
|
set quality(input) {
|
||||||
const config = this.config.quality;
|
const config = this.config.quality;
|
||||||
@ -740,7 +740,7 @@ class Plyr {
|
|||||||
/**
|
/**
|
||||||
* Toggle loop
|
* Toggle loop
|
||||||
* TODO: Finish fancy new logic. Set the indicator on load as user may pass loop as config
|
* TODO: Finish fancy new logic. Set the indicator on load as user may pass loop as config
|
||||||
* @param {boolean} input - Whether to loop or not
|
* @param {Boolean} input - Whether to loop or not
|
||||||
*/
|
*/
|
||||||
set loop(input) {
|
set loop(input) {
|
||||||
const toggle = is.boolean(input) ? input : this.config.loop.active;
|
const toggle = is.boolean(input) ? input : this.config.loop.active;
|
||||||
@ -800,7 +800,7 @@ class Plyr {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set new media source
|
* Set new media source
|
||||||
* @param {object} input - The new source object (see docs)
|
* @param {Object} input - The new source object (see docs)
|
||||||
*/
|
*/
|
||||||
set source(input) {
|
set source(input) {
|
||||||
source.change.call(this, input);
|
source.change.call(this, input);
|
||||||
@ -824,7 +824,7 @@ class Plyr {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the poster image for a video
|
* Set the poster image for a video
|
||||||
* @param {input} - the URL for the new poster image
|
* @param {String} input - the URL for the new poster image
|
||||||
*/
|
*/
|
||||||
set poster(input) {
|
set poster(input) {
|
||||||
if (!this.isVideo) {
|
if (!this.isVideo) {
|
||||||
@ -848,7 +848,7 @@ class Plyr {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the autoplay state
|
* Set the autoplay state
|
||||||
* @param {boolean} input - Whether to autoplay or not
|
* @param {Boolean} input - Whether to autoplay or not
|
||||||
*/
|
*/
|
||||||
set autoplay(input) {
|
set autoplay(input) {
|
||||||
const toggle = is.boolean(input) ? input : this.config.autoplay;
|
const toggle = is.boolean(input) ? input : this.config.autoplay;
|
||||||
@ -864,7 +864,7 @@ class Plyr {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Toggle captions
|
* Toggle captions
|
||||||
* @param {boolean} input - Whether to enable captions
|
* @param {Boolean} input - Whether to enable captions
|
||||||
*/
|
*/
|
||||||
toggleCaptions(input) {
|
toggleCaptions(input) {
|
||||||
captions.toggle.call(this, input, false);
|
captions.toggle.call(this, input, false);
|
||||||
@ -872,7 +872,7 @@ class Plyr {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the caption track by index
|
* Set the caption track by index
|
||||||
* @param {number} - Caption index
|
* @param {Number} - Caption index
|
||||||
*/
|
*/
|
||||||
set currentTrack(input) {
|
set currentTrack(input) {
|
||||||
captions.set.call(this, input, false);
|
captions.set.call(this, input, false);
|
||||||
@ -889,7 +889,7 @@ class Plyr {
|
|||||||
/**
|
/**
|
||||||
* Set the wanted language for captions
|
* Set the wanted language for captions
|
||||||
* Since tracks can be added later it won't update the actual caption track until there is a matching track
|
* Since tracks can be added later it won't update the actual caption track until there is a matching track
|
||||||
* @param {string} - Two character ISO language code (e.g. EN, FR, PT, etc)
|
* @param {String} - Two character ISO language code (e.g. EN, FR, PT, etc)
|
||||||
*/
|
*/
|
||||||
set language(input) {
|
set language(input) {
|
||||||
captions.setLanguage.call(this, input, false);
|
captions.setLanguage.call(this, input, false);
|
||||||
@ -962,7 +962,7 @@ class Plyr {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Toggle the player controls
|
* Toggle the player controls
|
||||||
* @param {boolean} [toggle] - Whether to show the controls
|
* @param {Boolean} [toggle] - Whether to show the controls
|
||||||
*/
|
*/
|
||||||
toggleControls(toggle) {
|
toggleControls(toggle) {
|
||||||
// Don't toggle if missing UI support or if it's audio
|
// Don't toggle if missing UI support or if it's audio
|
||||||
@ -995,8 +995,8 @@ class Plyr {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Add event listeners
|
* Add event listeners
|
||||||
* @param {string} event - Event type
|
* @param {String} event - Event type
|
||||||
* @param {function} callback - Callback for when event occurs
|
* @param {Function} callback - Callback for when event occurs
|
||||||
*/
|
*/
|
||||||
on(event, callback) {
|
on(event, callback) {
|
||||||
on.call(this, this.elements.container, event, callback);
|
on.call(this, this.elements.container, event, callback);
|
||||||
@ -1004,8 +1004,8 @@ class Plyr {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Add event listeners once
|
* Add event listeners once
|
||||||
* @param {string} event - Event type
|
* @param {String} event - Event type
|
||||||
* @param {function} callback - Callback for when event occurs
|
* @param {Function} callback - Callback for when event occurs
|
||||||
*/
|
*/
|
||||||
once(event, callback) {
|
once(event, callback) {
|
||||||
once.call(this, this.elements.container, event, callback);
|
once.call(this, this.elements.container, event, callback);
|
||||||
@ -1013,8 +1013,8 @@ class Plyr {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove event listeners
|
* Remove event listeners
|
||||||
* @param {string} event - Event type
|
* @param {String} event - Event type
|
||||||
* @param {function} callback - Callback for when event occurs
|
* @param {Function} callback - Callback for when event occurs
|
||||||
*/
|
*/
|
||||||
off(event, callback) {
|
off(event, callback) {
|
||||||
off(this.elements.container, event, callback);
|
off(this.elements.container, event, callback);
|
||||||
@ -1024,8 +1024,8 @@ class Plyr {
|
|||||||
* Destroy an instance
|
* Destroy an instance
|
||||||
* Event listeners are removed when elements are removed
|
* Event listeners are removed when elements are removed
|
||||||
* http://stackoverflow.com/questions/12528049/if-a-dom-element-is-removed-are-its-listeners-also-removed-from-memory
|
* http://stackoverflow.com/questions/12528049/if-a-dom-element-is-removed-are-its-listeners-also-removed-from-memory
|
||||||
* @param {function} callback - Callback for when destroy is complete
|
* @param {Function} callback - Callback for when destroy is complete
|
||||||
* @param {boolean} soft - Whether it's a soft destroy (for source changes etc)
|
* @param {Boolean} soft - Whether it's a soft destroy (for source changes etc)
|
||||||
*/
|
*/
|
||||||
destroy(callback, soft = false) {
|
destroy(callback, soft = false) {
|
||||||
if (!this.ready) {
|
if (!this.ready) {
|
||||||
@ -1124,7 +1124,7 @@ class Plyr {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Check for support for a mime type (HTML5 only)
|
* Check for support for a mime type (HTML5 only)
|
||||||
* @param {string} type - Mime type
|
* @param {String} type - Mime type
|
||||||
*/
|
*/
|
||||||
supports(type) {
|
supports(type) {
|
||||||
return support.mime.call(this, type);
|
return support.mime.call(this, type);
|
||||||
@ -1132,9 +1132,9 @@ class Plyr {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Check for support
|
* Check for support
|
||||||
* @param {string} type - Player type (audio/video)
|
* @param {String} type - Player type (audio/video)
|
||||||
* @param {string} provider - Provider (html5/youtube/vimeo)
|
* @param {String} provider - Provider (html5/youtube/vimeo)
|
||||||
* @param {bool} inline - Where player has `playsinline` sttribute
|
* @param {Boolean} inline - Where player has `playsinline` sttribute
|
||||||
*/
|
*/
|
||||||
static supported(type, provider, inline) {
|
static supported(type, provider, inline) {
|
||||||
return support.check(type, provider, inline);
|
return support.check(type, provider, inline);
|
||||||
@ -1142,8 +1142,8 @@ class Plyr {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Load an SVG sprite into the page
|
* Load an SVG sprite into the page
|
||||||
* @param {string} url - URL for the SVG sprite
|
* @param {String} url - URL for the SVG sprite
|
||||||
* @param {string} [id] - Unique ID
|
* @param {String} [id] - Unique ID
|
||||||
*/
|
*/
|
||||||
static loadSprite(url, id) {
|
static loadSprite(url, id) {
|
||||||
return loadSprite(url, id);
|
return loadSprite(url, id);
|
||||||
@ -1152,7 +1152,7 @@ class Plyr {
|
|||||||
/**
|
/**
|
||||||
* Setup multiple instances
|
* Setup multiple instances
|
||||||
* @param {*} selector
|
* @param {*} selector
|
||||||
* @param {object} options
|
* @param {Object} options
|
||||||
*/
|
*/
|
||||||
static setup(selector, options = {}) {
|
static setup(selector, options = {}) {
|
||||||
let targets = null;
|
let targets = null;
|
||||||
|
@ -6,8 +6,8 @@ import is from './is';
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse a string to a URL object
|
* Parse a string to a URL object
|
||||||
* @param {string} input - the URL to be parsed
|
* @param {String} input - the URL to be parsed
|
||||||
* @param {boolean} safe - failsafe parsing
|
* @param {Boolean} safe - failsafe parsing
|
||||||
*/
|
*/
|
||||||
export function parseUrl(input, safe = true) {
|
export function parseUrl(input, safe = true) {
|
||||||
let url = input;
|
let url = input;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user