New
authorPhilippe Le Hégaret <plh@w3.org>
Fri, 12 Dec 2008 22:48:04 +0000
changeset 59 168ae6c0a3fc
parent 58 210901bb3dab
child 60 6267ec802828
New
testsuite/web-framework/DFXP_HTML.js
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testsuite/web-framework/DFXP_HTML.js	Fri Dec 12 22:48:04 2008 +0000
@@ -0,0 +1,62 @@
+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("src", "dfxp_movie.ogv");
+	obj.setAttribute("controls", "true");
+	if (autostart) {
+	    obj.setAttribute("autoplay", "true");
+	}
+	
+	// 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());
+