fix seek for items

This commit is contained in:
j 2025-01-30 08:53:25 +05:30
commit 5591739531
4 changed files with 24 additions and 13 deletions

View file

@ -8,6 +8,7 @@ VideoElement <f> VideoElement Object
loop <b|false> loop playback
playbackRate <n|1> playback rate
position <n|0> start position
in <n|0> start offset
self <o> Shared private variable
([options[, self]]) -> <o:Element> VideoElement Object
loadedmetadata <!> loadedmetadata
@ -38,6 +39,7 @@ window.VideoElement = function(options) {
muted: false,
playbackRate: 1,
position: 0,
"in": 0,
volume: 1
}
Object.assign(self.options, options);
@ -166,9 +168,10 @@ window.VideoElement = function(options) {
function getCurrentTime() {
var item = self.items[self.currentItem];
return self.seeking || self.loading
var currentTime = self.seeking || self.loading
? self.currentTime
: item ? item.position + self.video.currentTime - item['in'] : 0;
: item ? item.position + self.video.currentTime - item['in'] - self.options["in"] : 0;
return currentTime
}
function getset(key, value) {
@ -508,6 +511,7 @@ window.VideoElement = function(options) {
}
function setCurrentItemTime(currentTime) {
currentTime += self.options["in"]
debug('Video', 'sCIT', currentTime, self.video.currentTime,
'delta', currentTime - self.video.currentTime);
isReady(self.video, function(video) {