src/js/players/player.jwplayer.js
branchnew-model
changeset 914 3238d1625df9
parent 839 4357aac4eb19
child 919 972099304059
--- a/src/js/players/player.jwplayer.js	Wed Jun 06 19:36:55 2012 +0200
+++ b/src/js/players/player.jwplayer.js	Thu Jun 07 18:52:46 2012 +0200
@@ -3,26 +3,28 @@
 
 /** jwplayer player wrapper */
 IriSP.PopcornReplacement.jwplayer = function(container, options) {
-  /* appel du parent pour initialiser les structures communes à tous les players */
-  IriSP.PopcornReplacement.player.call(this, container, options);
+    /* appel du parent pour initialiser les structures communes à tous les players */
+    IriSP.PopcornReplacement.player.call(this, container, options);
   
-  this.media.duration = options.duration; /* optional */
+    this.media.duration = options.duration; /* optional */
+ 
+    var _player = jwplayer(this.container);
   
   /* Définition des fonctions de l'API -  */
-  this.playerFns = {
-    play: function() { return jwplayer(this.container).play(); },
-    pause: function() { return jwplayer(this.container).pause(); },
-    getPosition: function() { return jwplayer(this.container).getPosition(); },
-    seek: function(pos) { return jwplayer(this.container).seek(pos); },
-    getMute: function() { return jwplayer(this.container).getMute() },
-    setMute: function(p) { return jwplayer(this.container).setMute(p); },
-    getVolume: function() { return jwplayer(this.container).getVolume() / 100; },
-    setVolume: function(p) { return jwplayer(this.container).setVolume(Math.floor(100*p)); }
-  }
+    this.playerFns = {
+        play: function() { return _player.play(); },
+        pause: function() { return _player.pause(); },
+        getPosition: function() { return _player.getPosition(); },
+        seek: function(pos) { return _player.seek(pos); },
+        getMute: function() { return _player.getMute() },
+        setMute: function(p) { return _player.setMute(p); },
+        getVolume: function() { return _player.getVolume() / 100; },
+        setVolume: function(p) { return _player.setVolume(Math.floor(100*p)); }
+    }
 
-  options.events = this.callbacks;
+    options.events = this.callbacks;
 
-  jwplayer(this.container).setup(options);
+    _player.setup(options);
 };
 
 IriSP.PopcornReplacement.jwplayer.prototype = new IriSP.PopcornReplacement.player("", {});