src/js/widgets/playerWidget.js
branchpopcorn-port
changeset 440 bf9307640e55
parent 416 f3237cce149e
child 444 9e58d99a4ae4
equal deleted inserted replaced
439:1c1eebd0d080 440:bf9307640e55
    21   this.selector.children(".Ldt-controler").show();
    21   this.selector.children(".Ldt-controler").show();
    22     
    22     
    23   // handle clicks by the user on the video.
    23   // handle clicks by the user on the video.
    24   this._Popcorn.listen("play", IriSP.wrap(this, this.playButtonUpdater));
    24   this._Popcorn.listen("play", IriSP.wrap(this, this.playButtonUpdater));
    25   this._Popcorn.listen("pause", IriSP.wrap(this, this.playButtonUpdater));
    25   this._Popcorn.listen("pause", IriSP.wrap(this, this.playButtonUpdater));
       
    26 
    26   this._Popcorn.listen("timeupdate", IriSP.wrap(this, this.timeDisplayUpdater));
    27   this._Popcorn.listen("timeupdate", IriSP.wrap(this, this.timeDisplayUpdater));
    27   this._Popcorn.listen("IriSP.search.matchFound", IriSP.wrap(this, this.searchMatch));
    28   this._Popcorn.listen("IriSP.search.matchFound", IriSP.wrap(this, this.searchMatch));
    28   this._Popcorn.listen("IriSP.search.noMatchFound", IriSP.wrap(this, this.searchNoMatch));
    29   this._Popcorn.listen("IriSP.search.noMatchFound", IriSP.wrap(this, this.searchNoMatch));
    29   
    30   
    30   
    31   
    72    because in some cases (for instance, when the user directly clicks on
    73    because in some cases (for instance, when the user directly clicks on
    73    the jwplayer window) we have to change the icon without playing/pausing
    74    the jwplayer window) we have to change the icon without playing/pausing
    74 */
    75 */
    75 IriSP.PlayerWidget.prototype.playButtonUpdater = function() {
    76 IriSP.PlayerWidget.prototype.playButtonUpdater = function() {
    76   var status = this._Popcorn.media.paused;
    77   var status = this._Popcorn.media.paused;
       
    78   console.log("called!");
    77   
    79   
    78   if ( status == true ){        
    80   if ( status == true ){        
    79     this.selector.find(".Ldt-CtrlPlay").attr("title", "Play");
    81     this.selector.find(".Ldt-CtrlPlay").attr("title", "Play");
    80    
    82    
    81     // we use templToHTML because it has some predefined
    83     // we use templToHTML because it has some predefined
    82     // vars like where to get the images
    84     // vars like where to get the images
    83     var templ = IriSP.templToHTML("url({{img_dir}}/pause_sprite.png)");
    85     var templ = IriSP.templToHTML("url({{img_dir}}/play_sprite.png)");
    84     this.selector.find(".Ldt-CtrlPlay").css("background-image", templ);
    86     this.selector.find(".Ldt-CtrlPlay").css("background-image", templ);
    85 
    87 
    86   } else {
    88   } else {
    87     this.selector.find(".Ldt-CtrlPlay").attr("title", "Pause");
    89     this.selector.find(".Ldt-CtrlPlay").attr("title", "Pause");
    88 
    90 
    89     // we use templToHTML because it has some predefined
    91     // we use templToHTML because it has some predefined
    90     // vars like where to get the images
    92     // vars like where to get the images
    91     var templ = IriSP.templToHTML("url({{img_dir}}/play_sprite.png)");
    93     var templ = IriSP.templToHTML("url({{img_dir}}/pause_sprite.png)");
    92     this.selector.find(".Ldt-CtrlPlay").css("background-image", templ);
    94     this.selector.find(".Ldt-CtrlPlay").css("background-image", templ);
    93   }  
    95   }  
       
    96 
       
    97   return;
    94 };
    98 };
    95 
    99 
    96 
   100 
    97 IriSP.PlayerWidget.prototype.playHandler = function() {
   101 IriSP.PlayerWidget.prototype.playHandler = function() {
    98   var status = this._Popcorn.media.paused;
   102   var status = this._Popcorn.media.paused;
    99   
       
   100   this.playButtonUpdater();
       
   101   
   103   
   102   if ( status == true ){        
   104   if ( status == true ){        
   103     this._Popcorn.play();   
   105     this._Popcorn.play();   
   104   } else {
   106   } else {
   105     this._Popcorn.pause();
   107     this._Popcorn.pause();