Small bug fixes

This commit is contained in:
Sam Potts 2017-11-04 14:45:06 +11:00
parent 1cc2930dc0
commit 069c8093ae
6 changed files with 26 additions and 43 deletions

2
dist/plyr.js vendored

File diff suppressed because one or more lines are too long

2
dist/plyr.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -467,7 +467,7 @@ const listeners = {
// Volume
utils.proxy(this.elements.inputs.volume, inputEvent, this.config.listeners.volume, event => {
this.setVolume(event.target.value);
this.volume = event.target.value;
});
// Polyfill for lower fill in <input type="range"> for webkit

View File

@ -78,6 +78,15 @@ const vimeo = {
player.media.paused = true;
player.media.currentTime = 0;
// Playback speed
// Not currently supported in Vimeo
Object.defineProperty(player.media, 'playbackRate', {
get() {
return null;
},
set() {},
});
// Rebuild UI
ui.build.call(player);

View File

@ -6,14 +6,6 @@ import utils from './../utils';
import controls from './../controls';
import ui from './../ui';
/* Object.defineProperty(input, "value", {
get: function() {return this._value;},
set: function(v) {
// Do your stuff
this._value = v;
}
}); */
const youtube = {
// Setup YouTube
setup() {
@ -126,6 +118,16 @@ const youtube = {
player.media.muted = instance.isMuted();
player.media.currentTime = 0;
// Playback speed
Object.defineProperty(player.media, 'playbackRate', {
get() {
return instance.getPlaybackRate();
},
set(speed) {
instance.setPlaybackRate(speed);
},
});
// Get available speeds
if (player.config.controls.includes('settings') && player.config.settings.includes('speed')) {
controls.setSpeedMenu.call(player, instance.getAvailablePlaybackRates());

View File

@ -513,39 +513,11 @@ class Plyr {
}
// Set media speed
// TODO: Should be in adapter
switch (this.type) {
case 'youtube':
this.embed.setPlaybackRate(speed);
break;
case 'vimeo':
speed = null;
// Vimeo not supported (https://github.com/vimeo/this.js)
this.warn('Vimeo playback rate change is not supported');
break;
default:
this.media.playbackRate = speed;
break;
}
this.media.playbackRate = speed;
}
get speed() {
// Set media speed
// TODO: Should be in adapter
switch (this.type) {
case 'youtube':
return this.embed.getPlaybackRate();
case 'vimeo':
// Vimeo not supported (https://github.com/vimeo/player.js)
this.warn('Vimeo playback rate change is not supported');
return null;
default:
return this.media.playbackRate;
}
return this.media.playbackRate;
}
// Set playback quality
@ -592,7 +564,7 @@ class Plyr {
// Toggle loop
// TODO: Finish logic
// TODO: Set the indicator on load as user may pass loop as config
loop(input) {
/* loop(input) {
// Set default to be a true toggle
const type = ['start', 'end', 'all', 'none', 'toggle'].includes(input) ? input : 'toggle';
@ -638,7 +610,7 @@ class Plyr {
// Allow chaining
return this;
}
} */
// Media source
set src(input) {