crea/integration/metadataplayer/LdtPlayer-core.js
changeset 30 8cda6414d63e
parent 15 f1d070549d94
child 38 f19428838d3b
--- a/crea/integration/metadataplayer/LdtPlayer-core.js	Thu Jun 07 11:50:17 2012 +0200
+++ b/crea/integration/metadataplayer/LdtPlayer-core.js	Thu Jun 07 18:52:25 2012 +0200
@@ -1902,26 +1902,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("", {});
@@ -2167,8 +2169,8 @@
                 if (typeof _data.meta["dc:source"] !== "undefined" && typeof _data.meta["dc:source"].content !== "undefined") {
                     _res.source = JSON.parse(_data.meta["dc:source"].content);
                 }
-                if (typeof _data.audio !== "undefined" && _data.audio.href) {
-                    _res.audio = _data.audio;
+                if (typeof _data.content.audio !== "undefined" && _data.content.audio.href) {
+                    _res.audio = _data.content.audio;
                 }
                 return _res;
             },
@@ -2179,7 +2181,8 @@
                     end : _data.end.milliseconds,
                     content : {
                         title : _data.title,
-                        description : _data.description
+                        description : _data.description,
+                        audio : _data.audio
                     },
                     media : _source.unNamespace(_data.media.id),
                     meta : {
@@ -2192,8 +2195,7 @@
                        return {
                            "id-ref" : _source.unNamespace(_id)
                        } 
-                    }),
-                    audio : _data.audio
+                    })
                 }
             }
         },