src/js/init.js
branchnew-model
changeset 917 eb8677d3a663
parent 910 b9f1bd52df9a
child 919 972099304059
equal deleted inserted replaced
916:ec6849bbbdcc 917:eb8677d3a663
    53     IriSP.log("IriSP.Metadataplayer.prototype.loadLibs");
    53     IriSP.log("IriSP.Metadataplayer.prototype.loadLibs");
    54     var $L = $LAB
    54     var $L = $LAB
    55         .script(IriSP.getLib("underscore"))
    55         .script(IriSP.getLib("underscore"))
    56         .script(IriSP.getLib("Mustache"))
    56         .script(IriSP.getLib("Mustache"))
    57         .script(IriSP.getLib("jQuery"))
    57         .script(IriSP.getLib("jQuery"))
    58         .script(IriSP.getLib("swfObject"))
    58         .script(IriSP.getLib("swfObject"));
    59         .wait()
    59     
       
    60     if (typeof JSON == "undefined") {
       
    61         $L.script(IriSP.getLib("json"));
       
    62     }
       
    63     
       
    64     $L.wait()
    60         .script(IriSP.getLib("jQueryUI"));
    65         .script(IriSP.getLib("jQueryUI"));
    61 
    66 
    62     if (this.config.player.type === "jwplayer" || this.config.player.type === "auto") {
    67     if (this.config.player.type === "jwplayer" || this.config.player.type === "auto") {
    63         $L.script(IriSP.getLib("jwplayer"));
    68         $L.script(IriSP.getLib("jwplayer"));
    64     }
    69     }
   173 }
   178 }
   174 
   179 
   175 IriSP.Metadataplayer.prototype.configurePopcorn = function() {
   180 IriSP.Metadataplayer.prototype.configurePopcorn = function() {
   176     IriSP.log("IriSP.Metadataplayer.prototype.configurePopcorn");
   181     IriSP.log("IriSP.Metadataplayer.prototype.configurePopcorn");
   177     var pop,
   182     var pop,
   178         ret = this.layoutDivs("video"),
   183         ret = this.layoutDivs("video",this.config.player.height || undefined),
   179         containerDiv = ret[0],
   184         containerDiv = ret[0],
   180         spacerDiv = ret[1],
   185         spacerDiv = ret[1],
   181         _this = this,
   186         _this = this,
   182         _types = {
   187         _types = {
   183             "html5" : /\.(ogg|ogv|webm)$/,
   188             "html5" : /\.(ogg|ogv|webm)$/,
   283         case "allocine":
   288         case "allocine":
   284             /* pass the options as-is to the allocine player and let it handle everything */
   289             /* pass the options as-is to the allocine player and let it handle everything */
   285             pop = new IriSP.PopcornReplacement.allocine("#" + containerDiv, this.config.player);
   290             pop = new IriSP.PopcornReplacement.allocine("#" + containerDiv, this.config.player);
   286             break;
   291             break;
   287         
   292         
       
   293         case "mashup-html":
       
   294             pop = new IriSP.PopcornReplacement.htmlMashup("#" + containerDiv, this.config.player, this.videoData);
       
   295             break;
       
   296         
   288         default:
   297         default:
   289             pop = undefined;
   298             pop = undefined;
   290     };
   299     };
   291 
   300 
   292     this.popcorn = pop;
   301     this.popcorn = pop;
   294 
   303 
   295 /** create a subdiv with an unique id, and a spacer div as well.
   304 /** create a subdiv with an unique id, and a spacer div as well.
   296     @param widgetName the name of the widget.
   305     @param widgetName the name of the widget.
   297     @return an array of the form [createdivId, spacerdivId].
   306     @return an array of the form [createdivId, spacerdivId].
   298 */
   307 */
   299 IriSP.Metadataplayer.prototype.layoutDivs = function(_name) {
   308 IriSP.Metadataplayer.prototype.layoutDivs = function(_name, _height) {
   300     if (typeof(_name) === "undefined") {
   309     if (typeof(_name) === "undefined") {
   301        _name = "";
   310        _name = "";
   302     }
   311     }
   303     var newDiv = IriSP._.uniqueId(this.config.gui.container + "_widget_" + _name + "_"),
   312     var newDiv = IriSP._.uniqueId(this.config.gui.container + "_widget_" + _name + "_"),
   304         spacerDiv = IriSP._.uniqueId("LdtPlayer_spacer_"),
   313         spacerDiv = IriSP._.uniqueId("LdtPlayer_spacer_"),
   315                 width: this.config.gui.width + "px",
   324                 width: this.config.gui.width + "px",
   316                 height: this.config.gui.spacer_div_height + "px",
   325                 height: this.config.gui.spacer_div_height + "px",
   317                 position: "relative",
   326                 position: "relative",
   318                 clear: "both"
   327                 clear: "both"
   319             });
   328             });
       
   329     if (typeof _height !== "undefined") {
       
   330         divHtml.css("height", _height);
       
   331     }
   320             
   332             
   321     this.$.append(divHtml);
   333     this.$.append(divHtml);
   322     this.$.append(spacerHtml);
   334     this.$.append(spacerHtml);
   323 
   335 
   324     return [newDiv, spacerDiv];
   336     return [newDiv, spacerDiv];