6 } |
6 } |
7 |
7 |
8 /* The Metadataplayer Object, single point of entry, replaces IriSP.init_player */ |
8 /* The Metadataplayer Object, single point of entry, replaces IriSP.init_player */ |
9 |
9 |
10 IriSP.Metadataplayer = function(config, video_metadata) { |
10 IriSP.Metadataplayer = function(config, video_metadata) { |
|
11 IriSP.log("IriSP.Metadataplayer constructor"); |
11 for (var key in IriSP.guiDefaults) { |
12 for (var key in IriSP.guiDefaults) { |
12 if (IriSP.guiDefaults.hasOwnProperty(key) && !config.gui.hasOwnProperty(key)) { |
13 if (IriSP.guiDefaults.hasOwnProperty(key) && !config.gui.hasOwnProperty(key)) { |
13 config.gui[key] = IriSP.guiDefaults[key] |
14 config.gui[key] = IriSP.guiDefaults[key] |
14 } |
15 } |
15 } |
16 } |
24 IriSP.Metadataplayer.prototype.toString = function() { |
25 IriSP.Metadataplayer.prototype.toString = function() { |
25 return 'A Metadataplayer in DIV #' + this.config.gui.container; |
26 return 'A Metadataplayer in DIV #' + this.config.gui.container; |
26 } |
27 } |
27 |
28 |
28 IriSP.Metadataplayer.prototype.loadLibs = function() { |
29 IriSP.Metadataplayer.prototype.loadLibs = function() { |
29 |
30 IriSP.log("IriSP.Metadataplayer.prototype.loadLibs"); |
30 var $L = $LAB |
31 var $L = $LAB |
31 .script(IriSP.getLib("underscore")) |
32 .script(IriSP.getLib("underscore")) |
32 .script(IriSP.getLib("Mustache")) |
33 .script(IriSP.getLib("Mustache")) |
33 .script(IriSP.getLib("jQuery")) |
34 .script(IriSP.getLib("jQuery")) |
34 .script(IriSP.getLib("swfObject")) |
35 .script(IriSP.getLib("swfObject")) |
50 $L.script(IriSP.getLib(IriSP.widgetsRequirements[_t].requires)); |
51 $L.script(IriSP.getLib(IriSP.widgetsRequirements[_t].requires)); |
51 } |
52 } |
52 } |
53 } |
53 |
54 |
54 var _this = this; |
55 var _this = this; |
55 |
56 IriSP.log($L); |
56 $L.wait(function() { |
57 $L.wait(function() { |
|
58 _this.onLibsLoaded(); |
|
59 }); |
|
60 } |
|
61 |
|
62 IriSP.Metadataplayer.prototype.onLibsLoaded = function() { |
|
63 IriSP.log("IriSP.Metadataplayer.prototype.onLibsLoaded"); |
|
64 if (typeof IriSP.jQuery === "undefined" && typeof window.jQuery !== "undefined") { |
57 IriSP.jQuery = window.jQuery.noConflict(); |
65 IriSP.jQuery = window.jQuery.noConflict(); |
|
66 } |
|
67 if (typeof IriSP._ === "undefined" && typeof window._ !== "undefined") { |
58 IriSP._ = window._.noConflict(); |
68 IriSP._ = window._.noConflict(); |
59 |
69 } |
60 IriSP.loadCss(IriSP.getLib("cssjQueryUI")) |
70 IriSP.loadCss(IriSP.getLib("cssjQueryUI")); |
61 IriSP.loadCss(_this.config.gui.css); |
71 IriSP.loadCss(this.config.gui.css); |
62 |
72 |
63 _this.onLibsLoaded(); |
|
64 |
|
65 }); |
|
66 } |
|
67 |
|
68 IriSP.Metadataplayer.prototype.onLibsLoaded = function() { |
|
69 this.videoData = this.loadMetadata(this.video_metadata); |
73 this.videoData = this.loadMetadata(this.video_metadata); |
70 this.$ = IriSP.jQuery('#' + this.config.gui.container); |
74 this.$ = IriSP.jQuery('#' + this.config.gui.container); |
71 this.$.css({ |
75 this.$.css({ |
72 "width": this.config.gui.width, |
76 "width": this.config.gui.width, |
73 "clear": "both" |
77 "clear": "both" |
143 }); |
147 }); |
144 } |
148 } |
145 } |
149 } |
146 |
150 |
147 IriSP.Metadataplayer.prototype.configurePopcorn = function() { |
151 IriSP.Metadataplayer.prototype.configurePopcorn = function() { |
|
152 IriSP.log("IriSP.Metadataplayer.prototype.configurePopcorn"); |
148 var pop, |
153 var pop, |
149 ret = this.layoutDivs("video"), |
154 ret = this.layoutDivs("video"), |
150 containerDiv = ret[0], |
155 containerDiv = ret[0], |
151 spacerDiv = ret[1], |
156 spacerDiv = ret[1], |
152 _this = this, |
157 _this = this, |
153 _types = { |
158 _types = { |
154 "html5" : /\.(ogv|webm|mp4)$/, |
159 "html5" : /\.(ogg|ogv|webm|mp4)$/, |
155 "youtube" : /^(https?:\/\/)?(www\.)?youtube\.com/, |
160 "youtube" : /^(https?:\/\/)?(www\.)?youtube\.com/, |
156 "dailymotion" : /^(https?:\/\/)?(www\.)?dailymotion\.com/ |
161 "dailymotion" : /^(https?:\/\/)?(www\.)?dailymotion\.com/ |
157 }; |
162 }; |
158 |
163 |
159 if (this.config.player.type === "auto") { |
164 if (this.config.player.type === "auto") { |
169 /* |
174 /* |
170 todo : dynamically create the div/video tag which |
175 todo : dynamically create the div/video tag which |
171 will contain the video. |
176 will contain the video. |
172 */ |
177 */ |
173 case "html5": |
178 case "html5": |
174 var tmpId = Popcorn.guid("video"); |
179 var _tmpId = Popcorn.guid("video"), |
175 IriSP.jQuery("#" + containerDiv).append("<video src='" + this.config.player.video + "' id='" + tmpId + "'></video>"); |
180 _videoEl = IriSP.jQuery('<video>'); |
176 |
181 |
177 if(options.hasOwnProperty("width")) |
182 _videoEl.attr({ |
178 IriSP.jQuery("#" + containerDiv).css("width", this.config.player.width); |
183 "src" : this.config.player.video, |
179 |
184 "id" : _tmpId |
180 if(options.hasOwnProperty("height")) |
185 }) |
181 IriSP.jQuery("#" + containerDiv).css("height", this.config.player.height); |
186 |
182 pop = Popcorn("#" + tmpId); |
187 if(this.config.player.hasOwnProperty("width")) { |
|
188 _videoEl.attr("width", this.config.player.width); |
|
189 } |
|
190 if(this.config.player.hasOwnProperty("height")) { |
|
191 _videoEl.attr("height", this.config.player.height); |
|
192 } |
|
193 IriSP.jQuery("#" + containerDiv).append(_videoEl); |
|
194 pop = Popcorn("#" + _tmpId); |
183 break; |
195 break; |
184 |
196 |
185 case "jwplayer": |
197 case "jwplayer": |
186 var opts = IriSP.jQuery.extend({}, this.config.player); |
198 var opts = IriSP.jQuery.extend({}, this.config.player); |
187 delete opts.container; |
199 delete opts.container; |