Cleanup
This commit is contained in:
parent
f8ecea8fb7
commit
62c1b368cf
2
dist/plyr.js
vendored
2
dist/plyr.js
vendored
File diff suppressed because one or more lines are too long
2
dist/plyr.js.map
vendored
2
dist/plyr.js.map
vendored
File diff suppressed because one or more lines are too long
@ -47,8 +47,8 @@ const vimeo = {
|
|||||||
|
|
||||||
// Get Vimeo params for the iframe
|
// Get Vimeo params for the iframe
|
||||||
const options = {
|
const options = {
|
||||||
loop: this.config.loop.active,
|
loop: player.config.loop.active,
|
||||||
autoplay: this.config.autoplay,
|
autoplay: player.config.autoplay,
|
||||||
byline: false,
|
byline: false,
|
||||||
portrait: false,
|
portrait: false,
|
||||||
title: false,
|
title: false,
|
||||||
@ -56,7 +56,7 @@ const vimeo = {
|
|||||||
transparent: 0,
|
transparent: 0,
|
||||||
};
|
};
|
||||||
const params = utils.buildUrlParameters(options);
|
const params = utils.buildUrlParameters(options);
|
||||||
const id = utils.parseVimeoId(this.embedId);
|
const id = utils.parseVimeoId(player.embedId);
|
||||||
|
|
||||||
// Build an iframe
|
// Build an iframe
|
||||||
const iframe = utils.createElement('iframe');
|
const iframe = utils.createElement('iframe');
|
||||||
@ -66,7 +66,7 @@ const vimeo = {
|
|||||||
player.media.appendChild(iframe);
|
player.media.appendChild(iframe);
|
||||||
|
|
||||||
// Setup instance
|
// Setup instance
|
||||||
// https://github.com/vimeo/this.js
|
// https://github.com/vimeo/player.js
|
||||||
player.embed = new window.Vimeo.Player(iframe);
|
player.embed = new window.Vimeo.Player(iframe);
|
||||||
|
|
||||||
// Create a faux HTML5 API using the Vimeo API
|
// Create a faux HTML5 API using the Vimeo API
|
||||||
@ -108,7 +108,7 @@ const vimeo = {
|
|||||||
|
|
||||||
// Restore pause state
|
// Restore pause state
|
||||||
if (paused) {
|
if (paused) {
|
||||||
this.pause();
|
player.pause();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@ -174,7 +174,7 @@ const vimeo = {
|
|||||||
// Get current time
|
// Get current time
|
||||||
player.embed.getCurrentTime().then(value => {
|
player.embed.getCurrentTime().then(value => {
|
||||||
currentTime = value;
|
currentTime = value;
|
||||||
utils.dispatchEvent.call(this, this.media, 'timeupdate');
|
utils.dispatchEvent.call(player, player.media, 'timeupdate');
|
||||||
});
|
});
|
||||||
|
|
||||||
// Get duration
|
// Get duration
|
||||||
@ -220,31 +220,31 @@ const vimeo = {
|
|||||||
utils.dispatchEvent.call(player, player.media, 'pause');
|
utils.dispatchEvent.call(player, player.media, 'pause');
|
||||||
});
|
});
|
||||||
|
|
||||||
this.embed.on('timeupdate', data => {
|
player.embed.on('timeupdate', data => {
|
||||||
this.media.seeking = false;
|
player.media.seeking = false;
|
||||||
currentTime = data.seconds;
|
currentTime = data.seconds;
|
||||||
utils.dispatchEvent.call(this, this.media, 'timeupdate');
|
utils.dispatchEvent.call(player, player.media, 'timeupdate');
|
||||||
});
|
});
|
||||||
|
|
||||||
this.embed.on('progress', data => {
|
player.embed.on('progress', data => {
|
||||||
this.media.buffered = data.percent;
|
player.media.buffered = data.percent;
|
||||||
utils.dispatchEvent.call(this, this.media, 'progress');
|
utils.dispatchEvent.call(player, player.media, 'progress');
|
||||||
|
|
||||||
if (parseInt(data.percent, 10) === 1) {
|
if (parseInt(data.percent, 10) === 1) {
|
||||||
// Trigger event
|
// Trigger event
|
||||||
utils.dispatchEvent.call(this, this.media, 'canplaythrough');
|
utils.dispatchEvent.call(player, player.media, 'canplaythrough');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.embed.on('seeked', () => {
|
player.embed.on('seeked', () => {
|
||||||
this.media.seeking = false;
|
player.media.seeking = false;
|
||||||
utils.dispatchEvent.call(this, this.media, 'seeked');
|
utils.dispatchEvent.call(player, player.media, 'seeked');
|
||||||
utils.dispatchEvent.call(this, this.media, 'play');
|
utils.dispatchEvent.call(player, player.media, 'play');
|
||||||
});
|
});
|
||||||
|
|
||||||
this.embed.on('ended', () => {
|
player.embed.on('ended', () => {
|
||||||
this.media.paused = true;
|
player.media.paused = true;
|
||||||
utils.dispatchEvent.call(this, this.media, 'ended');
|
utils.dispatchEvent.call(player, player.media, 'ended');
|
||||||
});
|
});
|
||||||
|
|
||||||
// Rebuild UI
|
// Rebuild UI
|
||||||
|
Loading…
x
Reference in New Issue
Block a user