Skip to content

Commit

Permalink
Decreased sensitivity and inverted scroll on volume slider (scroll up…
Browse files Browse the repository at this point in the history
… to increase, down to decrease)
  • Loading branch information
Sam Potts committed May 19, 2016
1 parent 1496b21 commit 98e4c5a
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 13 deletions.
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## v1.6.13
- Decreased sensitivity and inverted scroll on volume slider (scroll up to increase, down to decrease)

## v1.6.12
- Fix for undefined buffer error
- Add scroll listener on volume slider (PR #227 bty @igoradamenko)
Expand Down
2 changes: 1 addition & 1 deletion dist/plyr.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "plyr",
"version": "1.6.12",
"version": "1.6.13",
"description": "A simple, accessible and customizable HTML5, YouTube and Vimeo media player",
"homepage": "http://plyr.io",
"main": "src/js/plyr.js",
Expand Down
12 changes: 6 additions & 6 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ If you have any cool ideas or features, please let me know by [creating an issue
## Implementation
Check `docs/index.html` and `docs/dist/docs.js` for an example setup.

**Heads up:** the example `index.html` file needs to be served from a webserver (such as Apache, Nginx, IIS or similar) unless you change the file sources to include http or https. e.g. change `//cdn.plyr.io/1.6.12/plyr.js` to `https://cdn.plyr.io/1.6.12/plyr.js`
**Heads up:** the example `index.html` file needs to be served from a webserver (such as Apache, Nginx, IIS or similar) unless you change the file sources to include http or https. e.g. change `//cdn.plyr.io/1.6.13/plyr.js` to `https://cdn.plyr.io/1.6.13/plyr.js`

### npm

Expand Down Expand Up @@ -71,11 +71,11 @@ More info is on [npm](https://www.npmjs.com/package/ember-cli-plyr) and [GitHub]
If you want to use our CDN, you can use the following:

```html
<link rel="stylesheet" href="https://cdn.plyr.io/1.6.12/plyr.css">
<script src="https://cdn.plyr.io/1.6.12/plyr.js"></script>
<link rel="stylesheet" href="https://cdn.plyr.io/1.6.13/plyr.css">
<script src="https://cdn.plyr.io/1.6.13/plyr.js"></script>
```

The SVG sprite/defs file can be found here: `https://cdn.plyr.io/1.6.12/plyr.svg`.
The SVG sprite/defs file can be found here: `https://cdn.plyr.io/1.6.13/plyr.svg`.

### CSS & Styling
If you want to use the default css, add the `plyr.css` file from `/dist` into your head, or even better use `plyr.less` or `plyr.scss` file included in `/src` in your build to save a request.
Expand Down Expand Up @@ -113,7 +113,7 @@ Using AJAX means you can load the sprite from a different origin. Avoiding the i
c.innerHTML = a.responseText;
b.insertBefore(c, b.childNodes[0]);
};
})(document, 'https://cdn.plyr.io/1.6.12/plyr.svg');
})(document, 'https://cdn.plyr.io/1.6.13/plyr.svg');
</script>
```

Expand Down Expand Up @@ -188,7 +188,7 @@ Be sure to [validate your caption files](https://quuz.org/webvtt/)
Here's an example of a default setup:

```html
<script src="https://cdn.plyr.io/1.6.12/plyr.js"></script>
<script src="https://cdn.plyr.io/1.6.13/plyr.js"></script>
<script>plyr.setup();</script>
```

Expand Down
13 changes: 8 additions & 5 deletions src/js/plyr.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// ==========================================================================
// Plyr
// plyr.js v1.6.12
// plyr.js v1.6.13
// https://github.com/selz/plyr
// License: The MIT License (MIT)
// ==========================================================================
Expand Down Expand Up @@ -2107,14 +2107,14 @@
function _increaseVolume() {
var volume = plyr.media.muted ? 0 : (plyr.media.volume * config.volumeMax);

_setVolume(volume + config.volumeStep);
_setVolume(volume + (config.volumeStep / 5));
}

// Decrease volume
function _decreaseVolume() {
var volume = plyr.media.muted ? 0 : (plyr.media.volume * config.volumeMax);

_setVolume(volume - config.volumeStep);
_setVolume(volume - (config.volumeStep / 5));
}

// Update volume UI and storage
Expand Down Expand Up @@ -2786,15 +2786,18 @@
_on(plyr.controls, 'focus blur', _toggleControls, true);
}

// Adjust volume on scroll
_on(plyr.volume.input, 'wheel', function(event) {
event.preventDefault();

// Scroll down to decrease
if (event.deltaY < 0 || event.deltaX > 0) {
_increaseVolume();
_decreaseVolume();
}

// Scroll up to increase
if (event.deltaY > 0 || event.deltaX < 0) {
_decreaseVolume();
_increaseVolume();
}
});
}
Expand Down

4 comments on commit 98e4c5a

@Savageman
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the page on https://plyr.io/ up to date? Because there when I scroll up the volume decreases... It's totally reversed.

@sampotts
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, it's the OS X vs Windows thing I think. I'll have to see if I can detect whether the UA is OSX and has the "Natural scroll" enabled.

@Savageman
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was Ubuntu, I'll try in Windows tonight :)

@sampotts
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just pushed a fix so https://plyr.io should be ok now on all apart from Chrome on OS X if the user has natural scroll enabled. Unfortunately there's no way to detect natural scroll is enabled in anything other than Safari (although it's been proposed). Anyhow, Windows, Linux etc should all be correct now.

Please sign in to comment.