src/widgets/MediaList.js
changeset 1013 392ddcd212d7
parent 983 97fef7a4b189
child 1072 ac1eacb3aa33
equal deleted inserted replaced
1012:7e18d953a1f8 1013:392ddcd212d7
    14     "en": {
    14     "en": {
    15         now_playing: "Now playing",
    15         now_playing: "Now playing",
    16         all_media: "All videos",
    16         all_media: "All videos",
    17         other_media: "Other videos"
    17         other_media: "Other videos"
    18     }
    18     }
    19 }
    19 };
    20 
    20 
    21 IriSP.Widgets.MediaList.prototype.defaults = {
    21 IriSP.Widgets.MediaList.prototype.defaults = {
    22     default_thumbnail : "http://ldt.iri.centrepompidou.fr/static/site/ldt/css/imgs/video_sequence.png",
    22     default_thumbnail : "http://ldt.iri.centrepompidou.fr/static/site/ldt/css/imgs/video_sequence.png",
    23     media_url_template : "http://ldt.iri.centrepompidou.fr/ldtplatform/ldt/front/player/{{media}}/",
    23     media_url_template : "http://ldt.iri.centrepompidou.fr/ldtplatform/ldt/front/player/{{media}}/",
    24     default_color : "#000080"
    24     default_color : "#000080"
    52             this.player.trigger("search.matchFound");
    52             this.player.trigger("search.matchFound");
    53         } else {
    53         } else {
    54             this.player.trigger("search.noMatchFound");
    54             this.player.trigger("search.noMatchFound");
    55         }
    55         }
    56     }
    56     }
    57 }
    57 };
    58 
    58 
    59 IriSP.Widgets.MediaList.prototype.draw = function() {
    59 IriSP.Widgets.MediaList.prototype.draw = function() {
    60     this.$.addClass("Ldt-MediaListWidget")
    60     this.$.addClass("Ldt-MediaListWidget")
    61     this.renderTemplate();
    61     this.renderTemplate();
    62     var _this = this;
    62     var _this = this;
    63     if (typeof this.media.getMedias === "function") {
    63     if (typeof this.media.getMedias === "function") {
    64         this.media.on("enter-annotation", function(_a) {
    64         this.media.on("enter-annotation", function(_a) {
    65             _this.redraw(_a.getMedia());
    65             _this.redraw(_a.getMedia());
    66         })
    66         });
    67     }
    67     }
    68     this.redraw();
    68     this.redraw();
    69 };
    69 };
    70 
    70 
    71 IriSP.Widgets.MediaList.prototype.getSegments = function(_media) {
    71 IriSP.Widgets.MediaList.prototype.getSegments = function(_media) {
    79             var _annotation = ( _a.type = "mashedAnnotation" ? _a.annotation : _a );
    79             var _annotation = ( _a.type = "mashedAnnotation" ? _a.annotation : _a );
    80             return {
    80             return {
    81                 left: _scale * _annotation.begin,
    81                 left: _scale * _annotation.begin,
    82                 width: _scale * (_annotation.end - _annotation.begin),
    82                 width: _scale * (_annotation.end - _annotation.begin),
    83                 color: ( typeof _annotation.color !== "undefined" && _annotation.color ? _annotation.color : _this.default_color )
    83                 color: ( typeof _annotation.color !== "undefined" && _annotation.color ? _annotation.color : _this.default_color )
    84             }
    84             };
    85         })
    85         });
    86 }
    86 };
    87 
    87 
    88 IriSP.Widgets.MediaList.prototype.redraw = function(_media) {
    88 IriSP.Widgets.MediaList.prototype.redraw = function(_media) {
    89     if (typeof _media !== "undefined") {
    89     if (typeof _media !== "undefined") {
    90         this.$.find('.Ldt-MediaList-Other h2').html(this.l10n.other_media);
    90         this.$.find('.Ldt-MediaList-Other h2').html(this.l10n.other_media);
    91         this.$.find('.Ldt-MediaList-NowPlaying').show();
    91         this.$.find('.Ldt-MediaList-NowPlaying').show();
   119                         media: _media.id
   119                         media: _media.id
   120                     }),
   120                     }),
   121                 title: _media.title,
   121                 title: _media.title,
   122                 description: _media.description,
   122                 description: _media.description,
   123                 segments: _this.getSegments(_media)
   123                 segments: _this.getSegments(_media)
   124             })
   124             });
   125         }).join("");
   125         }).join("");
   126         this.$.find('.Ldt-MediaList-OtherList').html(_html);
   126         this.$.find('.Ldt-MediaList-OtherList').html(_html);
   127     } else {
   127     } else {
   128         this.$.find('.Ldt-MediaList-Other').hide();
   128         this.$.find('.Ldt-MediaList-Other').hide();
   129     }
   129     }