diff -r 3ab36f402b0c -r 198c2b79f5e1 src/widgets/MediaList.js --- a/src/widgets/MediaList.js Thu Jan 02 16:40:25 2014 +0100 +++ b/src/widgets/MediaList.js Thu Jan 02 16:49:20 2014 +0100 @@ -7,16 +7,16 @@ IriSP.Widgets.MediaList.prototype.messages = { "fr": { - now_playing: "Vidéo en cours", - all_media: "Toutes les vidéos", - other_media: "Autres vidéos" + now_playing: "Média en cours", + all_media: "Tous les medias", + other_media: "Autres médias" }, "en": { now_playing: "Now playing", - all_media: "All videos", - other_media: "Other videos" + all_media: "All media", + other_media: "Other media" } -}; +} IriSP.Widgets.MediaList.prototype.defaults = { default_thumbnail : "http://ldt.iri.centrepompidou.fr/static/site/ldt/css/imgs/video_sequence.png", @@ -49,22 +49,17 @@ var _n = this.refresh(true); if (this.searchString) { if (_n) { - this.player.trigger("search.matchFound"); + this.player.popcorn.trigger("IriSP.search.matchFound"); } else { - this.player.trigger("search.noMatchFound"); + this.player.popcorn.trigger("IriSP.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(); }; @@ -81,9 +76,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") { @@ -121,10 +116,21 @@ 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); + } +}