fix bugs in video preview
This commit is contained in:
parent
4e615e722d
commit
70376be049
1 changed files with 3 additions and 4 deletions
|
@ -47,11 +47,9 @@ Ox.VideoPreview = function(options, self) {
|
|||
// e.offsetX does not work in Firefox
|
||||
var position = getPosition(event.clientX - that.offset().left);
|
||||
self.$frame.attr({src: getClosestFrame(position)});
|
||||
Ox.print('closest frame:', self.$frame.attr('src'));
|
||||
self.timeout && clearTimeout(self.timeout);
|
||||
self.timeout = setTimeout(function() {
|
||||
self.$frame.attr({src: self.options.getFrame(position)});
|
||||
Ox.print('exact frame:', self.$frame.attr('src'));
|
||||
}, 250);
|
||||
return Ox.formatDuration(position, 2);
|
||||
}
|
||||
|
@ -61,8 +59,8 @@ Ox.VideoPreview = function(options, self) {
|
|||
click: click,
|
||||
mouseenter: startLoading,
|
||||
mouseleave: function() {
|
||||
self.$frame.attr({src: self.options.getFrame(self.options.position)});
|
||||
stopLoading();
|
||||
self.$frame.attr({src: self.options.getFrame(self.options.position)});
|
||||
}
|
||||
})
|
||||
.appendTo(that.$element);
|
||||
|
@ -143,6 +141,7 @@ Ox.VideoPreview = function(options, self) {
|
|||
|
||||
function stopLoading() {
|
||||
self.queue = [];
|
||||
self.timeout && clearTimeout(self.timeout);
|
||||
}
|
||||
|
||||
self.setOption = function(key, value) {
|
||||
|
@ -153,10 +152,10 @@ Ox.VideoPreview = function(options, self) {
|
|||
self.$frame.attr({src: self.options.getFrame(value)});
|
||||
} else if (key == 'width') {
|
||||
that.css({width: value + 'px'});
|
||||
stopLoading();
|
||||
self.$frame.attr({src: self.options.getFrame()})
|
||||
.css(getFrameCSS());
|
||||
self.$timeline.css({width: value + 'px'});
|
||||
stopLoading();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue