equal
deleted
inserted
replaced
51 }, |
51 }, |
52 fr: { |
52 fr: { |
53 voice_annotation: "Annotation Vocale", |
53 voice_annotation: "Annotation Vocale", |
54 now_playing: "Lecture en cours..." |
54 now_playing: "Lecture en cours..." |
55 } |
55 } |
56 } |
56 }; |
57 |
57 |
58 IriSP.Widgets.AnnotationsList.prototype.template = |
58 IriSP.Widgets.AnnotationsList.prototype.template = |
59 '<div class="Ldt-AnnotationsListWidget">' |
59 '<div class="Ldt-AnnotationsListWidget">' |
60 + '{{#show_audio}}<div class="Ldt-AnnotationsList-Audio"></div>{{/show_audio}}' |
60 + '{{#show_audio}}<div class="Ldt-AnnotationsList-Audio"></div>{{/show_audio}}' |
61 + '<ul class="Ldt-AnnotationsList-ul">' |
61 + '<ul class="Ldt-AnnotationsList-ul">' |
100 end : Math.min(_duration.milliseconds, _currentTime + this.ajax_granularity) |
100 end : Math.min(_duration.milliseconds, _currentTime + this.ajax_granularity) |
101 }); |
101 }); |
102 this.currentSource = this.player.loadMetadata(IriSP._.defaults({ |
102 this.currentSource = this.player.loadMetadata(IriSP._.defaults({ |
103 "url" : _url |
103 "url" : _url |
104 }, this.metadata)); |
104 }, this.metadata)); |
105 } |
105 }; |
106 |
106 |
107 IriSP.Widgets.AnnotationsList.prototype.ajaxMashup = function() { |
107 IriSP.Widgets.AnnotationsList.prototype.ajaxMashup = function() { |
108 var _currentTime = this.media.getCurrentTime(); |
108 var _currentTime = this.media.getCurrentTime(); |
109 var _currentAnnotation = this.source.currentMedia.getAnnotationAtTime(_currentTime); |
109 var _currentAnnotation = this.source.currentMedia.getAnnotationAtTime(_currentTime); |
110 if (typeof _currentAnnotation !== "undefined" && _currentAnnotation.id !== this.lastMashupAnnotation) { |
110 if (typeof _currentAnnotation !== "undefined" && _currentAnnotation.id !== this.lastMashupAnnotation) { |
117 }); |
117 }); |
118 this.currentSource = this.player.loadMetadata(IriSP._.defaults({ |
118 this.currentSource = this.player.loadMetadata(IriSP._.defaults({ |
119 "url" : _url |
119 "url" : _url |
120 }, this.metadata)); |
120 }, this.metadata)); |
121 } |
121 } |
122 } |
122 }; |
123 |
123 |
124 IriSP.Widgets.AnnotationsList.prototype.refresh = function(_forceRedraw) { |
124 IriSP.Widgets.AnnotationsList.prototype.refresh = function(_forceRedraw) { |
125 _forceRedraw = (typeof _forceRedraw !== "undefined" && _forceRedraw); |
125 _forceRedraw = (typeof _forceRedraw !== "undefined" && _forceRedraw); |
126 if (this.currentSource.status !== IriSP.Model._SOURCE_STATUS_READY) { |
126 if (this.currentSource.status !== IriSP.Model._SOURCE_STATUS_READY) { |
127 return 0; |
127 return 0; |
144 }); |
144 }); |
145 if (this.limit_count) { |
145 if (this.limit_count) { |
146 /* Get the n annotations closest to current timecode */ |
146 /* Get the n annotations closest to current timecode */ |
147 _list = _list.sortBy(function(_annotation) { |
147 _list = _list.sortBy(function(_annotation) { |
148 return Math.abs((_annotation.begin + _annotation.end) / 2 - _currentTime); |
148 return Math.abs((_annotation.begin + _annotation.end) / 2 - _currentTime); |
149 }).slice(0, this.limit_count) |
149 }).slice(0, this.limit_count); |
150 } |
150 } |
151 if (this.newest_first) { |
151 if (this.newest_first) { |
152 _list = _list.sortBy(function(_annotation) { |
152 _list = _list.sortBy(function(_annotation) { |
153 return -_annotation.created.valueOf(); |
153 return -_annotation.created.valueOf(); |
154 }); |
154 }); |
231 controls: false, |
231 controls: false, |
232 width: 1, |
232 width: 1, |
233 height: 1, |
233 height: 1, |
234 events: { |
234 events: { |
235 onPause: function() { |
235 onPause: function() { |
236 _this.$.find(".Ldt-AnnotationsList-Play[data-annotation-id=" + _annotation.id + "]").text(_this.l10n.voice_annotation) |
236 _this.$.find(".Ldt-AnnotationsList-Play[data-annotation-id=" + _annotation.id + "]").text(_this.l10n.voice_annotation); |
237 }, |
237 }, |
238 onPlay: function() { |
238 onPlay: function() { |
239 _this.$.find(".Ldt-AnnotationsList-Play[data-annotation-id=" + _annotation.id + "]").text(_this.l10n.now_playing) |
239 _this.$.find(".Ldt-AnnotationsList-Play[data-annotation-id=" + _annotation.id + "]").text(_this.l10n.now_playing); |
240 } |
240 } |
241 } |
241 } |
242 }); |
242 }); |
243 } |
243 } |
244 } |
244 } |
310 this.ajaxSource(); |
310 this.ajaxSource(); |
311 } |
311 } |
312 } |
312 } |
313 } |
313 } |
314 return _list.length; |
314 return _list.length; |
315 } |
315 }; |
316 |
316 |
317 IriSP.Widgets.AnnotationsList.prototype.draw = function() { |
317 IriSP.Widgets.AnnotationsList.prototype.draw = function() { |
318 |
318 |
319 this.jwplayers = {}; |
319 this.jwplayers = {}; |
320 this.mashupMode = (this.media.elementType === "mashup"); |
320 this.mashupMode = (this.media.elementType === "mashup"); |
370 this.currentSource = this.source; |
370 this.currentSource = this.source; |
371 } |
371 } |
372 |
372 |
373 if (this.refresh_interval) { |
373 if (this.refresh_interval) { |
374 window.setInterval(function() { |
374 window.setInterval(function() { |
375 _this.currentSource.get() |
375 _this.currentSource.get(); |
376 }, this.refresh_interval); |
376 }, this.refresh_interval); |
377 } |
377 } |
378 |
378 |
379 this.onMdpEvent("createAnnotationWidget.addedAnnotation"); |
379 this.onMdpEvent("createAnnotationWidget.addedAnnotation"); |
380 var _events = [ |
380 var _events = [ |