preview new timecode
This commit is contained in:
parent
85eba0bf09
commit
dd8ea22d45
1 changed files with 14 additions and 11 deletions
|
@ -360,14 +360,24 @@ window.VideoPlayer = function(options) {
|
|||
progressbar.setAttribute('aria-valuenow', value);
|
||||
|
||||
}
|
||||
that.querySelector('.controls .position input').addEventListener('input', function(event){
|
||||
that.querySelector('.controls .position input').addEventListener('input', event => {
|
||||
event.preventDefault()
|
||||
event.stopPropagation()
|
||||
setProgressPosition(this.value)
|
||||
var position = this.value/100 * self.options.duration
|
||||
setProgressPosition(event.target.value)
|
||||
var position = event.target.value/100 * self.options.duration
|
||||
displayTime(position)
|
||||
that.currentTime(position)
|
||||
hideControlsLater()
|
||||
})
|
||||
function displayTime(currentTime) {
|
||||
duration = formatDuration(self.options.duration)
|
||||
currentTime = formatDuration(currentTime)
|
||||
while (duration && duration.startsWith('00:')) {
|
||||
duration = duration.slice(3)
|
||||
}
|
||||
currentTime = currentTime.slice(currentTime.length - duration.length)
|
||||
time.innerText = `${currentTime} / ${duration}`
|
||||
}
|
||||
|
||||
that.addEventListener("timeupdate", event => {
|
||||
var currentTime = that.currentTime(),
|
||||
|
@ -376,14 +386,7 @@ window.VideoPlayer = function(options) {
|
|||
currentTime -= self.options.position
|
||||
}
|
||||
setProgressPosition(100 * currentTime / duration)
|
||||
duration = formatDuration(duration)
|
||||
currentTime = formatDuration(currentTime)
|
||||
while (duration && duration.startsWith('00:')) {
|
||||
duration = duration.slice(3)
|
||||
}
|
||||
currentTime = currentTime.slice(currentTime.length - duration.length)
|
||||
time.innerText = `${currentTime} / ${duration}`
|
||||
|
||||
displayTime(currentTime)
|
||||
})
|
||||
|
||||
that.addEventListener("play", event => {
|
||||
|
|
Loading…
Reference in a new issue