Fixed merge
This commit is contained in:
parent
e11a58a841
commit
44bb6c077c
4
dist/plyr.js
vendored
4
dist/plyr.js
vendored
File diff suppressed because one or more lines are too long
@ -42,6 +42,7 @@
|
|||||||
iconUrl: '',
|
iconUrl: '',
|
||||||
clickToPlay: true,
|
clickToPlay: true,
|
||||||
hideControls: true,
|
hideControls: true,
|
||||||
|
showPosterOnEnd: false,
|
||||||
tooltips: {
|
tooltips: {
|
||||||
controls: false,
|
controls: false,
|
||||||
seek: true
|
seek: true
|
||||||
@ -1827,9 +1828,9 @@
|
|||||||
// Seek to time
|
// Seek to time
|
||||||
// The input parameter can be an event or a number
|
// The input parameter can be an event or a number
|
||||||
function _seek(input) {
|
function _seek(input) {
|
||||||
var targetTime = 0,
|
var targetTime = 0,
|
||||||
paused = plyr.media.paused,
|
paused = plyr.media.paused,
|
||||||
duration = _getDuration();
|
duration = _getDuration();
|
||||||
|
|
||||||
// Explicit position
|
// Explicit position
|
||||||
if (typeof input === 'number') {
|
if (typeof input === 'number') {
|
||||||
@ -1850,10 +1851,8 @@
|
|||||||
targetTime = duration;
|
targetTime = duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update progress
|
// Update seek range and progress
|
||||||
if (plyr.progress && plyr.progress.played) {
|
_updateSeekDisplay(targetTime);
|
||||||
plyr.progress.played.value = ((100 / duration) * targetTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the current time
|
// Set the current time
|
||||||
// Try/catch incase the media isn't set and we're calling seek() from source() and IE moans
|
// Try/catch incase the media isn't set and we're calling seek() from source() and IE moans
|
||||||
@ -1901,10 +1900,18 @@
|
|||||||
// Get the duration (or custom if set)
|
// Get the duration (or custom if set)
|
||||||
function _getDuration() {
|
function _getDuration() {
|
||||||
// It should be a number, but parse it just incase
|
// It should be a number, but parse it just incase
|
||||||
var duration = parseInt(config.duration);
|
var duration = parseInt(config.duration),
|
||||||
|
|
||||||
|
// True duration
|
||||||
|
mediaDuration = 0;
|
||||||
|
|
||||||
|
// Only if duration available
|
||||||
|
if(plyr.media.duration !== null && !isNaN(plyr.media.duration)) {
|
||||||
|
mediaDuration = plyr.media.duration;
|
||||||
|
}
|
||||||
|
|
||||||
// If custom duration is funky, use regular duration
|
// If custom duration is funky, use regular duration
|
||||||
return (isNaN(duration) ? plyr.media.duration : duration);
|
return (isNaN(duration) ? mediaDuration : duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check playing state
|
// Check playing state
|
||||||
@ -2156,7 +2163,6 @@
|
|||||||
// Update <progress> elements
|
// Update <progress> elements
|
||||||
function _updateProgress(event) {
|
function _updateProgress(event) {
|
||||||
var progress = plyr.progress.played,
|
var progress = plyr.progress.played,
|
||||||
text = false,
|
|
||||||
value = 0,
|
value = 0,
|
||||||
duration = _getDuration();
|
duration = _getDuration();
|
||||||
|
|
||||||
@ -2177,8 +2183,7 @@
|
|||||||
// Check buffer status
|
// Check buffer status
|
||||||
case 'playing':
|
case 'playing':
|
||||||
case 'progress':
|
case 'progress':
|
||||||
progress = plyr.progress.buffer.bar;
|
progress = plyr.progress.buffer;
|
||||||
text = plyr.progress.buffer.text;
|
|
||||||
value = (function() {
|
value = (function() {
|
||||||
var buffered = plyr.media.buffered;
|
var buffered = plyr.media.buffered;
|
||||||
|
|
||||||
@ -2199,11 +2204,27 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set values
|
// Set values
|
||||||
if (progress) {
|
_setProgress(progress, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set <progress> value
|
||||||
|
function _setProgress(progress, value) {
|
||||||
|
if (typeof value === 'undefined') {
|
||||||
|
value = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// One progress element passed
|
||||||
|
if (progress instanceof HTMLElement) {
|
||||||
progress.value = value;
|
progress.value = value;
|
||||||
}
|
}
|
||||||
if (text) {
|
// Object of progress + text element
|
||||||
text.innerHTML = value;
|
else {
|
||||||
|
if (progress.bar) {
|
||||||
|
progress.bar.value = value;
|
||||||
|
}
|
||||||
|
if (progress.text) {
|
||||||
|
progress.text.innerHTML = value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2271,10 +2292,33 @@
|
|||||||
_updateProgress(event);
|
_updateProgress(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update seek range and progress
|
||||||
|
function _updateSeekDisplay(time) {
|
||||||
|
// Default to 0
|
||||||
|
if (typeof time !== 'number') {
|
||||||
|
time = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
var duration = _getDuration(),
|
||||||
|
value = _getPercentage(time, duration);
|
||||||
|
|
||||||
|
// Update progress
|
||||||
|
if (plyr.progress && plyr.progress.played) {
|
||||||
|
plyr.progress.played.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update seek range input
|
||||||
|
if (plyr.buttons && plyr.buttons.seek) {
|
||||||
|
plyr.buttons.seek.value = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Update hover tooltip for seeking
|
// Update hover tooltip for seeking
|
||||||
function _updateSeekTooltip(event) {
|
function _updateSeekTooltip(event) {
|
||||||
|
var duration = _getDuration();
|
||||||
|
|
||||||
// Bail if setting not true
|
// Bail if setting not true
|
||||||
if (!config.tooltips.seek || plyr.browser.touch || !plyr.progress.container) {
|
if (!config.tooltips.seek || !plyr.progress.container || duration === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2305,7 +2349,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Display the time a click would seek to
|
// Display the time a click would seek to
|
||||||
_updateTimeDisplay(((_getDuration() / 100) * percent), plyr.progress.tooltip);
|
_updateTimeDisplay(((duration / 100) * percent), plyr.progress.tooltip);
|
||||||
|
|
||||||
// Set position
|
// Set position
|
||||||
plyr.progress.tooltip.style.left = percent + "%";
|
plyr.progress.tooltip.style.left = percent + "%";
|
||||||
@ -2423,13 +2467,11 @@
|
|||||||
// Pause playback
|
// Pause playback
|
||||||
_pause();
|
_pause();
|
||||||
|
|
||||||
// Set seek input to 0
|
// Update seek range and progress
|
||||||
if (plyr.buttons && plyr.buttons.seek) {
|
_updateSeekDisplay();
|
||||||
plyr.buttons.seek.value = 0;
|
|
||||||
}
|
// Reset buffer progress
|
||||||
if (plyr.progress && plyr.progress.played) {
|
_setProgress(plyr.progress.buffer);
|
||||||
plyr.progress.played.value = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Cancel current network requests
|
// Cancel current network requests
|
||||||
_cancelRequests();
|
_cancelRequests();
|
||||||
@ -2722,6 +2764,15 @@
|
|||||||
|
|
||||||
// Reset UI
|
// Reset UI
|
||||||
_checkPlaying();
|
_checkPlaying();
|
||||||
|
|
||||||
|
// Show poster on end
|
||||||
|
if(config.showPosterOnEnd) {
|
||||||
|
// Seek to 0
|
||||||
|
_seek(0);
|
||||||
|
|
||||||
|
// Re-load media
|
||||||
|
plyr.media.load();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Check for buffer progress
|
// Check for buffer progress
|
||||||
|
Loading…
x
Reference in New Issue
Block a user