Added disableContextMenu option to hide the right click context menu (fixes #248 and #225)

This commit is contained in:
Sam 2016-05-26 22:32:18 +01:00
parent 351e1540c5
commit c0909095e3
5 changed files with 46 additions and 31 deletions

View File

@ -1,7 +1,10 @@
# Changelog
# v1.6.17
- Added `disableContextMenu` option to hide the right click context menu (fixes #248 and #225)
# v1.6.16
- Always hide standard controls (Fixes #225)
- Always hide standard controls (fixes #225)
- Fix for Tooltips overflowing (fixes #230)
## v1.6.15
@ -89,18 +92,18 @@
- Docs fixes inc controls HTML (fixes #180)
## v1.5.17
- Expose YouTube and Vimeo API (docs update required) (Fixes #176)
- Expose YouTube and Vimeo API (docs update required) (fixes #176)
- Auto set title based on YouTube getVideoData() title property
- Bug fix for Vimeo API change (Uncaught TypeError: Cannot read property 'value' of undefined) due to a change their end
## v1.5.16
- Cancel requests on source change (Fixes #174)
- Cancel requests on source change (fixes #174)
## v1.5.15
- Fix for CustomEvent polyfill and related bug (See #172)
- Fix for CustomEvent polyfill and related bug (see #172)
## v1.5.14
- Volume storage fix (Fixes #171)
- Volume storage fix (fixes #171)
## v1.5.13
- Fix for manual caption rendering
@ -203,11 +206,11 @@
## v1.2.3
- Fix for YouTube on iPhone or unsupported browsers (fallback to YouTube native)
- Docs tidy up
- Fullscreen for Safari fix (Fixes #96)
- Fullscreen for Safari fix (fixes #96)
## v1.2.2
- Fix for :focus keyboard vs mouse (Fixes #61)
- Fix for caption positioning in full screen (Fixes #92)
- Fix for :focus keyboard vs mouse (fixes #61)
- Fix for caption positioning in full screen (fixes #92)
## v1.2.1
- Tooltip bug fix
@ -234,7 +237,7 @@
- Bug fix for 1.1.8
## v1.1.8
- setVolume API method improvements (Fixes #83)
- setVolume API method improvements (fixes #83)
## v1.1.7
- Restore classname on destroy()
@ -243,7 +246,7 @@
- New API methods (fixes #77), Fix for non strict mode (fixes #78)
## v1.1.5
- Fix for incorrect `isFullscreen()` return value in Mozilla (Fixes #38)
- Fix for incorrect `isFullscreen()` return value in Mozilla (fixes #38)
## v1.1.4
- Minor bug fixes
@ -267,17 +270,17 @@
- Display duration on `metadataloaded`
## v1.0.30
- Fixed bug with media longer than 60 minutes (Fixes #69)
- Fixed bug with media longer than 60 minutes (fixes #69)
## v1.0.29
- Added option to hide controls on fullscreen (default `true`) while palying, after 1s. Pause, mouse hover on progress, or focus on a child control re-shows the controls. On touch a tap of the video (which plays/pauses the video by default) is required. (Fixes #47)
- Added option to hide controls on fullscreen (default `true`) while palying, after 1s. Pause, mouse hover on progress, or focus on a child control re-shows the controls. On touch a tap of the video (which plays/pauses the video by default) is required. (fixes #47)
- Fixed a bug with caption toggle in 1.0.28
## v1.0.28
- Added API support for browsers that don't have full plyr support (pretty much <=IE9 and `<video>` on iPhone/iPod)
## v1.0.27
- Keyboard accessibility improvements (Fixes #66)
- Keyboard accessibility improvements (fixes #66)
## v1.0.26
- Fixes for SASS (cheers @brunowego)
@ -288,29 +291,29 @@
- Classnames for left/right controls changed
## v1.0.24
- Added tooltip option to display labels as tooltips (Fixes #50)
- Added tooltip option to display labels as tooltips (fixes #50)
## v1.0.23
- Handling loading states in the UI (Fixes #36)
- Handling loading states in the UI (fixes #36)
## v1.0.22
- Added support() API method for checking mimetype support
- Added source() API method for setting media source(s) (Fixes #44)
- Added source() API method for setting media source(s) (fixes #44)
- Added poster() API method for setting poster source
- Refactored captions logic for manual captions
## v1.0.21
- Added an <input type="range"> for seeking to improve experience (and support dragging) (Fixes #40, #42)
- Icons for restart and captions improved (and some IDs changed) (Fixes #49)
- Added an <input type="range"> for seeking to improve experience (and support dragging) (fixes #40, #42)
- Icons for restart and captions improved (and some IDs changed) (fixes #49)
## v1.0.20
- Default controls included (Fixes #45)
- Volume changes on `input` as well as `change` (Fixes #43)
- Volume changes on `input` as well as `change` (fixes #43)
- Fix for undefined Play text
- License changed to MIT
## v1.0.19
- Fixed firefox fullscreen issue (Fixes #38)
- Fixed firefox fullscreen issue (fixes #38)
## v1.0.18
- Added CDN references
@ -334,7 +337,7 @@
- Minor tweaks
## v1.0.12
- Handle native events (Issue #34)
- Handle native events (issue #34)
## v1.0.11
- Bug fixes for fullscreen mode

4
dist/plyr.js vendored

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{
"name": "plyr",
"version": "1.6.16",
"version": "1.6.17",
"description": "A simple, accessible and customizable HTML5, YouTube and Vimeo media player",
"homepage": "http://plyr.io",
"main": "src/js/plyr.js",

View File

@ -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.16/plyr.js` to `https://cdn.plyr.io/1.6.16/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.17/plyr.js` to `https://cdn.plyr.io/1.6.17/plyr.js`
### npm
@ -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.16/plyr.css">
<script src="https://cdn.plyr.io/1.6.16/plyr.js"></script>
<link rel="stylesheet" href="https://cdn.plyr.io/1.6.17/plyr.css">
<script src="https://cdn.plyr.io/1.6.17/plyr.js"></script>
```
The SVG sprite/defs file can be found here: `https://cdn.plyr.io/1.6.16/plyr.svg`.
The SVG sprite/defs file can be found here: `https://cdn.plyr.io/1.6.17/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.
@ -163,7 +163,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.16/plyr.js"></script>
<script src="https://cdn.plyr.io/1.6.17/plyr.js"></script>
<script>plyr.setup();</script>
```
@ -280,6 +280,12 @@ Options must be passed as an object to the `setup()` method as above or as JSON
<td><code>true</code></td>
<td>Click (or tap) of the video container will toggle pause/play.</td>
</tr>
<tr>
<td><code>disableContextMenu</code></td>
<td>Boolean</td>
<td><code>true</code></td>
<td>Disable right click menu on video to <em>help</em> as very primitive obfuscation to prevent downloads of content.</td>
</tr>
<tr>
<td><code>hideControls</code></td>
<td>Boolean</td>

View File

@ -1,6 +1,6 @@
// ==========================================================================
// Plyr
// plyr.js v1.6.16
// plyr.js v1.6.17
// https://github.com/selz/plyr
// License: The MIT License (MIT)
// ==========================================================================
@ -44,10 +44,11 @@
displayDuration: true,
loadSprite: true,
iconPrefix: 'plyr',
iconUrl: 'https://cdn.plyr.io/1.6.16/plyr.svg',
iconUrl: 'https://cdn.plyr.io/1.6.17/plyr.svg',
clickToPlay: true,
hideControls: true,
showPosterOnEnd: false,
disableContextMenu: true,
tooltips: {
controls: false,
seek: true
@ -2933,6 +2934,11 @@
});
}
// Disable right click
if (config.disableContextMenu) {
_on(plyr.media, 'contextmenu', function(event) { event.preventDefault(); });
}
// Proxy events to container
_on(plyr.media, config.events.join(' '), function(event) {
_triggerEvent(plyr.container, event.type, true);