aboutsummaryrefslogtreecommitdiffstats
path: root/src/js/plyr.js
diff options
context:
space:
mode:
authorSam <me@sampotts.me>2016-06-01 09:38:29 +0100
committerSam <me@sampotts.me>2016-06-01 09:38:29 +0100
commit521431e09390e86895f8a52cf0a50195d9050be1 (patch)
treec8887f840fa7484f9f89796b7cbb7496a5a86eb5 /src/js/plyr.js
parent552f448ccd4634441104dca29c20fa441d644dfc (diff)
downloadplyr-521431e09390e86895f8a52cf0a50195d9050be1.tar.lz
plyr-521431e09390e86895f8a52cf0a50195d9050be1.tar.xz
plyr-521431e09390e86895f8a52cf0a50195d9050be1.zip
Fix for scroll direction on volume (fixes #258)
Diffstat (limited to 'src/js/plyr.js')
-rw-r--r--src/js/plyr.js28
1 files changed, 20 insertions, 8 deletions
diff --git a/src/js/plyr.js b/src/js/plyr.js
index 1e5d2156..f54db4e0 100644
--- a/src/js/plyr.js
+++ b/src/js/plyr.js
@@ -1,6 +1,6 @@
// ==========================================================================
// Plyr
-// plyr.js v1.6.18
+// plyr.js v1.6.19
// https://github.com/selz/plyr
// License: The MIT License (MIT)
// ==========================================================================
@@ -44,7 +44,7 @@
displayDuration: true,
loadSprite: true,
iconPrefix: 'plyr',
- iconUrl: 'https://cdn.plyr.io/1.6.18/plyr.svg',
+ iconUrl: 'https://cdn.plyr.io/1.6.19/plyr.svg',
clickToPlay: true,
hideControls: true,
showPosterOnEnd: false,
@@ -1439,8 +1439,6 @@
_setAttributes(vimeo, {
'src': 'https://player.vimeo.com/video/' + mediaId + '?player_id=' + id + '&api=1&badge=0&byline=0&portrait=0&title=0',
'id': id,
- 'webkitallowfullscreen': '',
- 'mozallowfullscreen': '',
'allowfullscreen': '',
'frameborder': 0
});
@@ -2843,14 +2841,28 @@
_on(plyr.volume.input, 'wheel', function(event) {
event.preventDefault();
- // Scroll down to decrease
+ // Detect "natural" scroll - suppored on OS X Safari only
+ // Other browsers on OS X will be inverted until support improves
+ var inverted = event.webkitDirectionInvertedFromDevice;
+
+ // Scroll down (or up on natural) to decrease
if (event.deltaY < 0 || event.deltaX > 0) {
- _decreaseVolume();
+ if (inverted) {
+ _decreaseVolume();
+ }
+ else {
+ _increaseVolume();
+ }
}
- // Scroll up to increase
+ // Scroll up (or down on natural) to increase
if (event.deltaY > 0 || event.deltaX < 0) {
- _increaseVolume();
+ if (inverted) {
+ _increaseVolume();
+ }
+ else {
+ _decreaseVolume();
+ }
}
});
}