Update Custom SwfPath in PlayerLdt parameter
authorsamuel huron <admin@cybunk.com>
Mon, 14 Jun 2010 11:18:22 +0200
changeset 37 b694a7a67500
parent 36 0df13ef0a63c
child 38 bd3021d0d2e6
Update Custom SwfPath in PlayerLdt parameter playerLdt(550,310, "{{ json_url }}","{{ player_id }}", "{{absolute_url_to_player.swf}}");
web/static/js/LdtPlayer.js
--- a/web/static/js/LdtPlayer.js	Mon Jun 14 10:03:42 2010 +0200
+++ b/web/static/js/LdtPlayer.js	Mon Jun 14 11:18:22 2010 +0200
@@ -146,14 +146,15 @@
 		if (tmp) { tmp.innerHTML = "volume: " + currentVolume; }
 	}
 
-	function createPlayer(width,height,url) {
+	function createPlayer(width,height,url,duration,streamerPath,MySwfPath) {
 	
 		myUrlFragment = url.split("/");
 		//
 		file = myUrlFragment[myUrlFragment.length-3]+"/"+myUrlFragment[myUrlFragment.length-2]+"/"+myUrlFragment[myUrlFragment.length-1];
 		indexofff = url.lastIndexOf(file);
-		streamer = url.substr(0,indexofff);
-		alert(url+"="+streamer+" - "+file);
+		streamer = streamerPath;
+		//alert(" StreamerPath : "+streamer+" - "+file);
+		//alert(" SwfPath : "+MySwfPath);
 		
 		var flashvars = {
 			streamer:streamer,
@@ -174,7 +175,7 @@
 			name:"Ldtplayer1"
 		}
 
-		swfobject.embedSWF("swf/player.swf", "ldtPlaceHolder", width, height, "9.0.115", false, flashvars, params, attributes);
+		swfobject.embedSWF(MySwfPath, "ldtPlaceHolder", width, height, "9.0.115", false, flashvars, params, attributes);
 	}
 	
 
@@ -194,7 +195,7 @@
 	var playerLdtWidth;
 	var playerLdtHeight;
 	
-	function loadJson (width,height,urlJson){
+	function loadJson (width,height,urlJson,MySwfPath){
 		
 		playerLdtWidth=width;
 		playerLdtHeight=height;
@@ -215,7 +216,8 @@
 						//});
 						$jIRI("<div></div>").appendTo("#output");
 						MyMedia = new  Media(json.medias[0].id,json.medias[0].href,json.medias[0]["meta"]["dc:duration"],json.medias[0]['dc:title'],json.medias[0]['dc:description']);
-						MyMedia.createPlayer(playerLdtWidth,playerLdtHeight);
+						//alert(" MySwfPath : "+MySwfPath);
+						MyMedia.createPlayer(playerLdtWidth,playerLdtHeight,json.medias[0]["meta"]["item"]["value"],MySwfPath);
 						//alert("success loading ! "+json.medias[0]["meta"]["dc:duration"]+ " | " +json.medias[0]["meta"]["item"]["value"]);
 						
 						/* # créer lignes 				   */
@@ -272,13 +274,10 @@
 INIT player LDT  
 */
 
-	function playerLdt (width,height,file,divId){
-	
-		//$jIRI("#playerLdt").append("<div id=\"div1\">hello</div>");
-		
+	function playerLdt (width,height,file,divId,MySwfPath){
 		
 			$jIRI("#"+divId).append("<div id=\"ldtShow\">\n	<div id=\"ShowAnnotation\" class=\"demo\" >\n			<div id=\"ldtSaTitle\"></div>\n			<div id=\"ldtSaDescription\"></div>\n		</div>		<div id=\"ldtPlaceHolder\">\n			<a href=\"http://www.adobe.com/go/getflashplayer\">Get flash</a> to see this player	\n		</div>\n	</div>\n	<div id=\"controlerLdt\" class=\"demo\">\n		<div class=\"ldtControl1\" >\n			<button id=\"ldtCtrlPlay\" onclick=\"player.sendEvent('PLAY')\">Play</button>\n			<button id=\"ldtCtrlNext\" onclick=\"player.sendEvent('SEEK', currentPosition+10)\">next</button>\n		</div>\n		<div id=\"Annotations\" class=\"ui-slider\">\n			<div id=\"slider-range-min\"></div>\n		</div>\n		<div class=\"ldtControl2\">\n			<button id=\"ldtCtrlScreen\" onclick=\"player.fullscreen('true')\">Enlarge</button>\n			<button id=\"ldtCtrlSound\" onclick=\"player.sendEvent('MUTE')\">Sound</button>\n		</div>\n	</div>");
-			loadJson(width,height,file);
+			loadJson(width,height,file,MySwfPath);
 	}
 	
 	
@@ -331,8 +330,9 @@
 		trace("- content : color",url);
 		trace("- content : audio",title);
 	}
-	function createPlayerMedia(width,height){
-		createPlayer(width,height,this.url,this.duration);
+	function createPlayerMedia(width,height,MyStreamer,MySwfPath){
+		//alert("create swfpath : "+MySwfPath+" my streame : "+MyStreamer);
+		createPlayer(width,height,this.url,this.duration,MyStreamer,MySwfPath);
 		createInterface(width,height,this.duration);
 	}
 	function updatePlayerMedia(){