Skip to content

Commit

Permalink
If a video file is not MP4, look for a MP4 version and use that.
Browse files Browse the repository at this point in the history
  • Loading branch information
will committed May 15, 2014
1 parent 396d9c7 commit b0171df
Showing 1 changed file with 23 additions and 26 deletions.
Expand Up @@ -96,36 +96,33 @@
}
}
});
}


var checkFileType = function() {
// if video is flv look for alternative mp4 file to use as this can play in flash player or video tag
};


var fileExists = function(url, resultCallback) {
$.ajax({
url: eval(fileInfo[0] + ".mp4'"),
type: "HEAD",
url: url,
type: 'HEAD',
success: function() {
// mp4 version exists - use this instead
resultCallback(true);
}, error: function() {
resultCallback(false);
}
});
};


if (fileInfo['1'] !== 'mp4') {
var url = eval(fileInfo[0] + ".mp4'");

fileExists(url, function(exists) {
if (exists) {
opts.source = fileInfo[0] + ".mp4'";
fileInfo.splice(1, 1, "mp4");
if (thisMedia.data("src") != undefined) { // save this new src so it doesn't have to check again if page returned to
thisMedia.data("src", opts.source);
}
setUpMedia();
},
error: function() {
// no mp4 version to use - continue with flv
setUpMedia();
}

setUpMedia();
});
}


if (opts.type == "video" && fileInfo[1] == "flv") {
checkFileType();
} else {
setUpMedia();
}

}

};
})(jQuery);

0 comments on commit b0171df

Please sign in to comment.