function DFXPHTML() {
}

// The name of your player.

DFXPHTML.prototype.name = function () {
  return "HTML5 DFXP Player prototype";
}

DFXPHTML.prototype.startPlayer = function() {
    //    if (-1 == navigator.userAgent.indexOf("Firefox/3.1") &&
    //        -1 == navigator.userAgent.indexOf("Shiretoko/3.1")) {
    //	alert("This player only works in Firefox 3.1.");
    //    }
}

var DFXPHTML_video = null;

DFXPHTML.prototype.startTest = function(test_number, filename, autostart, div) {

	div.innerHTML = '';
	// Create the object
	var obj = document.createElement("video");
	obj.setAttribute("width", "320px");
	obj.setAttribute("controls", "true");
	if (autostart) {
	    obj.setAttribute("autoplay", "true");
	}

	var source = document.createElement("source");
	source.setAttribute("src", "dfxp_movie.ogv");
	source.setAttribute("type", 'video/ogg; codecs="theora, vorbis"');
	obj.appendChild(source);
	source = document.createElement("source");
	source.setAttribute("src", "dfxp_movie.mp4");
	source.setAttribute("type", 'video/mp4; codecs="avc1.42E01E, mp4a.40.2"');
	obj.appendChild(source);

	var fallback = document.createElement("p");
	fallback.appendChild(document.createTextNode("Your browser doesn't support HTML 5 video."));

	obj.appendChild(fallback);

	// append the object
	div.appendChild(obj);

	var xhr = new XMLHttpRequest();

	xhr.onreadystatechange = function () {
	    if (this.readyState == 4
		&& this.status == 200) {
		
		if (this.responseXML != null) {
		    HTML5Caption_playDFXP(this.video, this.responseXML);
		} else {
		    throw new Error("Can't read DFXP resource");
		}
	    }
	};
	xhr.video = obj;

	xhr.open("GET", filename, true);
	xhr.send("");
}

DFXPHTML.prototype.stopTest = function(test_number)
{
}

DFXPHTML.prototype.stopPlayer = function()
{
}
    
addPlayer(new DFXPHTML());

