diff -r 919e362b9db1 -r 3ab36f402b0c src/widgets/MediaList.js --- a/src/widgets/MediaList.js Thu Aug 30 14:45:23 2012 +0200 +++ b/src/widgets/MediaList.js Thu Jan 02 16:40:25 2014 +0100 @@ -7,16 +7,16 @@ IriSP.Widgets.MediaList.prototype.messages = { "fr": { - now_playing: "Média en cours", - all_media: "Tous les medias", - other_media: "Autres médias" + now_playing: "Vidéo en cours", + all_media: "Toutes les vidéos", + other_media: "Autres vidéos" }, "en": { now_playing: "Now playing", - all_media: "All media", - other_media: "Other media" + all_media: "All videos", + other_media: "Other videos" } -} +}; IriSP.Widgets.MediaList.prototype.defaults = { default_thumbnail : "http://ldt.iri.centrepompidou.fr/static/site/ldt/css/imgs/video_sequence.png", @@ -49,17 +49,22 @@ var _n = this.refresh(true); if (this.searchString) { if (_n) { - this.player.popcorn.trigger("IriSP.search.matchFound"); + this.player.trigger("search.matchFound"); } else { - this.player.popcorn.trigger("IriSP.search.noMatchFound"); + this.player.trigger("search.noMatchFound"); } } -} +}; IriSP.Widgets.MediaList.prototype.draw = function() { - this.bindPopcorn("timeupdate","onTimeupdate"); this.$.addClass("Ldt-MediaListWidget") this.renderTemplate(); + var _this = this; + if (typeof this.media.getMedias === "function") { + this.media.on("enter-annotation", function(_a) { + _this.redraw(_a.getMedia()); + }); + } this.redraw(); }; @@ -76,9 +81,9 @@ left: _scale * _annotation.begin, width: _scale * (_annotation.end - _annotation.begin), color: ( typeof _annotation.color !== "undefined" && _annotation.color ? _annotation.color : _this.default_color ) - } - }) -} + }; + }); +}; IriSP.Widgets.MediaList.prototype.redraw = function(_media) { if (typeof _media !== "undefined") { @@ -116,21 +121,10 @@ title: _media.title, description: _media.description, segments: _this.getSegments(_media) - }) + }); }).join(""); this.$.find('.Ldt-MediaList-OtherList').html(_html); } else { this.$.find('.Ldt-MediaList-Other').hide(); } }; - -IriSP.Widgets.MediaList.prototype.onTimeupdate = function() { - var _media = this.source.currentMedia; - if (_media.elementType === "mashup") { - _media = _media.getMediaAtTime(this.player.popcorn.currentTime() * 1000); - } - if (typeof _media !== "undefined" && _media.id !== this.lastMedia) { - this.lastMedia = _media.id; - this.redraw(_media); - } -}