player/js/player.js
changeset 55 102138d78081
parent 41 8d774f0b6182
child 64 3f480bb52daa
--- a/player/js/player.js	Fri Jun 21 16:26:26 2013 +0200
+++ b/player/js/player.js	Fri Jun 21 18:20:49 2013 +0200
@@ -29,8 +29,11 @@
         }
     );
     
+    $(".media-duration").text(myMedia.duration);
+    
     myMedia.on("timeupdate", function(t) {
         var pos = (100 * t / myMedia.duration) + "%";
+        $(".media-position").text(t);
         $(".progress-indicator").css("left",pos);
         $(".elapsed").css("width", pos);
     });
@@ -44,7 +47,9 @@
     function showAtMousePos(evt) {
         var pos = evt.pageX - $(".timeline").offset().left;
         $(".mouse-progress-indicator").css("left", pos);
-        return pos;
+        var t = new IriSP.Model.Time(pos * myMedia.duration / $(".timeline").width());
+        $(".time-at-mouse").text(t);
+        return t;
     }
     
     $(".timeline").mouseenter(function(e) {
@@ -54,7 +59,7 @@
         $(".mouse-progress-indicator").hide();
     }).mousemove(showAtMousePos)
     .click(function(e) {
-        myMedia.setCurrentTime( showAtMousePos(e) * myMedia.duration / $(".timeline").width());
+        myMedia.setCurrentTime( showAtMousePos(e) );
     });
     
     var tags = myProject.getTags().sortBy(function(t) {
@@ -521,8 +526,6 @@
                 switch (annotationinfo.annotation.content.markup) {
                     case "html":
                         annotationDiv.find(".text-contents").html(text);
-                        
-                        //annotationDiv.find(".text-contents [style]").attr("style","");
 
                         var ps = annotationDiv.find(".text-contents>p"),
                             groups = [],
@@ -659,10 +662,14 @@
     $(window).resize(repositionElements);
     
     $(document).keydown(function(e) {
-        if (e.keyCode === 122) {
+        if (e.keyCode === 122) { // F11
             fullScreen();
             return false;
         }
+        if (e.keyCode === 32) { // Space
+            myMedia[myMedia.paused ? "play" : "pause"]();
+            return false;
+        }
     });
       
 });