aboutsummaryrefslogtreecommitdiffstats
path: root/src/js
diff options
context:
space:
mode:
authorSam Potts <me@sampotts.me>2017-11-04 14:45:06 +1100
committerSam Potts <me@sampotts.me>2017-11-04 14:45:06 +1100
commit069c8093aefec9f23f3ff38de6041f8f90edf022 (patch)
tree157005bd109bbce0c1fbbb6115319f19ec115bc7 /src/js
parent1cc2930dc0b81183bc47442f5ad9b5d8df94cc5f (diff)
downloadplyr-069c8093aefec9f23f3ff38de6041f8f90edf022.tar.lz
plyr-069c8093aefec9f23f3ff38de6041f8f90edf022.tar.xz
plyr-069c8093aefec9f23f3ff38de6041f8f90edf022.zip
Small bug fixes
Diffstat (limited to 'src/js')
-rw-r--r--src/js/listeners.js2
-rw-r--r--src/js/plugins/vimeo.js9
-rw-r--r--src/js/plugins/youtube.js18
-rw-r--r--src/js/plyr.js36
4 files changed, 24 insertions, 41 deletions
diff --git a/src/js/listeners.js b/src/js/listeners.js
index 4349e35e..f3746414 100644
--- a/src/js/listeners.js
+++ b/src/js/listeners.js
@@ -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
diff --git a/src/js/plugins/vimeo.js b/src/js/plugins/vimeo.js
index 99b55e32..12632f64 100644
--- a/src/js/plugins/vimeo.js
+++ b/src/js/plugins/vimeo.js
@@ -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);
diff --git a/src/js/plugins/youtube.js b/src/js/plugins/youtube.js
index 61e7adce..7d5c729c 100644
--- a/src/js/plugins/youtube.js
+++ b/src/js/plugins/youtube.js
@@ -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());
diff --git a/src/js/plyr.js b/src/js/plyr.js
index 50b437c1..f98bef1a 100644
--- a/src/js/plyr.js
+++ b/src/js/plyr.js
@@ -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) {