web/res/metadataplayer/AnnotationsList.js
changeset 638 e0d4e8431de3
parent 623 5b7d7ab6baff
child 654 a5977736d2b0
--- a/web/res/metadataplayer/AnnotationsList.js	Thu Jun 14 16:05:27 2012 +0200
+++ b/web/res/metadataplayer/AnnotationsList.js	Wed Jun 20 18:46:56 2012 +0200
@@ -16,7 +16,7 @@
      * e.g. http://ldt.iri.centrepompidou.fr/ldtplatform/api/ldt/segments/{{media}}/{{begin}}/{{end}}?callback=?
      */
     ajax_url : false,
-    /* how much ms should we look before and after the current timecode in the segment API
+    /* number of milliseconds before/after the current timecode when calling the segment API
      */
     ajax_granularity : 300000, 
     default_thumbnail : "http://ldt.iri.centrepompidou.fr/static/site/ldt/css/imgs/video_sequence.png",
@@ -84,7 +84,7 @@
     this.lastAjaxQuery = _currentTime;
     _currentTime = Math.floor(1000 * _currentTime);
     var _url = Mustache.to_html(this.ajax_url, {
-        media : this.source.currentMedia.namespacedId.name,
+        media : this.source.currentMedia.id,
         begin : Math.max(0, _currentTime - this.ajax_granularity),
         end : Math.min(_duration.milliseconds, _currentTime + this.ajax_granularity)
     });
@@ -99,11 +99,11 @@
         _currentTime = 0;
     }
     var _currentAnnotation = this.source.currentMedia.getAnnotationAtTime(_currentTime * 1000);
-    if (typeof _currentAnnotation !== "undefined" && _currentAnnotation.namespacedId.name !== this.lastMashupAnnotation) {
-        this.lastMashupAnnotation = _currentAnnotation.namespacedId.name;
+    if (typeof _currentAnnotation !== "undefined" && _currentAnnotation.id !== this.lastMashupAnnotation) {
+        this.lastMashupAnnotation = _currentAnnotation.id;
         var _currentMedia = _currentAnnotation.getMedia(),
             _url = Mustache.to_html(this.ajax_url, {
-                media : _currentMedia.namespacedId.name,
+                media : _currentMedia.id,
                 begin : Math.max(0, _currentAnnotation.annotation.begin.milliseconds - this.ajax_granularity),
                 end : Math.min(_currentMedia.duration.milliseconds, _currentAnnotation.annotation.end.milliseconds + this.ajax_granularity)
             });
@@ -129,9 +129,9 @@
         var _currentAnnotation = this.source.currentMedia.getAnnotationAtTime(_currentTime * 1000);
         if (typeof _currentAnnotation !== "undefined") {
             _currentTime = _currentTime - _currentAnnotation.begin.getSeconds() + _currentAnnotation.annotation.begin.getSeconds();
-            var _mediaId = _currentAnnotation.getMedia().namespacedId.name;
+            var _mediaId = _currentAnnotation.getMedia().id;
             _list = _list.filter(function(_annotation) {
-                return _annotation.getMedia().namespacedId.name === _mediaId;
+                return _annotation.getMedia().id === _mediaId;
             });
         }
     }
@@ -169,15 +169,15 @@
                                 {
                                     project : _annotation.project,
                                     media : _annotation.media.id.replace(/^.*:/,''),
-                                    annotation : _annotation.namespacedId.name,
+                                    annotation : _annotation.id,
                                     annotationType : _annotation.annotationType.id.replace(/^.*:/,'')
                                 }
                             )
-                            : '#id=' + _annotation.namespacedId.name
+                            : '#id=' + _annotation.id
                             )
                     );
                     var _res = {
-                        id : _annotation.namespacedId.name,
+                        id : _annotation.id,
                         title : _annotation.title.replace(_annotation.description,''),
                         description : _annotation.description,
                         begin : _annotation.begin.toString(),
@@ -234,6 +234,7 @@
     this.bindPopcorn("IriSP.search", "onSearch");
     this.bindPopcorn("IriSP.search.closed", "onSearch");
     this.bindPopcorn("IriSP.search.cleared", "onSearch");
+    this.bindPopcorn("IriSP.AnnotationsList.refresh","refresh");
     
     var _this = this;