src/js/pop.js
branchpopcorn-port
changeset 711 323205a7bd39
parent 706 a759113f6bd1
child 723 bbf9914a5f99
equal deleted inserted replaced
710:ea5f2fa37edb 711:323205a7bd39
   215 
   215 
   216 IriSP.PopcornReplacement.player.prototype.roundTime = function() {
   216 IriSP.PopcornReplacement.player.prototype.roundTime = function() {
   217   var currentTime = this.currentTime();
   217   var currentTime = this.currentTime();
   218   return Math.round(currentTime);
   218   return Math.round(currentTime);
   219 };
   219 };
   220 
       
   221 /* To wrap a player the develop should create a new class derived from 
       
   222    the IriSP.PopcornReplacement.player and defining the correct functions */
       
   223 
       
   224 /* Exemple with jwplayer */
       
   225 IriSP.PopcornReplacement.jwplayer = function(container, options) {
       
   226 
       
   227   /* appel du parent pour initialiser les structures communes à tous les players */
       
   228   IriSP.PopcornReplacement.player.call(this, container, options);
       
   229   
       
   230   this.media.duration = options.duration; /* optional */
       
   231   
       
   232   /* Définition des fonctions de l'API -  */
       
   233   this.playerFns = {
       
   234     play: function() { return jwplayer(this.container).play(); },
       
   235     pause: function() { return jwplayer(this.container).pause(); },
       
   236     getPosition: function() { return jwplayer(this.container).getPosition(); },
       
   237     seek: function(pos) { return jwplayer(this.container).seek(pos); },
       
   238     getMute: function() { return jwplayer(this.container).getMute() },
       
   239     setMute: function(p) { return jwplayer(this.container).setMute(p); }
       
   240   }
       
   241 
       
   242   options.events = this.callbacks;
       
   243 
       
   244   jwplayer(this.container).setup(options);
       
   245 };
       
   246 
       
   247 IriSP.PopcornReplacement.jwplayer.prototype = new IriSP.PopcornReplacement.player("", {});