fix changing resolution for multi part videos, fixes #1491

This commit is contained in:
j 2013-05-01 12:34:07 +00:00
parent 47aa05b9bc
commit 11b9301337

View file

@ -253,7 +253,9 @@ Ox.VideoElement = function(options, self) {
if (self.video) {
self.$video.hide();
self.video.pause();
self.video.currentTime = 0;
if(self.video.readyState >= self.video.HAVE_METADATA) {
self.video.currentTime = 0;
}
volume = self.video.volume;
muted = self.video.muted;
}
@ -429,14 +431,22 @@ Ox.VideoElement = function(options, self) {
src <f> get/set source
@*/
that.src = function() {
var ret;
var ret, src;
if (arguments.length == 0) {
ret = self.video.src;
} else {
self.options.src = Ox.isArray(arguments[0]) ? arguments[0] : [arguments[0]];
if (self.loadedMetadata) {
self.$video[self.currentPart].src = self.options.src[self.currentPart];
self.$video.each(function(i, video) {
console.log(self.currentPart, self.$video[self.currentPart], self.$video);
//fixme: get rid of this to make use of browser caching
// but in all browsers except firefox,
// loadedmetadata fires only once per src
src = self.options.src[self.currentPart];
if (src.length > 0 && Ox.startsWith(Ox.parseURL(src).protocol, 'http')) {
src += '?' + Ox.uid();
}
self.$video[0].src = src;
self.items[0].$videos.forEach(function($video, i) {
if (i != self.currentPart) {
var src = self.options.src[i];
//fixme: get rid of this to make use of browser caching
@ -445,7 +455,7 @@ Ox.VideoElement = function(options, self) {
if (src.length > 0 && Ox.startsWith(Ox.parseURL(src).protocol, 'http')) {
src += '?' + Ox.uid();
}
video.src = src;
$video[0].src = src;
}
});
} else {