// Setup an API for the HTML5 playback technology
VideoJS.tech.html5 = {
supported: function(){
return !!document.createElement("video").canPlayType;
},
canPlaySource: function(srcObj){
return this.tag.canPlayType(srcObj.type); // Switch to global check
// Check Type
// If no Type, check ext
// Check Media Type
},
init: function(sourceObj){
var tag = this.tag, // Reuse original tag for HTML5 playback technology element
html5 = _V_.tech.html5,
options = this.options;
// Check if this browser supports moving the element into the box.
// On the iPhone video will break if you move the element,
// So we have to create a brand new element.
if (html5.supports.movingElementInDOM === false) {
var newTag = _V_.createElement("video", {
id: tag.id,
className: tag.className
});
this.box.removeChild(this.tag);
tag = this.tag = newTag;
this.box.appendChild(tag);
}
// Store reference to playback element
this.tels.html5 = tag;
// Update tag settings, in case they were overridden
_V_.each(["autoplay","preload","loop","muted","poster"], function(attr){
tag[attr] = options[attr];
}, this);
if (tag.currentSrc != sourceObj.src) {
tag.src = sourceObj.src;
} else {
this.triggerEvent("loadstart");
}
// Moving video inside box breaks autoplay on Safari. This forces it to play.
// Currently triggering play in other browsers as well.
this.addEvent("techready", function(){
if (this.options.autoplay && this.paused()) {
this.play();
}
this.removeEvent("techready", arguments.callee);
});
this.triggerEvent("techready");
},
supports: {
/* Will hold support info as it's discovered */
},
api: {
setupTriggers: function(){
// Make video events trigger player events
// May seem verbose here, but makes other APIs possible.
// ["play", "playing", "pause", "ended", "volumechange", "error", "progress", "seeking", "timeupdate"]
var types = _V_.html5Events,
i;
for (i = 0;i