[xiph-commits] r3920 - arkaiv/trunk/arkaiv/templates
dcrowdy at svn.annodex.net
dcrowdy at svn.annodex.net
Sun May 10 18:40:16 PDT 2009
Author: dcrowdy
Date: 2009-05-10 18:40:14 -0700 (Sun, 10 May 2009)
New Revision: 3920
Modified:
arkaiv/trunk/arkaiv/templates/displayitem.mak
arkaiv/trunk/arkaiv/templates/playlistview.mak
Log:
Added ability to seek to a particular point in the media (separate of clips) and cleaned up script in displayitem.mak
Modified: arkaiv/trunk/arkaiv/templates/displayitem.mak
===================================================================
--- arkaiv/trunk/arkaiv/templates/displayitem.mak 2009-05-07 11:10:01 UTC (rev 3919)
+++ arkaiv/trunk/arkaiv/templates/displayitem.mak 2009-05-11 01:40:14 UTC (rev 3920)
@@ -16,21 +16,23 @@
% if c.sourcedict['has_video'] == "Yes":
-<video src='${c.sourcedict['urlpath']}${c.sourcedict['clipdetail']}' controls='controls' ontimeupdate="Vupdatetime()" width=320 height=240></video>
+<video src='${c.sourcedict['urlpath']}${c.sourcedict['clipdetail']}' controls='controls' ontimeupdate="Updatetime()" width=320 height=240></video>
% endif
% if c.sourcedict['has_video'] == "No":
-<audio src='${c.sourcedict['urlpath']}${c.sourcedict['clipdetail']}' controls='controls' ontimeupdate="Aupdatetime()"></audio>
+<audio src='${c.sourcedict['urlpath']}${c.sourcedict['clipdetail']}' controls='controls' ontimeupdate="Updatetime()"></audio>
% endif
-##Output area useful for debugging:
<form name="api">
<table style="font-size:small">
<tr>
<td>Time:</td>
-<td><input name="tfield" cols="10"></textarea></td>
+<td><input name="tfield" cols="8"></textarea></td>
+<td>Go to:</td>
+<td><input name="gfield" cols="6" onchange='Gototime("${c.sourcedict['urlpath']}?t=")'></textarea></td>
</tr>
+##Output area useful for debugging:
##<tr>
##<td>Output:</td>
##<td><textarea name="ofield" cols="40" rows="2"></textarea></td>
@@ -151,14 +153,18 @@
% for clipinfo in c.cliplist:
<tr>
% if c.sourcedict['has_video'] == "Yes":
- <td><a onclick='VideoClipPlay("${c.sourcedict['urlpath']}?t=${clipinfo['id']}")'><img src="${c.sourcedict['clipimageurl']}${clipinfo['img_src']}"></a></td>
+% if clipinfo['end_time'] == 0:
+ <td><a onclick='ClipPlay("${c.sourcedict['urlpath']}?t=${clipinfo['id']}")'><img src="${c.sourcedict['clipimageurl']}${clipinfo['img_src']}"></a></td>
+ % else:
+ <td><a onclick='ClipPlay("${c.sourcedict['urlpath']}?t=${clipinfo['id']}/${clipinfo['end_time']}")'><img src="${c.sourcedict['clipimageurl']}${clipinfo['img_src']}"></a></td>
+ % endif
% endif
% if c.sourcedict['has_video'] == "No":
% if clipinfo['end_time'] == 0:
- <td><a onclick='AudioClipPlay("${c.sourcedict['urlpath']}?t=${clipinfo['id']}")'><img src="/images/blank.png"></a></td>
+ <td><a onclick='ClipPlay("${c.sourcedict['urlpath']}?t=${clipinfo['id']}")'><img src="/images/blank.png"></a></td>
% else:
- <td><a onclick='AudioClipPlay("${c.sourcedict['urlpath']}?t=${clipinfo['id']}/${clipinfo['end_time']}")'><img src="/images/blank.png"></a></td>
+ <td><a onclick='ClipPlay("${c.sourcedict['urlpath']}?t=${clipinfo['id']}/${clipinfo['end_time']}")'><img src="/images/blank.png"></a></td>
% endif
% endif
@@ -214,39 +220,49 @@
var output = document.api.ofield;
var toutput = document.api.tfield;
+var gototime = document.api.gfield;
var myVideo = document.getElementsByTagName('video')[0];
var myAudio = document.getElementsByTagName('audio')[0];
-v.addEventListener("seeked", function() { document.getElementsByTagName("video")[0].play(); }, true);
-
-function VideoClipPlay(location) {
- myVideo.src = location
- myVideo.load();
- myVideo.play();
- //addOutput("Video clip");
+if (myAudio) {
+// addOutput("Audio");
+ myMedia = myAudio;
}
+else {
+// addOutput("Video");
+ myMedia = myVideo;
+}
+v.addEventListener("seeked", function() { document.getElementsByTagName("video")[0].play(); }, true);
-function AudioClipPlay(location) {
- myAudio.src = location
- myAudio.load();
- myAudio.play();
+function ClipPlay(location) {
+ myMedia.src = location
+ myMedia.load();
+ myMedia.play();
//addOutput("Audio clip");
-
}
-function Vupdatetime() {
- addToutput(myVideo.currentTime);
+function Updatetime() {
+ addToutput(myMedia.currentTime);
}
-function Aupdatetime() {
- addToutput(myAudio.currentTime);
-}
-
function addToutput(str) {
toutput.value = str;
}
+function Gototime(location) {
+ t = getGoto();
+// addOutput(location + t);
+ myMedia.src = location + t;
+ myMedia.load();
+ myMedia.play();
+}
+
+function getGoto() {
+ i = parseInt(gototime.value);
+ return isNaN(i) ? 0 : i;
+}
+
var outLines = 0;
function addOutput(str) {
Modified: arkaiv/trunk/arkaiv/templates/playlistview.mak
===================================================================
--- arkaiv/trunk/arkaiv/templates/playlistview.mak 2009-05-07 11:10:01 UTC (rev 3919)
+++ arkaiv/trunk/arkaiv/templates/playlistview.mak 2009-05-11 01:40:14 UTC (rev 3920)
@@ -2,107 +2,10 @@
<h2>
${c.name}
</h2>
-${ h.form(h.url(action='deleteplaylist'), multipart=True) }
-${ h.submit('Delete') }
-${ h.hidden_field('playlistname', value=c.name) }
-${ h.end_form() }
-
-<form name="clips">
% for clip in c.clips:
-<label for="${clip['id']}">
-<input id="${clip['id']}" type="checkbox" name="list" value="${clip['url']}" checked/>
-${clip['url']}
-
-</label>
-<br>
+<audio src='${clip['url']}' controls='controls'></audio>
+<p>
% endfor
-</form>
-<embed type="application/liboggplay" src="${c.clips[0]['url']}" width=320 height=240/>
-
-<form name="api">
-<input type="button" value="Play" onclick='Play()'/>
-<input type="button" value="Pause" onclick='Pause()'/>
-<input type="button" value="Playlist next" onclick='PlaylistNext()'/>
-<input type="button" value="Playlist prev" onclick='PlaylistPrev()'/>
-<br>
-<textarea name="ofield" cols="60" rows="9"></textarea>
-<br>
-<input type="text" name="ifield" size="20"/>
-
-</form>
-
-<script>
-var plugin = document.embeds[0];
-var input = document.api.ifield;
-var output = document.api.ofield;
-var clips = document.clips.list;
-
-addOutput("clips length is " + clips.length);
-
-RegisterPlaylistCallback();
-
-for (i=1; i < clips.length; i++) {
- addOutput(clips[i].value)
- plugin.appendMovie(clips[i].value)
-}
-
-GetPlaylistLength();
-
-function myEndPlayCallback() {
- addOutput("End of track");
-}
-
-function RegisterPlaylistCallback() {
- plugin.registerPlaylistCallback(
- {
- call: function() { myEndPlayCallback(); }
- }
-);
-addOutput("Registered playlist callback");
-}
-
-function Play() {
- plugin.play();
- addOutput("Play!");
-}
-
-function Pause() {
- plugin.pause();
- addOutput("Pause!");
-}
-
-function GetPlaylistLength() {
- addOutput("Playlist length: " + plugin.getPlaylistLength());
-}
-
-function PlaylistNext() {
- addOutput("Playing next movie - " +
- (plugin.playlistNext() ? "succeeded" : "failed"));
-}
-
-function PlaylistPrev() {
- addOutput("Playing prev movie - " +
- (plugin.playlistPrev() ? "succeeded" : "failed"));
-}
-
-var outLines = 0;
-
-function addOutput(str) {
- if (outLines == 0) {
- output.value = str;
- } else {
- output.value = str + "\n" + output.value;
- }
- outLines++;
- if (outLines == 11) {
- i = output.value.lastIndexOf("\n");
- output.value = output.value.substr(0, i);
- outLines--;
- }
-
-}
-
-</script>
<hr>
More information about the commits
mailing list