fix updating items

This commit is contained in:
j 2013-07-13 23:06:07 +00:00
parent 8383643549
commit 2403cd269d

View file

@ -31,8 +31,7 @@ Ox.VideoElement = function(options, self) {
self.loadedMetadata = false;
loadItems(function() {
var update = true;
self.numberOfItems = self.items.lenth;
if (self.currentItem > self.numberOfItems) {
if (self.currentItem >= self.numberOfItems) {
self.currentItem = 0;
}
if (self.currentItemId != self.items[self.currentItem].id) {
@ -51,7 +50,7 @@ Ox.VideoElement = function(options, self) {
setCurrentVideo();
}
}
that.triggerEvent('durationchanged');
that.triggerEvent('durationchange');
});
}
})
@ -149,7 +148,6 @@ Ox.VideoElement = function(options, self) {
items = self.options.items.map(function(item) {
return Ox.isObject(item) ? Ox.clone(item, true) : {src: item};
});
next();
function getId(item) {
@ -169,7 +167,6 @@ Ox.VideoElement = function(options, self) {
if(!item.out) {
item.out = item.duration - item['in'];
}
console.log('add item', item);
currentTime += item.duration;
item.id = getId(item);
i++;
@ -205,7 +202,6 @@ Ox.VideoElement = function(options, self) {
next = self.items[nextItem],
$nextVideo = self.$videos[Ox.mod(self.currentVideo + 1, self.$videos.length)],
nextVideo = $nextVideo[0];
nextVideo.src = next.src;
onLoadedMetadata($nextVideo, function() {
nextVideo.currentTime = next['in'] || 0;