make sure position is always between 0% and 100%
This commit is contained in:
parent
bee3a142c3
commit
9c544ca46a
1 changed files with 6 additions and 3 deletions
|
|
@ -364,8 +364,9 @@ window.VideoPlayer = function(options) {
|
||||||
that.querySelector('.controls .position input').addEventListener('input', event => {
|
that.querySelector('.controls .position input').addEventListener('input', event => {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
event.stopPropagation()
|
event.stopPropagation()
|
||||||
setProgressPosition(event.target.value)
|
const value = Math.min(100, Math.max(0, parseFloat(event.target.value))
|
||||||
var position = event.target.value/100 * self.options.duration
|
setProgressPosition(value)
|
||||||
|
var position = value/100 * self.options.duration
|
||||||
displayTime(position)
|
displayTime(position)
|
||||||
that.currentTime(position)
|
that.currentTime(position)
|
||||||
hideControlsLater()
|
hideControlsLater()
|
||||||
|
|
@ -386,7 +387,9 @@ window.VideoPlayer = function(options) {
|
||||||
if (self.options.position) {
|
if (self.options.position) {
|
||||||
currentTime -= self.options.position
|
currentTime -= self.options.position
|
||||||
}
|
}
|
||||||
setProgressPosition(100 * currentTime / duration)
|
let position = 100 * currentTime / duration
|
||||||
|
position = Math.min(100, Math.max(0, position))
|
||||||
|
setProgressPosition(position)
|
||||||
displayTime(currentTime)
|
displayTime(currentTime)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue