src/js/init.js
branchnew-model
changeset 883 d35ad8111c5e
parent 882 61c384dda19e
child 884 10233337f6da
equal deleted inserted replaced
882:61c384dda19e 883:d35ad8111c5e
    32     if(this.config.player.type === "jwplayer" || this.config.player.type === "allocine" || this.config.player.type === "dailymotion") {
    32     if(this.config.player.type === "jwplayer" || this.config.player.type === "allocine" || this.config.player.type === "dailymotion") {
    33         // load our popcorn.js lookalike
    33         // load our popcorn.js lookalike
    34         $L.script(IriSP.getLib("jwplayer"));
    34         $L.script(IriSP.getLib("jwplayer"));
    35     } else {
    35     } else {
    36         // load the real popcorn
    36         // load the real popcorn
    37         $L.script(IriSP.getLib("popcorn")).script(IriSP.getLib("popcorn.code"));
    37         $L.script(IriSP.getLib("popcorn"));
    38         // load plugins if necessary
       
    39         if(this.config.player.type === "youtube") {
       
    40             $L.script(IriSP.getLib("popcorn.youtube"));
       
    41         }
       
    42         if(this.config.player.type === "vimeo"){
       
    43             $L.script(IriSP.getLib("popcorn.vimeo"));
       
    44         }
       
    45     }
    38     }
    46 
    39 
    47     /* widget specific requirements */
    40     /* widget specific requirements */
    48     for(var _i = 0; _i < this.config.gui.widgets.length; _i++) {
    41     for(var _i = 0; _i < this.config.gui.widgets.length; _i++) {
    49         var _t = this.config.gui.widgets[_i].type;
    42         var _t = this.config.gui.widgets[_i].type;
   184             }
   177             }
   185             pop = new IriSP.PopcornReplacement.jwplayer("#" + containerDiv, opts);
   178             pop = new IriSP.PopcornReplacement.jwplayer("#" + containerDiv, opts);
   186             break;
   179             break;
   187 
   180 
   188         case "youtube":
   181         case "youtube":
   189             var opts = IriSP.jQuery.extend({}, this.config.player);
       
   190             delete opts.container;
       
   191             opts.controls = 0;
       
   192             opts.autostart = false;
       
   193             // Popcorn.youtube wants us to specify the size of the player in the style attribute of its container div.
   182             // Popcorn.youtube wants us to specify the size of the player in the style attribute of its container div.
   194             IriSP.jQuery("#" + containerDiv).css({
   183             IriSP.jQuery("#" + containerDiv).css({
   195                 width : opts.width + "px",
   184                 width : this.config.player.width + "px",
   196                 height : opts.height + "px"
   185                 height : this.config.player.height + "px"
   197             })
   186             });
   198             pop = Popcorn.youtube("#" + containerDiv, opts.video, opts);
   187             var _urlparts = this.config.player.video.split(/[?&]/),
       
   188                 _params = {};
       
   189             for (var _j = 1; _j < _urlparts.length; _j++) {
       
   190                 var _ppart = _urlparts[_j].split('=');
       
   191                 _params[_ppart[0]] = decodeURIComponent(_ppart[1]);
       
   192             }
       
   193             _params.controls = 0;
       
   194             _params.modestbranding = 1;
       
   195             _url = _urlparts[0] + '?' + IriSP.jQuery.param(_params);
       
   196             pop = Popcorn.youtube("#" + containerDiv, _url);
   199             break;
   197             break;
   200 
   198 
   201         case "dailymotion":
   199         case "dailymotion":
   202             pop = new IriSP.PopcornReplacement.dailymotion("#" + containerDiv, this.config.player);
   200             pop = new IriSP.PopcornReplacement.dailymotion("#" + containerDiv, this.config.player);
   203             break;
   201             break;