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

tahn at svn.annodex.net tahn at svn.annodex.net
Wed Jun 27 02:32:03 PDT 2007


Author: tahn
Date: 2007-06-27 02:32:03 -0700 (Wed, 27 Jun 2007)
New Revision: 3091

Modified:
   liboggplay/trunk/plugin/test/test.html
Log:
Rearranged the page to make fit more stuff in. Added volume up/down controls.


Modified: liboggplay/trunk/plugin/test/test.html
===================================================================
--- liboggplay/trunk/plugin/test/test.html	2007-06-27 07:54:19 UTC (rev 3090)
+++ liboggplay/trunk/plugin/test/test.html	2007-06-27 09:32:03 UTC (rev 3091)
@@ -8,17 +8,51 @@
 
 <h3>Example Liboggplay Plug-in</h3>
 
-<embed type="application/liboggplay" src="http://media.annodex.net/cmmlwiki/OSSForum-Intro.axv" width=320 height=240>
-<div id="cmml"></div>
-</embed>
+<table>
+<tr>
+<td>
+<p style="margin-bottom:5"><i>Setting movies</i></p>
+<form name="setmovie">
+<label for="r1"><input id="r1" type="radio" name="list" value="OSSForum-Intro" checked/>OSSForum-Intro</label><br>
+<label for="r2"><input id="r2" type="radio" name="list" value="CCFilm"/>CCFilm</label><br>
+<label for="r3"><input id="r3" type="radio" name="list" value="MarcinCanoe"/>MarcinCanoe</label><br>
+<label for="r4"><input id="r4" type="radio" name="list" value="DArt-Silvia_Pfeiffer"/>DArt-Silvia_Pfeiffer</label><br>
+<label for="r5"><input id="r5" type="radio" name="list" value="A_New_Computer"/>A_New_Computer</label><br>
+<label for="r6"><input id="r6" type="radio" name="list"/>Prompt for movie</label><br>
+</form>
+<p style="margin-left:5;margin-top:10;font-size:85%"><i>Use , and . to change</i></p>
+</td>
+<td width="30"></td>
+<td>
+<embed type="application/liboggplay" src="http://media.annodex.net/cmmlwiki/A_New_Computer.axv" width=320 height=240/>
+</td>
+<td width="30"></td>
+<td>
+<p style="margin-bottom:5"><i>Callbacks</i></p>
+<form name="callbacks">
+<input type="button" value="Register:" onclick='RegisterCMMLCallback()'/>
+<label for="c1"><input id="c1" type="checkbox" name="cbCMML" checked/>CMML</label><br>
+<input type="button" value="Register:" onclick='RegisterEndPlayCallback()'/>
+<label for="c2"><input id="c2" type="checkbox" name="cbEndPlay" checked/>EndPlay</label><br>
+<input type="button" value="Register:" onclick='RegisterPlaylistCallback()'/>
+<label for="c3"><input id="c3" type="checkbox" name="cbPlaylist" checked/>Playlist</label><br>
+</form>
+<br><br>
+<input type="button" value="Clear CMML" onclick='clearCMML()'/><br>
+</td>
+</tr>
+</table>
+
+<div id="cmml"><br></div>
 <br>
 
 <form name="api">
+
 <table>
 <tr>
-<td colspan="2">Standard functions<hr></td>
+<td colspan="2"><i>Standard functions</i><hr></td>
 <td width="30"></td>
-<td colspan="2">Playlist functions<hr></td>
+<td colspan="2"><i>Playlist functions</i><hr></td>
 </tr>
 <tr valign="top">
 <td width="180">
@@ -57,55 +91,35 @@
 </td>
 </tr>
 </table>
-<br>
+
 <table>
 <tr>
-<td colspan="2"><i>Setting movies</i></td>
-<td><i>Callbacks</i></td>
-<td><i>Miscellanea</i></td>
+<td></td>
+<td colspan="2"><i>Miscellanea</i></td>
 </tr>
-<tr valign="top"><td>
-<label for="r1"><input id="r1" type="radio" name="movie" value="OSSForum-Intro" checked/>OSSForum-Intro</label><br>
-<label for="r2"><input id="r2" type="radio" name="movie" value="CCFilm"/>CCFilm</label><br>
-<label for="r3"><input id="r3" type="radio" name="movie" value="MarcinCanoe"/>MarcinCanoe</label><br>
-</td><td width="180">
-<label for="r4"><input id="r4" type="radio" name="movie" value="DArt-Silvia_Pfeiffer"/>DArt-Silvia_Pfeiffer</label><br>
-<label for="r5"><input id="r5" type="radio" name="movie" value="A_New_Computer"/>A_New_Computer</label><br>
-<label for="r6"><input id="r6" type="radio" name="movie"/>Prompt for movie</label><br>
-</td><td width="180">
-<input type="button" value="Register:" onclick='RegisterCMMLCallback()'/>
-<label for="c1"><input id="c1" type="checkbox" name="cbCMML" checked/>CMML</label><br>
-<input type="button" value="Register:" onclick='RegisterEndPlayCallback()'/>
-<label for="c2"><input id="c2" type="checkbox" name="cbEndPlay" checked/>EndPlay</label><br>
-<input type="button" value="Register:" onclick='RegisterPlaylistCallback()'/>
-<label for="c3"><input id="c3" type="checkbox" name="cbPlaylist" checked/>Playlist</label><br>
-</td><td>
-<tt>&nbsp; </tt><input type="button" value="Clear CMML" onclick='clearCMML()'/><br>
+<tr><td width="300">
+Input<br>
+<input type="text" name="ifield" size="20"/>
+</td><td width="140">
 <tt>] </tt><input type="button" value="Skip forward" onclick='skip(1)'/><br>
 <tt>[ </tt><input type="button" value="Skip back" onclick='skip(-1)'/><br>
-</td>
-</tr>
-<tr><td colspan="2">
-<p style="margin-left:5;margin-top:-2;font-size:85%"><i>Use , and . to change</i></p>
+</td><td>
+<tt>= </tt><input type="button" value="Volume up" onclick='changeVolume(1)'/><br>
+<tt>- </tt><input type="button" value="Volume down" onclick='changeVolume(-1)'/><br>
 </td></tr>
 </table>
-</form>
 
-<form name="io">
-Input
 <br>
-<input type="text" name="input" size="20"/>
-<br><br>
-Output &nbsp;&nbsp;&nbsp; <input type="button" value="Clear" onclick='setOutput("")'/>
-<br>
-<textarea name="output" cols="80" rows="9"></textarea>
+Output &nbsp;&nbsp;&nbsp; <input type="button" value="Clear" onclick='setOutput("")'/><br>
+<textarea name="ofield" cols="80" rows="9"></textarea>
+
 </form>
 
 <script>
 var plugin = document.embeds[0];
-var api    = document.api;
-var input  = document.io.input;
-var output = document.io.output;
+var input  = document.api.ifield;
+var output = document.api.ofield;
+var movies = document.setmovie.list;
 
 function GetVersionString() {
   addOutput("Version: " + plugin.getVersionString());
@@ -160,7 +174,7 @@
 }
 
 function SetVolume() {
-  var i = getInput() / 100.0;
+  var i = getInput() / 10.0;
   if (i < 0) i = 0;
   if (i > 1) i = 1;
   plugin.setVolume(i);
@@ -248,7 +262,7 @@
 }
 
 function RegisterCMMLCallback() {
-  if (api.cbCMML.checked) {
+  if (document.callbacks.cbCMML.checked) {
     plugin.registerCMMLCallback(
       {
         call : function(s) {showCMML(s);}
@@ -262,7 +276,7 @@
 }
 
 function RegisterEndPlayCallback() {
-  if (api.cbEndPlay.checked) {
+  if (document.callbacks.cbEndPlay.checked) {
     plugin.registerEndPlayCallback(
       {
         call : function() {endPlay();}
@@ -276,7 +290,7 @@
 }
 
 function RegisterPlaylistCallback() {
-  if (api.cbPlaylist.checked) {
+  if (document.callbacks.cbPlaylist.checked) {
     plugin.registerPlaylistCallback(
       {
         call : function() {trackChanged();}
@@ -369,13 +383,27 @@
     case "N": SetPlayPositionWithinMovie();  break;
     case "A": RetrieveAnnotationsAt();  break;
     case "L": GetMovieLengthAt();  break;
+    case ".": changeSelectedMovie(1);  break;
+    case ",": changeSelectedMovie(-1);  break;
     case "]": skip(1);  break;
     case "[": skip(-1);  break;
-    case ".": changeSelectedMovie(1);  break;
-    case ",": changeSelectedMovie(-1);  break;
+    case "=": changeVolume(1);  break;
+    case "-": changeVolume(-1);  break;
   }
 }
 
+function changeSelectedMovie(dir) {
+  for (i = 0; i < movies.length; i++) {
+    if (movies[i].checked) {
+      i = i + dir;
+      if (i < 0) i = 0;
+      if (i > movies.length - 1) i = movies.length - 1;
+      movies[i].checked = true;
+      return;
+    }
+  }
+}
+
 function skip(dir) {
   var i = getInput();
   if (i <= 0) i = 1000;
@@ -384,10 +412,18 @@
             (plugin.setPlayPosition(i) ? "succeeded" : "failed"));
 }
 
+function changeVolume(dir) {
+  var v = plugin.getVolume() + 0.1 * dir;
+  if (v < 0) v = 0;
+  if (v > 1) v = 1;
+  plugin.setVolume(v);
+  addOutput("Volume set to " + v);
+}
+
 function getSelectedMovie() {
-  for (i = 0; i < api.movie.length - 1; i++) {
-    if (api.movie[i].checked) {
-      return "http://media.annodex.net/cmmlwiki/" + api.movie[i].value + ".axv";
+  for (i = 0; i < movies.length - 1; i++) {
+    if (movies[i].checked) {
+      return "http://media.annodex.net/cmmlwiki/" + movies[i].value + ".axv";
     }
   }
   var s = prompt("Enter the movie:", "");
@@ -403,18 +439,6 @@
   return s;
 }
 
-function changeSelectedMovie(dir) {
-  for (i = 0; i < api.movie.length; i++) {
-    if (api.movie[i].checked) {
-      i = i + dir;
-      if (i < 0) i = 0;
-      if (i > api.movie.length - 1) i = api.movie.length - 1;
-      api.movie[i].checked = true;
-      return;
-    }
-  }
-}
-
 function getInput() {
   var i = parseInt(input.value);
   return isNaN(i) ? 0 : i;



More information about the commits mailing list