Seeking improvements

This commit is contained in:
Sam Potts 2015-03-05 22:38:25 +11:00
parent 4404e999eb
commit c6e5937deb
3 changed files with 71 additions and 89 deletions

2
dist/plyr.js vendored

File diff suppressed because one or more lines are too long

View File

@ -19,14 +19,18 @@ We wanted a lightweight, accessible and customisable media player that just supp
- **Fullscreen** - supports native fullscreen with fallback to "full window" modes. - **Fullscreen** - supports native fullscreen with fallback to "full window" modes.
- **No dependencies** - written in vanilla JavaScript, no jQuery required. - **No dependencies** - written in vanilla JavaScript, no jQuery required.
Oh and yes, it works with Bootstrap.
## Changelog ## Changelog
Check out [the changelog](changelog.md) Check out [the changelog](changelog.md)
## Planned development ## Planned development
- Accept a string selector, a node, or a nodelist for the `container` property of `selectors`. - Accept a string selector, a node, or a nodelist for the `container` property of `selectors`.
- Accept a selector for the `html` template property.
- Multiple language captions (with selection) - Multiple language captions (with selection)
- Localisation of control labels - Playlists (audio and video)
- Set source by API
- Tooltip option (for seeking and controls)
... and whatever else has been raised in [issues](https://github.com/Selz/plyr/issues)
If you have any cool ideas or features, please let me know by [creating an issue](https://github.com/Selz/plyr/issues/new) or of course, forking and sending a pull request. If you have any cool ideas or features, please let me know by [creating an issue](https://github.com/Selz/plyr/issues/new) or of course, forking and sending a pull request.

View File

@ -70,7 +70,8 @@
enabled: true enabled: true
}, },
html: (function() { html: (function() {
return ["<div class='player-controls'>", return [
"<div class='player-controls'>",
"<div class='player-progress'>", "<div class='player-progress'>",
"<label for='seek{id}' class='sr-only'>Seek</label>", "<label for='seek{id}' class='sr-only'>Seek</label>",
"<input id='seek{id}' class='player-progress-seek' type='range' min='0' max='100' step='0.5' value='0' data-player='seek'>", "<input id='seek{id}' class='player-progress-seek' type='range' min='0' max='100' step='0.5' value='0' data-player='seek'>",
@ -128,7 +129,8 @@
"<span class='sr-only'>Toggle fullscreen</span>", "<span class='sr-only'>Toggle fullscreen</span>",
"</button>", "</button>",
"</span>", "</span>",
"</div>"].join("\n"); "</div>"
].join("\n");
})() })()
}; };
@ -813,16 +815,8 @@
targetTime = ((this.value / this.max) * player.media.duration).toFixed(1); targetTime = ((this.value / this.max) * player.media.duration).toFixed(1);
} }
// Handle min and max values // Set the current time
if (targetTime > player.media.duration) {
player.media.currentTime = player.media.duration;
}
else if (targetTime < 0) {
player.media.currentTime = 0;
}
else {
player.media.currentTime = targetTime; player.media.currentTime = targetTime;
}
// Logging // Logging
_log("Seeking to " + player.media.currentTime + " seconds"); _log("Seeking to " + player.media.currentTime + " seconds");
@ -1079,22 +1073,6 @@
// Time change on media // Time change on media
_on(player.media, "timeupdate seeking", _timeUpdate); _on(player.media, "timeupdate seeking", _timeUpdate);
// Pause and resume while seeking
/*_on(player.media, "seeking", function() {
if(!player.media.paused && !player.seekPaused) {
player.seekPaused = true;
_pause();
}
_log("Seeking")
});
_on(player.media, "seeked", function() {
if(player.seekPaused) {
player.seekPaused = false;
_play();
}
_log("Seeked")
});*/
// Seek // Seek
_on(player.buttons.seek, "change input", _seek); _on(player.buttons.seek, "change input", _seek);