5 |
5 |
6 IriSP.Widgets.MediaList.prototype = new IriSP.Widgets.Widget(); |
6 IriSP.Widgets.MediaList.prototype = new IriSP.Widgets.Widget(); |
7 |
7 |
8 IriSP.Widgets.MediaList.prototype.messages = { |
8 IriSP.Widgets.MediaList.prototype.messages = { |
9 "fr": { |
9 "fr": { |
10 now_playing: "Vidéo en cours", |
10 now_playing: "Média en cours", |
11 all_media: "Toutes les vidéos", |
11 all_media: "Tous les medias", |
12 other_media: "Autres vidéos" |
12 other_media: "Autres médias" |
13 }, |
13 }, |
14 "en": { |
14 "en": { |
15 now_playing: "Now playing", |
15 now_playing: "Now playing", |
16 all_media: "All videos", |
16 all_media: "All media", |
17 other_media: "Other videos" |
17 other_media: "Other media" |
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" |
47 IriSP.Widgets.MediaList.prototype.onSearch = function(searchString) { |
47 IriSP.Widgets.MediaList.prototype.onSearch = function(searchString) { |
48 this.searchString = typeof searchString !== "undefined" ? searchString : ''; |
48 this.searchString = typeof searchString !== "undefined" ? searchString : ''; |
49 var _n = this.refresh(true); |
49 var _n = this.refresh(true); |
50 if (this.searchString) { |
50 if (this.searchString) { |
51 if (_n) { |
51 if (_n) { |
52 this.player.trigger("search.matchFound"); |
52 this.player.popcorn.trigger("IriSP.search.matchFound"); |
53 } else { |
53 } else { |
54 this.player.trigger("search.noMatchFound"); |
54 this.player.popcorn.trigger("IriSP.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.bindPopcorn("timeupdate","onTimeupdate"); |
60 this.$.addClass("Ldt-MediaListWidget") |
61 this.$.addClass("Ldt-MediaListWidget") |
61 this.renderTemplate(); |
62 this.renderTemplate(); |
62 var _this = this; |
|
63 if (typeof this.media.getMedias === "function") { |
|
64 this.media.on("enter-annotation", function(_a) { |
|
65 _this.redraw(_a.getMedia()); |
|
66 }); |
|
67 } |
|
68 this.redraw(); |
63 this.redraw(); |
69 }; |
64 }; |
70 |
65 |
71 IriSP.Widgets.MediaList.prototype.getSegments = function(_media) { |
66 IriSP.Widgets.MediaList.prototype.getSegments = function(_media) { |
72 var _this = this, |
67 var _this = this, |
79 var _annotation = ( _a.type = "mashedAnnotation" ? _a.annotation : _a ); |
74 var _annotation = ( _a.type = "mashedAnnotation" ? _a.annotation : _a ); |
80 return { |
75 return { |
81 left: _scale * _annotation.begin, |
76 left: _scale * _annotation.begin, |
82 width: _scale * (_annotation.end - _annotation.begin), |
77 width: _scale * (_annotation.end - _annotation.begin), |
83 color: ( typeof _annotation.color !== "undefined" && _annotation.color ? _annotation.color : _this.default_color ) |
78 color: ( typeof _annotation.color !== "undefined" && _annotation.color ? _annotation.color : _this.default_color ) |
84 }; |
79 } |
85 }); |
80 }) |
86 }; |
81 } |
87 |
82 |
88 IriSP.Widgets.MediaList.prototype.redraw = function(_media) { |
83 IriSP.Widgets.MediaList.prototype.redraw = function(_media) { |
89 if (typeof _media !== "undefined") { |
84 if (typeof _media !== "undefined") { |
90 this.$.find('.Ldt-MediaList-Other h2').html(this.l10n.other_media); |
85 this.$.find('.Ldt-MediaList-Other h2').html(this.l10n.other_media); |
91 this.$.find('.Ldt-MediaList-NowPlaying').show(); |
86 this.$.find('.Ldt-MediaList-NowPlaying').show(); |
119 media: _media.id |
114 media: _media.id |
120 }), |
115 }), |
121 title: _media.title, |
116 title: _media.title, |
122 description: _media.description, |
117 description: _media.description, |
123 segments: _this.getSegments(_media) |
118 segments: _this.getSegments(_media) |
124 }); |
119 }) |
125 }).join(""); |
120 }).join(""); |
126 this.$.find('.Ldt-MediaList-OtherList').html(_html); |
121 this.$.find('.Ldt-MediaList-OtherList').html(_html); |
127 } else { |
122 } else { |
128 this.$.find('.Ldt-MediaList-Other').hide(); |
123 this.$.find('.Ldt-MediaList-Other').hide(); |
129 } |
124 } |
130 }; |
125 }; |
|
126 |
|
127 IriSP.Widgets.MediaList.prototype.onTimeupdate = function() { |
|
128 var _media = this.source.currentMedia; |
|
129 if (_media.elementType === "mashup") { |
|
130 _media = _media.getMediaAtTime(this.player.popcorn.currentTime() * 1000); |
|
131 } |
|
132 if (typeof _media !== "undefined" && _media.id !== this.lastMedia) { |
|
133 this.lastMedia = _media.id; |
|
134 this.redraw(_media); |
|
135 } |
|
136 } |