first version of the youtube compatible player. nih-youtube
authorhamidouk
Tue, 31 Jan 2012 16:54:08 +0100
branchnih-youtube
changeset 755 d60401f66984
parent 754 b119a956b647
child 756 f971fb0f2a3e
first version of the youtube compatible player.
src/js/players/player.youtube.js
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/js/players/player.youtube.js	Tue Jan 31 16:54:08 2012 +0100
@@ -0,0 +1,35 @@
+/* To wrap a player the develop should create a new class derived from 
+   the IriSP.PopcornReplacement.player and defining the correct functions */
+
+/** youtube player wrapper */
+IriSP.PopcornReplacement.youtube = function(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 */
+  
+  /* 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); }
+  }
+
+  
+  options.events = this.callbacks;
+  var params = { allowScriptAccess: "always" };
+  var atts = { id: "ytplayer" };
+  swfobject.embedSWF("http://www.youtube.com/v/QH2-TGUlwu4?enablejsapi=1&playerapiid=ytplayer&version=3",
+                     container, "425", "356", "8", null, null, params, atts);
+
+};
+
+IriSP.PopcornReplacement.jwplayer.prototype = new IriSP.PopcornReplacement.player("", {});
+
+IriSP.PopcornReplacement.jwplayer.prototype.stateHandler = function(state) {
+
+};
\ No newline at end of file