first bind loadedmetadata, then set src

This commit is contained in:
rlx 2011-08-19 17:10:52 +00:00
parent 6d47477890
commit a9554bf477

View file

@ -26,12 +26,6 @@ Ox.VideoElement = function(options, self) {
self.$videos = self.options.src.map(function(src, i) {
return $('<video>')
.attr(Ox.extend({
preload: 'metadata',
src: src
}, i == 0 && self.options.autoplay ? {
autoplay: 'autoplay'
} : {}))
.css({position: 'absolute'})
.bind({
ended: function() {
@ -66,6 +60,12 @@ Ox.VideoElement = function(options, self) {
}
})
.attr(Ox.extend({
preload: 'metadata',
src: src
}, i == 0 && self.options.autoplay ? {
autoplay: 'autoplay'
} : {}))
.hide()
.appendTo(that.$element);
});