[xiph-commits] r2897 - liboggplay/trunk/plugin/test

shans at svn.annodex.net shans at svn.annodex.net
Tue Jun 12 21:52:45 PDT 2007


Author: shans
Date: 2007-06-12 21:52:43 -0700 (Tue, 12 Jun 2007)
New Revision: 2897

Modified:
   liboggplay/trunk/plugin/test/test.html
Log:
Code to update a div tag with current CMML clip information



Modified: liboggplay/trunk/plugin/test/test.html
===================================================================
--- liboggplay/trunk/plugin/test/test.html	2007-06-13 04:52:23 UTC (rev 2896)
+++ liboggplay/trunk/plugin/test/test.html	2007-06-13 04:52:43 UTC (rev 2897)
@@ -28,6 +28,8 @@
 
 <embed type="application/liboggplay" src="http://media.annodex.net/cmmlwiki/CCFilm.axv" width=640 height=480>
 
+<div id="cmml"></div>
+
 <!--
 "http://media.annodex.net/cmmlwiki/SFD2005-Trailer.axv" width=240 height=160
 <param name="movie" value="FUBAR"/>
@@ -56,16 +58,39 @@
 
 function ChangeMovie(url) {
     embed.setCurrentMovie(url);
-    alert("Changing movie to " + url);
 }
 
 function showCMML(data) {
-    alert(data);
+    /* clear the old CMML clip */
+    element = document.getElementById("cmml");
+    while (element.firstChild != null) {
+      element.removeChild(element.firstChild);
+    }
+
+    /* parse the data as XML */
+    document.implementation.createDocument("", "clip", null);
+    xmlDoc = (new DOMParser()).parseFromString(data, "application/xml");
+
+    /* extract the link tag and convert it to an HTML href */
+    links = xmlDoc.getElementsByTagName("a");
+    if (links.length > 0)
+    {
+      link = links.item(0);
+      link.normalize();
+      newlink = document.createElement("a");
+      newlink.setAttribute("href", link.getAttribute("href"));
+      newlink.appendChild(link.firstChild.cloneNode(true));
+      element.appendChild(newlink);
+    }
     return true;
 }
 
 function setCMMLCallback() {
-    embed.registerCMMLCallback("showCMML");
+    embed.registerCallbackObject(
+                    {
+                      cmmlCallback : function(s) {showCMML(s);}
+                    } 
+                  );
     return true;
 }
 



More information about the commits mailing list