Compare commits

...

5 Commits

Author SHA1 Message Date
df84ce6e90 Docs 2015-05-18 15:11:16 +10:00
7161378da1 Bug fix 2015-05-18 15:10:40 +10:00
224b612ae7 Bug fix 2015-05-18 14:46:21 +10:00
19d7522722 Fixes bug with 1.1.8 volume 2015-05-18 14:43:45 +10:00
ceace2a678 setVolume() API method improvements (Fixes #83) 2015-05-18 13:50:44 +10:00
8 changed files with 52 additions and 45 deletions

2
dist/plyr.js vendored

File diff suppressed because one or more lines are too long

2
docs/dist/docs.js vendored

File diff suppressed because one or more lines are too long

View File

@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Docs styles --> <!-- Docs styles -->
<link rel="stylesheet" href="//cdn.plyr.io/1.1.7/docs.css"> <link rel="stylesheet" href="//cdn.plyr.io/1.1.10/docs.css">
</head> </head>
<body> <body>
<main> <main>

View File

@ -8,10 +8,10 @@
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Styles --> <!-- Styles -->
<link rel="stylesheet" href="https://cdn.plyr.io/1.1.7/plyr.css"> <link rel="stylesheet" href="https://cdn.plyr.io/1.1.10/plyr.css">
<!-- Docs styles --> <!-- Docs styles -->
<link rel="stylesheet" href="https://cdn.plyr.io/1.1.7/docs.css"> <link rel="stylesheet" href="https://cdn.plyr.io/1.1.10/docs.css">
</head> </head>
<body> <body>
<header> <header>
@ -79,13 +79,13 @@
b.insertBefore(c, b.childNodes[0]); b.insertBefore(c, b.childNodes[0]);
} }
} }
})(document, "https://cdn.plyr.io/1.1.7/sprite.svg"); })(document, "https://cdn.plyr.io/1.1.10/sprite.svg");
</script> </script>
<!-- Plyr core script --> <!-- Plyr core script -->
<script src="https://cdn.plyr.io/1.1.7/plyr.js"></script> <script src="https://cdn.plyr.io/1.1.10/plyr.js"></script>
<!-- Docs script --> <!-- Docs script -->
<script src="https://cdn.plyr.io/1.1.7/docs.js"></script> <script src="https://cdn.plyr.io/1.1.10/docs.js"></script>
</body> </body>
</html> </html>

View File

@ -7,6 +7,7 @@
// Setup the player // Setup the player
plyr.setup({ plyr.setup({
debug: true, debug: true,
volume: 9,
title: "Video demo", title: "Video demo",
html: templates.controls.render({}), html: templates.controls.render({}),
captions: { captions: {

View File

@ -1,6 +1,6 @@
{ {
"name": "plyr", "name": "plyr",
"version": "1.1.7", "version": "1.1.10",
"description": "A simple HTML5 media player using custom controls", "description": "A simple HTML5 media player using custom controls",
"homepage": "http://plyr.io", "homepage": "http://plyr.io",
"main": "gulpfile.js", "main": "gulpfile.js",

View File

@ -37,7 +37,7 @@ If you have any cool ideas or features, please let me know by [creating an issue
Check `docs/index.html` and `docs/dist/docs.js` for an example setup. 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.1.7/plyr.js` to `https://cdn.plyr.io/1.1.7/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.1.10/plyr.js` to `https://cdn.plyr.io/1.1.10/plyr.js`
### Bower ### Bower
If bower is your thang, you can grab Plyr using: If bower is your thang, you can grab Plyr using:
@ -57,11 +57,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: If you want to use our CDN, you can use the following:
```html ```html
<link rel="stylesheet" href="https://cdn.plyr.io/1.1.7/plyr.css"> <link rel="stylesheet" href="https://cdn.plyr.io/1.1.10/plyr.css">
<script src="https://cdn.plyr.io/1.1.7/plyr.js"></script> <script src="https://cdn.plyr.io/1.1.10/plyr.js"></script>
``` ```
You can also access the `sprite.svg` file at `https://cdn.plyr.io/1.1.7/sprite.svg`. You can also access the `sprite.svg` file at `https://cdn.plyr.io/1.1.10/sprite.svg`.
### CSS ### CSS
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.sass` file included in `/src` in your build to save a request. 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.sass` file included in `/src` in your build to save a request.

View File

@ -1,6 +1,6 @@
// ========================================================================== // ==========================================================================
// Plyr // Plyr
// plyr.js v1.1.7 // plyr.js v1.1.10
// https://github.com/selz/plyr // https://github.com/selz/plyr
// License: The MIT License (MIT) // License: The MIT License (MIT)
// ========================================================================== // ==========================================================================
@ -1146,40 +1146,34 @@
// Set volume // Set volume
function _setVolume(volume) { function _setVolume(volume) {
// Bail if there's no volume element // Use default if no value specified
if(!player.volume) {
return;
}
// Use default if needed
if(typeof volume === "undefined") { if(typeof volume === "undefined") {
if(config.storage.enabled && _storage().supported) { if(config.storage.enabled && _storage().supported) {
volume = window.localStorage[config.storage.key] || config.volume; volume = window.localStorage[config.storage.key] || config.volume;
} }
else { else {
volume = config.volume; volume = config.volume;
} }
} }
_log(volume);
// Maximum is 10 // Maximum is 10
if(volume > 10) { if(volume > 10) {
volume = 10; volume = 10;
} }
// Minimum is 0
// If the controls are there if(volume < 0) {
if(player.supported.full) { volume = 0;
player.volume.value = volume;
} }
// Set the player volume // Set the player volume
player.media.volume = parseFloat(volume / 10); player.media.volume = parseFloat(volume / 10);
// Update the UI // Toggle muted state
_checkMute(); if(player.media.muted && volume > 0) {
_toggleMute();
// Store the volume in storage }
if(config.storage.enabled && _storage().supported) {
window.localStorage.setItem(config.storage.key, volume);
}
} }
// Mute // Mute
@ -1189,16 +1183,32 @@
muted = !player.media.muted; muted = !player.media.muted;
} }
// If the controls are there
if(player.supported.full) {
player.buttons.mute.checked = muted;
}
// Set mute on the player // Set mute on the player
player.media.muted = muted; player.media.muted = muted;
}
// Update UI // Update volume UI and storage
_checkMute(); function _updateVolume() {
// Get the current volume
var volume = player.media.muted ? 0 : (player.media.volume * 10);
// Update the <input type="range"> if present
if(player.supported.full && player.volume) {
player.volume.value = volume;
}
// Store the volume in storage
if(config.storage.enabled && _storage().supported) {
window.localStorage.setItem(config.storage.key, volume);
}
// Toggle class if muted
_toggleClass(player.container, config.classes.muted, (volume === 0));
// Update checkbox for mute state
if(player.supported.full && player.buttons.mute) {
player.buttons.mute.checked = (volume === 0);
}
} }
// Toggle captions // Toggle captions
@ -1217,11 +1227,6 @@
_toggleClass(player.container, config.classes.captions.active, show); _toggleClass(player.container, config.classes.captions.active, show);
} }
// Check mute state
function _checkMute() {
_toggleClass(player.container, config.classes.muted, (player.media.volume === 0 || player.media.muted));
}
// Check if media is loading // Check if media is loading
function _checkLoading(event) { function _checkLoading(event) {
var loading = (event.type === "waiting"); var loading = (event.type === "waiting");
@ -1493,7 +1498,7 @@
_on(player.media, "playing", _updateProgress); _on(player.media, "playing", _updateProgress);
// Handle native mute // Handle native mute
_on(player.media, "volumechange", _checkMute); _on(player.media, "volumechange", _updateVolume);
// Handle native play/pause // Handle native play/pause
_on(player.media, "play pause", _checkPlaying); _on(player.media, "play pause", _checkPlaying);
@ -1621,6 +1626,7 @@
// Set volume // Set volume
_setVolume(); _setVolume();
_updateVolume();
// Setup fullscreen // Setup fullscreen
_setupFullscreen(); _setupFullscreen();