new dir added, trial-site, which contains an interface for NextSharePC VLC plugin
authorP2P-Next User <p2p@p2p-next-03.grid.pub.ro>
Tue, 8 Mar 2011 15:27:21 +0000 (17:27 +0200)
committerP2P-Next User <p2p@p2p-next-03.grid.pub.ro>
Tue, 8 Mar 2011 15:27:21 +0000 (17:27 +0200)
trial-site/NextSharePC-interface.css [new file with mode: 0644]
trial-site/NextSharePC-interface.js [new file with mode: 0644]
trial-site/cataloger-old-item-table-based.html [new file with mode: 0644]
trial-site/test.html [new file with mode: 0644]

diff --git a/trial-site/NextSharePC-interface.css b/trial-site/NextSharePC-interface.css
new file mode 100644 (file)
index 0000000..160aeb8
--- /dev/null
@@ -0,0 +1,23 @@
+#nsTable {\r
+       width: 800;\r
+}\r
+\r
+#nsPlaybackCell {\r
+       width: 22%;\r
+}\r
+\r
+#nsTimeCell {\r
+       width: 55%;\r
+}\r
+\r
+#nsTime {\r
+       padding: 3px; \r
+       border-style:solid; \r
+       border-width: 1px; \r
+       border-color:#AAAAAA\r
+}\r
+\r
+#nsVol {\r
+       height: 5;\r
+}\r
+\r
diff --git a/trial-site/NextSharePC-interface.js b/trial-site/NextSharePC-interface.js
new file mode 100644 (file)
index 0000000..1c395c5
--- /dev/null
@@ -0,0 +1,198 @@
+// NextSharePC plugin controls\r
+// Author: Calin-Andrei Burloiu, calin.burloiu@gmail.com\r
+// 2011\r
+\r
+updateInterval = 500;\r
+\r
+function getPluginWidth()\r
+{\r
+       return 800;\r
+}\r
+\r
+function getPluginHeight()\r
+{\r
+       return 600;\r
+}\r
+\r
+function getSliderWidth()\r
+{\r
+       return $("#nsSlider").width();\r
+}\r
+\r
+function updateTime(afterSlider)\r
+{\r
+       var len = document.vlc.input.length;\r
+       var pos;\r
+       if(afterSlider)\r
+       {\r
+               var val = 1.0 * $("#nsSlider").slider("option", "value");\r
+               pos = val / (getSliderWidth() - 1);\r
+       }\r
+       else\r
+               pos = document.vlc.input.position;\r
+       var time = Math.round(pos * len);\r
+       var crt_s = Math.floor(time / 1000 % 60);\r
+       var crt_min = Math.floor((time / 1000) / 60);\r
+       var tot_s = Math.floor(len / 1000 % 60);\r
+       var tot_min = Math.floor((len / 1000) / 60);\r
+\r
+       $("#nsTime").html("" + pad(crt_min, 2) + ":" + pad(crt_s, 2)\r
+               + " / " + pad(tot_min, 2) + ":" + pad(tot_s, 2));\r
+}\r
+\r
+function update()\r
+{\r
+       var val = Math.round(document.vlc.input.position * (getSliderWidth() - 1));\r
+\r
+       $("#nsSlider").slider({ value: val });\r
+       \r
+       updateTime(false);\r
+       \r
+       timerHandle = setTimeout("update()", updateInterval);\r
+}\r
+\r
+function displayNextSharePC(torrent)\r
+{\r
+       if (navigator.appName == "Netscape")\r
+       {\r
+               document.write('<embed type="application/x-ns-stream"');\r
+               document.write('name="vlc"');\r
+               document.write('id="vlc"');\r
+               document.write('autoplay="yes" loop="no" width="');\r
+               document.write('' + getPluginWidth());\r
+               document.write('" height="');\r
+               document.write('' + getPluginHeight());\r
+               document.write('"');\r
+               document.write('target="');\r
+               document.write(torrent);\r
+               document.write('" />');\r
+       }\r
+       else\r
+       {\r
+               document.write('<object classid="clsid:1800B8AF-4E33-43C0-AFC7-894433C13538" ');\r
+               document.write('codebase="http://trial.p2p-next.org/download/SwarmPlugin_IE_1.0.4.cab"');\r
+               document.write('width="');\r
+               document.write(getPluginWidth());\r
+               document.write('" height="');\r
+               document.write(getPluginHeight());\r
+               document.write('" id="vlc" name="vlc" events="True" target="">');\r
+               document.write('<param name="Src" value="');\r
+               document.write(torrent);\r
+               document.write('" />');\r
+               document.write('<param name="ShowDisplay" value="True" />');\r
+               document.write('<param name="Loop" value="False" />');\r
+               document.write('<param name="AutoPlay" value="True" />');\r
+               document.write('<param name="Toolbar" value="True" />');\r
+               document.write('</object>');\r
+       }\r
+       \r
+       document.write('<table id="nsTable"><tr>'\r
+               + '<td id="nsPlaybackCell"><input type=button value="Play" onClick="play();" />'\r
+               + '<input type=button value="Pause" onClick="pause();" />'\r
+               + '<input type=button value="Stop" onclick="stop();" /></td>'\r
+               + '<td id="nsTimeCell"><span id="nsTime">-</span></td>'\r
+               + '<td><div id="nsVol"></div></td>'\r
+               + '<td><input type=button value="Fullscreen" onclick="fullscreen();" /></td></tr>'\r
+               + '<tr><td colspan="4"><div id="nsSlider"></div></td></tr>'\r
+               + '</table>');\r
+               \r
+       $("nsTable").css("width", getPluginWidth());\r
+}\r
+\r
+function onSliderStop(event, ui)\r
+{\r
+       var val = $("#nsSlider").slider("option", "value");\r
+       var s = 1.0 * val / (getSliderWidth() - 1);\r
+       \r
+       //document.vlc.playlist.seek(s, false);\r
+       //document.vlc.video.toggleFullscreen();\r
+       \r
+       try {\r
+               if(s == 0)\r
+                       document.vlc.input.position = 0.0000001;\r
+               else if(s == 1)\r
+                       document.vlc.input.position = 0.9999999;\r
+               else\r
+                       document.vlc.input.position = s;\r
+       }\r
+       catch(err) {\r
+               alert(err.message + ": " + err.description);\r
+       }\r
+       \r
+       timerHandle = setTimeout("update()", updateInterval);\r
+}\r
+\r
+function pad(number, length) \r
+{\r
+       var str = '' + number;\r
+       while (str.length < length) \r
+       {\r
+               str = '0' + str;\r
+       }\r
+\r
+       return str;\r
+}\r
+\r
+function onSliderSlide(event, ui)\r
+{\r
+       updateTime(true);\r
+       \r
+       clearTimeout(timerHandle);\r
+}\r
+\r
+function onVolChange(event, ui)\r
+{\r
+       var val = $("#nsVol").slider("option", "value");\r
+       \r
+       document.vlc.audio.volume = val;\r
+}\r
+\r
+$(document).ready(function() \r
+{\r
+       // Progress Slider\r
+       $("#nsSlider").slider({ animate: true });\r
+       $("#nsSlider").slider({ min: 0 });\r
+       $("#nsSlider").slider({ max: (getPluginWidth() - 1) });\r
+       $("#nsSlider").slider({\r
+               stop: onSliderStop,\r
+               slide: onSliderSlide\r
+       });\r
+       $("#nsSlider").css("width", getPluginWidth());// TODO\r
+       $("#nsSlider").slider();\r
+       \r
+       // Volume Slider\r
+       $("#nsVol").slider({ animate: true });\r
+       $("#nsVol").slider({ min: 0 });\r
+       $("#nsVol").slider({ max: 200 });\r
+       $("#nsVol").slider({ value: document.vlc.audio.volume });\r
+       $("#nsVol").slider({\r
+               change: onVolChange,\r
+       });\r
+       $("#nsVol").css("width", 72);\r
+       $("#nsVol").slider();\r
+       \r
+       timerHandle = setTimeout("update()", updateInterval);\r
+});  \r
+\r
+function play()\r
+{\r
+       document.vlc.playlist.play();\r
+       timerHandle = setTimeout("update()", updateInterval);\r
+}\r
+\r
+function pause()\r
+{\r
+       document.vlc.playlist.togglePause();\r
+       clearTimeout(timerHandle);\r
+}\r
+\r
+function stop()\r
+{\r
+       document.vlc.playlist.stop();\r
+       clearTimeout(timerHandle);\r
+}\r
+\r
+function fullscreen()\r
+{\r
+       document.vlc.video.toggleFullscreen();\r
+}
\ No newline at end of file
diff --git a/trial-site/cataloger-old-item-table-based.html b/trial-site/cataloger-old-item-table-based.html
new file mode 100644 (file)
index 0000000..962e542
--- /dev/null
@@ -0,0 +1,40 @@
+<div class="item">\r
+<table>\r
+ <tr>\r
+  <td>\r
+{literal}\r
+<script type="text/javascript">\r
+if (navigator.appName == "Netscape")\r
+{\r
+document.write('<embed type="application/x-ns-stream"');\r
+document.write('name="vlcName"');\r
+document.write('id="vlc"');\r
+document.write('autoplay="yes" loop="no" width="720" height="567"');\r
+document.write('target="{/literal}{$torrent}{literal}" />');\r
+}\r
+else\r
+{\r
+document.write('<object classid="clsid:1800B8AF-4E33-43C0-AFC7-894433C13538" ');\r
+document.write('codebase="http://trial.p2p-next.org/download/SwarmPlugin_IE_1.0.4.cab"');\r
+document.write('width="720" height="567" id="vlc" name="vlc" events="True" target="">');\r
+document.write('<param name="Src" value="{/literal}{$torrent}{literal}" />');\r
+document.write('<param name="ShowDisplay" value="True" />');\r
+document.write('<param name="Loop" value="False" />');\r
+document.write('<param name="AutoPlay" value="True" />');\r
+document.write('<param name="Toolbar" value="True" />');\r
+document.write('</object>');\r
+}\r
+</script>\r
+{/literal}\r
+\r
+<p class="center">\r
+<input type=button value="Play" onClick='document.vlc.playlist.play();'>\r
+<input type=button value="Pause" onClick='document.vlc.playlist.togglePause();'>\r
+<input type=button value="Stop" onclick='document.vlc.playlist.stop();'>\r
+<br/>\r
+</p>\r
+  </td>\r
+ </tr></table>\r
+\r
+</div>\r
+\r
diff --git a/trial-site/test.html b/trial-site/test.html
new file mode 100644 (file)
index 0000000..4f7bdd5
--- /dev/null
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" \r
+        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r
+<html xmlns="http://www.w3.org/1999/xhtml">\r
+<head>\r
+<!--<link rel="stylesheet" type="text/css" href="http://p2p-next.cs.pub.ro/stylesheet.php?cssid=50" />-->\r
+<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>\r
+<link href="NextSharePC-interface.css" rel="stylesheet" type="text/css"/>\r
+  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>\r
+  <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>\r
+  <script type="text/javascript" src="NextSharePC-interface.js"></script>\r
+    <!--<style type="text/css">\r
+    #slider { margin: 10px; }\r
+  </style>-->\r
+</head>\r
+\r
+<body>\r
+\r
+<div class="item">\r
+<script type="text/javascript">\r
+       displayNextSharePC("http://p2p-next.cs.pub.ro/uploads/torrents/tech-talks/rtt01a_HD.mp4.tstream");\r
+</script>\r
+</div>\r
+</body>\r
+</html>
\ No newline at end of file