client/player/SRC/js/LdtPlayer.js
author hurons
Fri, 06 Aug 2010 12:50:43 +0200
changeset 28 44c6b827825d
permissions -rw-r--r--
Commit new player (version radio) with new path organisation
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
28
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
     1
/* ----------------------------------------------------------------
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
     2
   ----------------------------------------------------------------
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
     3
   ----------------------------------------------------------------
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
     4
   
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
     5
	LDTPlayer is created by http://www.iri.centrepompidou.fr
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
     6
	2010-06-14 - version 0.08
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
     7
	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
     8
	init By Samuel Huron < samuel.huron (at) cybunk (dot) com >
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
     9
	use JQUERY 			-	Compatible v1.3.2 :: Optimal 1.4
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    10
	use TOOLTIP FOR JQ	- 
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    11
	use JQUERY UI 		-	for theme management
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    12
	use JWPLAYER 		-	but you can change it with other things
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    13
	use Media Fragment 	- 	inspired by HTML5 exemple from Silvia Pfeiffer
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    14
	for #t=  //	http://annodex.net/~silvia/itext/mediafrag.html
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    15
	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    16
	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    17
	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    18
	TODO : ////////////////////////////////////////
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    19
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    20
	- ajouter le share embed 
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    21
	- gestion cr�er une annotation simple 
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    22
	- bouton graphique design : pause / stop
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    23
	- gestion des tags 
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    24
	- creation du mode radio 
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    25
	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    26
   ----------------------------------------------------------------
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    27
*/
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    28
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    29
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    30
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    31
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    32
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    33
/* ----------------------------------------------------------------
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    34
   ----------------------------------------------------------------
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    35
	INIT player LDT  */
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    36
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    37
	//LdtShareTool = "<!-- AddThis Button BEGIN -->\n <div class='addthis_toolbox addthis_default_style'> \n<a href='http://www.addthis.com/bookmark.php?v=250&amp;username=xa-4c349bb933426b8c' class='addthis_button_compact'>Share</a><span class='addthis_separator'>|</span> \n <a class='addthis_button_facebook'></a> \n <a class='addthis_button_myspace'></a> \n <a class='addthis_button_google'></a> \n <a class='addthis_button_twitter'></a> \n </div> \n <script type='text/javascript' src='http://s7.addthis.com/js/250/addthis_widget.js#username=xa-4c349bb933426b8c'></script>/n<!-- AddThis Button END -->";
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    38
	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    39
	LdtShareTool = ""+
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    40
				 "\n<a onclick=\"LdtApiPlayer.share('delicious');\" title='partager avec delicious'><span class='share shareDelicious'>&nbsp;</span></a>"+		
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    41
				 "\n<a onclick=\"LdtApiPlayer.share('facebook');\" title='partager avec facebook'> <span class='share shareFacebook'>&nbsp;</span></a>"+
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    42
				 "\n<a onclick=\"LdtApiPlayer.share('twitter');\" title='partager avec twitter'>  <span class='share shareTwitter'>&nbsp;</span></a>"+
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    43
				 "\n<a onclick=\"LdtApiPlayer.share('myspace');\" title='partager avec Myspace'>  <span class='share shareMySpace'>&nbsp;</span></a>"+
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    44
				 "\n<a onclick=\"LdtApiPlayer.share('jamespot');\" title='partager avec JamesPot'>  <span class='share shareJamesPot'>&nbsp;</span></a>";
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    45
	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    46
	var DIVROOTID;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    47
	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    48
	function playerLdt (width,height,file,divId,MySwfPath,AudioVideo){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    49
		
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    50
		if (AudioVideo==true){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    51
		// VIDEO 
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    52
			$jIRI("#"+divId).append("<div id=\"Ldt-Root\"><div id=\"ldt-Show\">\n	<div id=\"Ldt-ShowAnnotation-video\" class=\"demo\" >\n	<div id=\"Ldt-SaTitle\"></div>\n	<div id=\"Ldt-SaDescription\"></div>\n <div style='text-align:right; float:right;' >\n \n "+LdtShareTool+"\n \n <div onclick=\"$jIRI('#Ldt-ShowAnnotation').slideUp();\" style='color:#ffffff;float:right;padding-right:10px;padding-left:10px;padding-bottom:5px;' >X</div>	</div>		</div>		<div id=\"Ldt-PlaceHolder\">\n			<a href=\"http://www.adobe.com/go/getflashplayer\">Get flash</a> to see this player	\n		</div>\n	</div>\n	<div id=\"Ldt-controler\" class=\"demo\">\n		<div class=\"Ldt-Control1\" >\n			<button id=\"ldt-CtrlPlay\" onclick=\"LdtApiPlayer.play()\">Play</button>\n			<button id=\"ldt-CtrlNext\" onclick=\"LDTligne.nextAnnotation()\">next</button>\n		</div>\n		<div id=\"Ldt-Annotations\" class=\"ui-slider\">\n			<div id=\"slider-range-min\"></div>\n		</div>\n		<div class=\"Ldt-Control2\">\n			<button id=\"ldt-CtrlLink\" onclick=\"LdtApiPlayer.share()\">Share</button>\n			<button id=\"ldt-CtrlSound\" onclick=\"LdtApiPlayer.mute()\">Sound</button>\n</div>\n	</div><div class='cleaner'>&nbsp;</div></div>");
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    53
			
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    54
		} else {
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    55
		// AUDIO  
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    56
		$jIRI("#"+divId).append("<div id=\"Ldt-Root\"><div id=\"Ldt-PlaceHolder\" style=\"visibility:hidden;height:0px;display:none;\">\n			<a href=\"http://www.adobe.com/go/getflashplayer\">Get flash</a> to see this player	\n		</div>\n		<div id=\"Ldt-controler\" class=\"demo\">\n		<div class=\"Ldt-Control1\" >\n			<button id=\"ldt-CtrlPlay\" onclick=\"LdtApiPlayer.play()\">Play</button>\n			<button id=\"ldt-CtrlNext\" onclick=\"LDTligne.nextAnnotation()\">next</button>\n		</div>\n		<div id=\"Ldt-Annotations\" class=\"ui-slider\">\n			<div id=\"slider-range-min\"></div>\n		</div>\n		<div class=\"Ldt-Control2\">\n			<button id=\"ldt-CtrlLink\" onclick=\"LdtApiPlayer.share()\">Share</button>\n			<button id=\"ldt-CtrlSound\" onclick=\"LdtApiPlayer.mute()\">Sound</button>\n		</div>\n <div class='cleaner'>&nbsp;</div> \n <div id=\"Ldt-Show-Arrow-container\"> <div id=\"Ldt-Show-Arrow\"> </div> <!--<div id=\"Ldt-Show-Tags\" style=\"background-color:#000;width:10px;\">xx </div> --> </div>\n	</div> <div>	<div id=\"ldt-Show\">\n	</div>\n<div id=\"Ldt-ShowAnnotation-audio\" class=\"demo\" >\n	<div id=\"Ldt-SaTitle\"></div>\n	<div id=\"Ldt-SaDescription\"></div>\n <div class='cleaner'>&nbsp;</div></div>\n<div id=\"Ldt-SaKeyword\">\n<div id=\"Ldt-SaKeywordText\" style='text-align:left; float:left;font-size:10px;width:500px;' >  </div>\n <div class='cleaner'>&nbsp;</div> <div style='text-align:right; float:right;' >\n \n "+LdtShareTool+"\n \n <!--<div onclick=\"$jIRI('#Ldt-ShowAnnotation').slideUp();\" style='color:#8c8a8c;float:right;padding-right:10px;padding-left:10px;padding-bottom:5px;' >X</div>	--> </div>\n <div class='cleaner'>&nbsp;</div></div>  <div id=\"Ldt-Tags\" style=\"display:none;\" > My tags </div></div>  <div id=\"output\" class=\"demo\"  style=\"display:none;\"></div>");
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    57
		}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    58
		//DIVROOTID=divId;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    59
		//$jIRI("#Ldt-Root").css('visibility','hidden');
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    60
		//$jIRI("#Ldt-Root").css('display','none');
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    61
		loadJson(width,height,file,MySwfPath);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    62
	}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    63
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    64
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    65
	/*
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    66
	$('#loading').ajaxStart(function() {
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    67
		$(this).show();
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    68
		$('#result').hide();
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    69
	}).ajaxStop(function() {
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    70
		$(this).hide();
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    71
		$('#result').fadeIn('slow');
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    72
	}); 
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    73
	*/
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    74
	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    75
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    76
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    77
/* ----------------------------------------------------------------
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    78
   ----------------------------------------------------------------
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    79
	LOAD JSON AND PARSE IT 	*/
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    80
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    81
	var MyLdt;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    82
	var MyTags;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    83
	var Durration;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    84
	var playerLdtWidth;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    85
	var playerLdtHeight;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    86
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    87
	$('#log').ajaxError(function(event, request, settings){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    88
		$(this).append("<li>Error requesting page " + settings.url + "</li>");
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    89
	});
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    90
	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    91
	function loadJson (width,height,urlJson,MySwfPath){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    92
		
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    93
		playerLdtWidth=width;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    94
		playerLdtHeight=height;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    95
		
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    96
		$jIRI.ajax({
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    97
					  dataType: 'jsonp',
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    98
					  url:urlJson,
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    99
					  success : function(json){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   100
					  
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   101
						//alert("ICI : "+json);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   102
						
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   103
						if(json == ""){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   104
							alert("ERREUR DE CHARGEMENT JSON");
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   105
						} else {
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   106
						  
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   107
						  
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   108
							/* # CREATE MEDIA  							*/
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   109
							/* # JUSTE ONE PLAYER FOR THE MOMENT		*/
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   110
							$jIRI("<div></div>").appendTo("#output");
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   111
							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']);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   112
							MyMedia.createPlayer(playerLdtWidth,playerLdtHeight,json.medias[0]["meta"]["item"]["value"],MySwfPath);	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   113
							
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   114
							/* # CREATE THE FIRST LINE  				*/
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   115
							MyLdt = new Ligne (json['annotation-types'][0].id,json['annotation-types'][0]['dc:title'],json['annotation-types'][0]['dc:description'],json.medias[0]["meta"]["dc:duration"]);			
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   116
							
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   117
							/* CREATE THE TAG CLOUD 					*/
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   118
							MyTags =  new Tags (json.tags);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   119
						
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   120
							/* CREATE THE ANNOTATIONS  				    */
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   121
							/* JUSTE FOR THE FIRST TYPE   			 	*/
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   122
							$jIRI.each(json.annotations, function(i,item) {
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   123
								if (item.meta['id-ref'] == MyLdt.id) {
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   124
									MyLdt.addAnnotation(
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   125
												item.id,
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   126
												item.begin,
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   127
												item.end,
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   128
												item.media,
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   129
												item.content.title,
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   130
												item.content.description,
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   131
												item.content.color,
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   132
												item.tags);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   133
										}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   134
									MyTags.addAnnotation(item);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   135
							});	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   136
							$jIRI.each(json.lists, function(i,item) {
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   137
								trace("lists","");
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   138
							});	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   139
							$jIRI.each(json.views, function(i,item) {
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   140
								trace("views","");
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   141
							});	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   142
							/* END PARSING ----------------------- */
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   143
						}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   144
										
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   145
					},error : function(data){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   146
						  alert("ERROR : "+data);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   147
					}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   148
				  });	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   149
	}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   150
	function callbackLdts(json){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   151
	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   152
		alert("CALLBACK");
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   153
		
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   154
	}	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   155
	function trace (msg,value){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   156
		$jIRI("<div>"+msg+" : "+value+"</div>").appendTo("#output");
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   157
	}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   158
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   159
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   160
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   161
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   162
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   163
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   164
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   165
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   166
/* ----------------------------------------------------------------
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   167
   ----------------------------------------------------------------
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   168
	Class Media */
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   169
/*
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   170
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   171
		"http://advene.liris.cnrs.fr/ns/frame_of_reference/ms":"o=0",
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   172
		"id":"kia_closeup",
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   173
		"url":"D:/Thibaut/Outils_techno/IRI-LignesDeTemps/media/video/kia_closeup_BQ.flv",
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   174
		"dc:creator":"tcavalie",
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   175
		"dc:created":"2010-05-04T00:00:00",
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   176
		"dc:contributor":"tcavalie",
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   177
		"dc:modified":"2010-05-04T00:00:00",
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   178
		"dc:creator.contents":"Abbas Kiarostami",
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   179
		"dc:created.contents":"1990",
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   180
		"dc:title":"Close Up is a very very long title",
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   181
		"dc:description":"Analyse de Close Up",
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   182
		"dc:duration":"689266"
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   183
	*/
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   184
	function Media (id,url,duration,title,description){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   185
		this.id 		 = id;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   186
		this.url 		 = url;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   187
		this.title 		 = title;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   188
		this.description = description;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   189
		this.duration 	 = duration;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   190
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   191
		this.lignes 	  = new Array();
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   192
		this.updatePlayer = updatePlayerMedia;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   193
		this.getDuration  = getMediaDuration;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   194
		this.createPlayer = createPlayerMedia;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   195
		
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   196
		trace("Media ID :",id);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   197
		trace("Media URL :",this.url);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   198
		trace("- content : color",url);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   199
		trace("- content : audio",title);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   200
	}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   201
	function createPlayerMedia(width,height,MyStreamer,MySwfPath){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   202
		LdtApiPlayer = new APIplayer(width,height,this.url,this.duration,MyStreamer,MySwfPath);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   203
		//createPlayer(width,height,this.url,this.duration,MyStreamer,MySwfPath);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   204
	}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   205
	function updatePlayerMedia(){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   206
		
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   207
	}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   208
	function getMediaDuration(){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   209
		return (this.duration);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   210
	}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   211
	function getMediaTitle(){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   212
		return (this.title);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   213
	}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   214
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   215
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   216
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   217
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   218
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   219
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   220
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   221
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   222
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   223
/* ----------------------------------------------------------------
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   224
   ----------------------------------------------------------------
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   225
	INTERFACE : SLIDER ( CONTROL BAR ) | BUTTON ()   */
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   226
	function createInterface (width,height,duration){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   227
		
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   228
		//$jIRI("#Ldt-Root").css('display','visible');
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   229
		trace("CREATE INTERFACE ",width+","+height+","+duration+",");
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   230
		
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   231
		$jIRI(function() {		
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   232
			$jIRI("#Ldt-Annotations").width(width-(75*2));
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   233
			$jIRI("#Ldt-Show-Arrow-container").width(width-(75*2));
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   234
			//$jIRI("#Ldt-Show-Arrow-container").width(width-(75*2));
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   235
			$jIRI("#Ldt-ShowAnnotation-audio").width(width-10);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   236
			$jIRI("#Ldt-ShowAnnotation-video").width(width-10);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   237
			$jIRI("#Ldt-SaKeyword").width(width-10);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   238
			$jIRI("#Ldt-controler").width(width-10);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   239
			$jIRI("#Ldt-Control").attr("z-index","100");
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   240
			
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   241
			 $jIRI("#Ldt-ShowAnnotation").click(function () { 
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   242
				 //$jIRI(this).slideUp(); 
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   243
			});
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   244
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   245
			var LdtpPlayerY = $jIRI("#Ldt-PlaceHolder").attr("top");
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   246
			var LdtpPlayerX = $jIRI("#Ldt-PlaceHolder").attr("left");
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   247
			
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   248
			$jIRI("#slider-range-min").slider({ //range: "min",
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   249
				value: 0,
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   250
				min: 1,
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   251
				max: duration/1000,//1:54:52.66 = 3600+3240+
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   252
				step: 0.1,
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   253
				slide: function(event, ui) {
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   254
					
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   255
					//$jIRI("#amount").val(ui.value+" s");
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   256
					//player.sendEvent('SEEK', ui.value)
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   257
					LdtApiPlayer.seek(ui.value);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   258
					//changePageUrlOffset(ui.value);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   259
					//player.sendEvent('PAUSE')
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   260
				}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   261
			});
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   262
			$jIRI("#amount").val($jIRI("#slider-range-min").slider("value")+" s");
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   263
			
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   264
			$jIRI(".Ldt-Control1 button:first").button({
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   265
				icons: {
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   266
					primary: 'ui-icon-play'
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   267
				},
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   268
				text: false
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   269
			}).next().button({
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   270
				icons: {
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   271
					primary: 'ui-icon-seek-next'
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   272
				},
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   273
				 text: false
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   274
			});
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   275
			
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   276
			$jIRI(".Ldt-Control2 button:first").button({
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   277
				icons: {
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   278
					primary: 'ui-icon-transferthick-e-w'//,
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   279
					//secondary: 'ui-icon-volume-off'
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   280
				},
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   281
				text: false
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   282
			}).next().button({
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   283
				icons: {
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   284
					primary: 'ui-icon-volume-on'
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   285
				},
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   286
				 text: false
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   287
			});
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   288
		
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   289
			// version radio 
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   290
			//$jIRI("#Ldtplayer1").css('display','none');
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   291
			//$jIRI("#Ldt-Root").show();
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   292
			MyTags.draw();
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   293
		});	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   294
	}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   295
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   296
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   297
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   298
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   299
/* ----------------------------------------------------------------
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   300
   ----------------------------------------------------------------
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   301
	UTIL */
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   302
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   303
// code from http://stackoverflow.com/questions/822452/strip-html-from-text-javascript
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   304
	function stripHtml(s)
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   305
	{
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   306
		return s.replace(/\\&/g, '&amp;').replace(/\\</g, '&lt;').replace(/\\>/g, '&gt;').replace(/\\t/g, '&nbsp;&nbsp;&nbsp;').replace(/\\n/g, '<br />').replace(/'/g, '&#39;').replace(/"/g, '&quot;');
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   307
	}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   308
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   309
/*   Conversion de couleur Decimal vers HexaDecimal || 000 si fff */
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   310
	function DEC_HEXA_COLOR(dec)
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   311
	{
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   312
		 var hexa='0123456789ABCDEF',hex=''
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   313
		 while (dec>15)
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   314
		 {
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   315
			  tmp = dec-(Math.floor(dec/16))*16;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   316
			  hex = hexa.charAt(tmp)+hex;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   317
			  dec = Math.floor(dec/16);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   318
		 }
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   319
		 hex = hexa.charAt(dec)+hex;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   320
		 if (hex == "FFCC00"){ hex="";/* by default color of Ldt annotation */ }
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   321
		 return(hex);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   322
	}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   323
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   324
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   325
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   326
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   327
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   328
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   329
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   330
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   331
/* ----------------------------------------------------------------
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   332
   ----------------------------------------------------------------
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   333
	API player - work in progress */ 
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   334
	function APIplayer (width,height,url,duration,streamerPath,MySwfPath){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   335
		
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   336
		this.player 			= null;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   337
		this.hashchangeUpdate 	= null;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   338
		
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   339
		this.width				= width;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   340
		this.height				= height;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   341
		this.url				= url;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   342
		this.duration			= duration;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   343
		this.streamerPath		= streamerPath;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   344
		this.MySwfPath			= MySwfPath;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   345
		
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   346
		this.pause 				= APIpPause;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   347
		this.ready				= APIpReady;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   348
		this.play 				= APIpPlay;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   349
		this.seek 				= APIpSeek;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   350
		this.update				= APIpUpdate;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   351
		this.mute				= APIpMute;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   352
		this.share				= APIpShare;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   353
		MyApiPlayer				= this;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   354
		
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   355
		createPlayer(width,height,this.url,this.duration,this.streamerPath,this.MySwfPath);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   356
		
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   357
	}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   358
	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   359
	function APIpCreate(){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   360
		
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   361
	}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   362
	function APIpReady(player){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   363
		//alert("ready");
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   364
		createInterface(this.width,this.height,this.duration);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   365
		this.player	= player;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   366
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   367
		// hashchange EVENT
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   368
		if (window.addEventListener){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   369
		// pour FIREFOX  hashchange EVENT
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   370
			window.addEventListener("hashchange", function() {
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   371
			  var url = location.href;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   372
			  var time = retrieveTimeFragment(url);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   373
			  trace("hashchange",time);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   374
			  if(LdtApiPlayer.hashchangeUpdate==null){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   375
				LdtApiPlayer.seek(time);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   376
			  }else{
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   377
				LdtApiPlayer.hashchangeUpdate=null;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   378
			  }
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   379
			}, false);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   380
		 
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   381
		} 
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   382
		else if (window.attachEvent){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   383
		// FOR IE hashchange EVENT
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   384
			window.attachEvent("onhashchange", function() {
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   385
			  trace("hashchange",time);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   386
			  var url = location.href;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   387
			  var time = retrieveTimeFragment(url);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   388
			  if(LdtApiPlayer.hashchangeUpdate==null){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   389
				LdtApiPlayer.seek(time);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   390
			  }else{
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   391
				LdtApiPlayer.hashchangeUpdate=null;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   392
			  }
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   393
			}, false);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   394
		}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   395
		
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   396
	}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   397
	function APIpPause(){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   398
		this.hashchangeUpdate = true;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   399
		this.player.sendEvent('PAUSE');
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   400
	}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   401
	function APIpPlay(){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   402
		this.hashchangeUpdate = true;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   403
		this.player.sendEvent('PLAY');
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   404
	}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   405
	function APIpMute(){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   406
		this.player.sendEvent('MUTE');
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   407
	}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   408
	function APIpShare(network){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   409
	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   410
		MyMessage = "Je regarde :";
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   411
		MyURLNow = window.location.href;	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   412
		//alert(network+" : "+MyURLNow);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   413
		
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   414
		if(network == "facebook"){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   415
		 
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   416
		 //window.title = 
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   417
		 
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   418
				shareURL = "http://www.facebook.com/share.php?u=";			
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   419
				//http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.addthis.com%2F%3Fsms_ss%3Dfacebook
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   420
		 
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   421
			}else if(network == "twitter"){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   422
			
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   423
				shareURL  = "http://twitter.com/home?status="+MyMessage;	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   424
		
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   425
			}else if(network == "myspace"){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   426
				shareURL ="http://www.myspace.com/Modules/PostTo/Pages/?u=";
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   427
			
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   428
			}else if(network == "delicious"){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   429
				shareURL = "http://delicious.com/save?url=";
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   430
			
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   431
			}else if(network == "JamesPot"){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   432
			alert(network+" non actif pour l'instant : "+MyURLNow);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   433
			
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   434
		}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   435
		
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   436
		window.location.href = shareURL+encodeURIComponent(MyURLNow);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   437
	}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   438
	function APIpSeek(time){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   439
		this.player.sendEvent('SEEK', time);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   440
		changePageUrlOffset(time);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   441
	}	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   442
	function APIpUpdate(time){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   443
		this.hashchangeUpdate = true;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   444
		this.player.sendEvent('SEEK', time);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   445
	}	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   446
	function changePageUrlOffset(time) {
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   447
	  trace("changeURL",time);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   448
      // update page url
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   449
	  location.hash = "#t=" + time;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   450
      //document.displayurl.offseturl.value = location.href;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   451
      window.location.href = location.href;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   452
    }
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   453
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   454
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   455
	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   456
/* ----------------------------------------------------------------
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   457
   ----------------------------------------------------------------
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   458
	CREER JW PLAYER  creation + listener */
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   459
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   460
	var currentPosition = 0; 
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   461
	var currentVolume   = 50; 
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   462
	var player 			= null;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   463
	var startPosition 	= null;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   464
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   465
	function playerReady(thePlayer) {
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   466
		
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   467
		player = window.document[thePlayer.id];
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   468
		LdtApiPlayer.ready(player);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   469
		trace("PLAYER READY ","");
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   470
		var url = location.href;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   471
		var time = retrieveTimeFragment(url);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   472
		trace("PLAYER READY SEEK IF NEEDED",time);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   473
		startPosition = time;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   474
		addListeners();	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   475
	}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   476
	function addListeners() {
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   477
		if (player) { 
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   478
			player.addModelListener("TIME", "positionListener");
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   479
			player.addControllerListener("VOLUME", "volumeListener");
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   480
			player.addModelListener('STATE', 'stateMonitor');
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   481
			//http://developer.longtailvideo.com/trac/wiki/Player5Events
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   482
		} else {
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   483
			setTimeout("addListeners()",100);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   484
		}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   485
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   486
		// et changer les boutons
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   487
	}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   488
	function stateMonitor(obj) { 
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   489
	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   490
		 if(obj.newstate == 'PAUSED')
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   491
        {
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   492
			trace("PAUSE : ","");
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   493
			changePageUrlOffset(currentPosition);			
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   494
			
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   495
		} else if (obj.newstate == 'PLAYING'){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   496
			// une fois la video prete a lire  la d�placer au bon timecode 
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   497
			if(startPosition!=null){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   498
				LdtApiPlayer.update(startPosition);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   499
				startPosition = null;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   500
			}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   501
		} else if (obj.newstate == 'BUFFERING'){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   502
			trace("BUFFERING : ","");
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   503
			//changePageUrlOffset(currentPosition);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   504
		}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   505
		
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   506
	}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   507
	function positionListener(obj) { 
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   508
		currentPosition = obj.position; 
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   509
		var tmp = document.getElementById("posit");
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   510
		if (tmp) { tmp.innerHTML = "position: " + currentPosition; }
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   511
		$jIRI("#slider-range-min").slider("value", obj.position);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   512
		$jIRI("#amount").val(obj.position+" s");
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   513
		// afficher annotation 
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   514
		MyLdt.checkTime(currentPosition);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   515
	}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   516
	function volumeListener(obj) { 
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   517
		currentVolume = obj.percentage; 
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   518
		var tmp = document.getElementById("vol");
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   519
		if (tmp) { tmp.innerHTML = "volume: " + currentVolume; }
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   520
	}	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   521
	function createPlayer(width,height,url,duration,streamerPath,MySwfPath) {
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   522
	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   523
		myUrlFragment = url.split(streamerPath);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   524
		file = myUrlFragment[1];
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   525
		streamer = streamerPath;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   526
		
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   527
		var flashvars = {
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   528
			streamer:streamer,
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   529
			file:file, 
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   530
			//live:"true",
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   531
			autostart:"true",
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   532
			controlbar:"none"
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   533
		}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   534
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   535
		var params = {
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   536
			allowfullscreen:"true", 
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   537
			allowscriptaccess:"always",
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   538
			wmode:"transparent"
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   539
		}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   540
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   541
		var attributes = {
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   542
			id:"Ldtplayer1",  
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   543
			name:"Ldtplayer1"
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   544
		}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   545
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   546
		swfobject.embedSWF(MySwfPath, "Ldt-PlaceHolder", width, height, "9.0.115", false, flashvars, params, attributes);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   547
	}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   548
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   549
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   550
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   551
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   552
	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   553
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   554
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   555
/* ----------------------------------------------------------------
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   556
   ----------------------------------------------------------------
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   557
	MEDIA FRAGMENT FUNCTION*/
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   558
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   559
    // when the hash on the window changes, also do an offset
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   560
    // jump to time offset action
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   561
    function jumpToTimeoffset(form) {
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   562
		var time = form.time.value;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   563
		changePageUrlOffset(time);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   564
    }
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   565
    // parse the time hash out of the given url
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   566
    function retrieveTimeFragment(url) {
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   567
      var pageoffset = 0;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   568
	  var offsettime = 0;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   569
	  
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   570
      if (url.split("#")[1] != null) {
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   571
		pageoffset = url.split("#")[1];
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   572
			if (pageoffset.substring(2) != null) {
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   573
				offsettime = pageoffset.substring(2);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   574
			}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   575
		}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   576
		return offsettime;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   577
    }  
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   578
	function ignoreTimeFragment(url){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   579
	 if (url.split("#")[1] != null) {
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   580
	 pageurl= url.split("#")[0];
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   581
	 }
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   582
	 return pageurl;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   583
	}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   584
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   585
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   586
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   587
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   588
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   589
/* ----------------------------------------------------------------
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   590
   ----------------------------------------------------------------
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   591
 Class Ligne (annotationType) */
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   592
/*	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   593
		"id":"dp_1",
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   594
		"dc:creator":"tcavalie",
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   595
		"dc:created":"2010-04-04T19:09:44",
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   596
		"dc:contributor":"perso",
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   597
		"dc:modified":"15/2/2008",
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   598
		"dc:title":"dqsdkljfh qklsdhf very very very long",
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   599
		"dc:description":"sdfg sdfg sdfg sdfg"
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   600
	*/
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   601
	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   602
	var LDTligne 			= null;		
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   603
	function Ligne (){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   604
		this.id 			= id;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   605
		this.title 			= title;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   606
		this.description 	= description;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   607
		this.annotations 	= new Array();
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   608
		this.annotationOldRead = "";
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   609
		this.addAnnotation  = addAnnotationligne;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   610
		this.clickAnnotation= onClickLigneAnnotation;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   611
		this.checkTime 		= checkTimeLigne;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   612
		this.nextAnnotation	= onClickNextAnnotation;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   613
	}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   614
	function Ligne (id,title,description,duration){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   615
		this.id 		 = id;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   616
		this.title 		 = title;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   617
		this.description = description;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   618
		//
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   619
		this.annotations = new Array();
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   620
		this.addAnnotation = addLigneAnnotation;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   621
		this.checkTime 	= checkTimeLigne;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   622
		this.nextAnnotation	= onClickNextAnnotation;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   623
		this.numAnnotation = numAnnotationTimeLine;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   624
		this.duration = duration;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   625
		LDTligne = this;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   626
		trace("LIGNE  ","cr�er "+LDTligne);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   627
	}	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   628
	function addLigneAnnotation(id,begin,end,media,title,description,color,tags){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   629
		var myAnnotation = new Annotation(id,begin,end,media,title,description,color,tags,this.duration);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   630
		this.annotations.push(myAnnotation);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   631
		trace("LIGNE  ","add annotation ");
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   632
	}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   633
	function onClickLigneAnnotation(id){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   634
		//changePageUrlOffset(currentPosition);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   635
		//player.sendEvent('SEEK', this.start);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   636
		//trace("SEEK",this.start);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   637
	}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   638
	function searchLigneAnnotation(id){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   639
		/*for (){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   640
		}*/
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   641
	}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   642
	function listAnnotations (){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   643
	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   644
	}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   645
	function onClickNextAnnotation(){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   646
		var annotationCibleNumber = this.numAnnotation(this.annotationOldRead)+1;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   647
		var annotationCible = this.annotations[annotationCibleNumber];
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   648
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   649
		if(annotationCibleNumber<this.annotations.length-1){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   650
			annotationCible.begin
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   651
			player.sendEvent('SEEK', annotationCible.begin/1000);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   652
trace("LIGNE  ","| next = "+annotationCibleNumber+" - "+this.annotations.length+" | seek :"+annotationCible.begin/1000);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   653
		}else{
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   654
			player.sendEvent('SEEK', this.annotations[0].begin/1000);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   655
		}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   656
		
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   657
		
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   658
	}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   659
	function numAnnotationTimeLine(annotationCible){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   660
		for (var i=0; i < this.annotations.length; ++i){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   661
			if(annotationCible == this.annotations[i]){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   662
				return i;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   663
			}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   664
		}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   665
	}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   666
	function checkTimeLigne(time){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   667
		var annotationTempo = -1;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   668
		
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   669
		for (var i=0; i < this.annotations.length; ++i){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   670
			if (time>this.annotations[i].begin/1000 && time<this.annotations[i].end/1000){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   671
				var annotationTempo = this.annotations[i];	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   672
					// si diff�rentes de la pr�c�dente
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   673
					if(annotationTempo!=this.annotationOldRead){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   674
						this.annotationOldRead = annotationTempo;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   675
						//trace("Check : ","annotation ici : "+i+" title "+annotationTempo.title);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   676
						//$jIRI('#Ldt-ShowAnnotation').slideUp();
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   677
						//http://api.jquery.com/delay/  -> 1.4
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   678
						//$jIRI("#Ldt-SaTitle").delay(100).text(annotationTempo.title);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   679
						//$jIRI("#Ldt-SaDescription").delay(100).text(annotationTempo.description);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   680
						//$jIRI('#Ldt-ShowAnnotation').delay(100).slideDown();
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   681
						
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   682
						$jIRI("#Ldt-SaTitle").text(annotationTempo.title);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   683
						$jIRI("#Ldt-SaDescription").text(annotationTempo.description);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   684
						
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   685
						$jIRI("#Ldt-SaDescription").text(annotationTempo.description);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   686
						$jIRI("#Ldt-SaKeywordText").html(annotationTempo.htmlTags);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   687
						
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   688
						$jIRI('#Ldt-ShowAnnotation').slideDown();
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   689
						
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   690
						
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   691
						startPourcent 	= timeToPourcent((annotationTempo.begin*1+(annotationTempo.end-annotationTempo.begin)/2),annotationTempo.duration); 
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   692
						
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   693
						$jIRI("#Ldt-Show-Arrow").css('left',startPourcent+'%');
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   694
						//alert(moyennePosition);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   695
						var tempolinkurl  =  ignoreTimeFragment(window.location.href)+"#t="+(this.annotations[i].begin/1000);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   696
					}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   697
				break;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   698
			} 
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   699
			
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   700
		}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   701
		// si il y en a pas : retractation du volet 
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   702
		if( annotationTempo == -1){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   703
			if(annotationTempo!=this.annotationOldRead){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   704
				trace("Check : ","pas d'annotation ici ");
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   705
				$jIRI('#Ldt-ShowAnnotation').slideUp();
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   706
				this.annotationOldRead = annotationTempo;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   707
			}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   708
		}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   709
		
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   710
	}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   711
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   712
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   713
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   714
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   715
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   716
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   717
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   718
/* ----------------------------------------------------------------
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   719
   ----------------------------------------------------------------
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   720
  CLASSE Annotation */
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   721
/*
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   722
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   723
		"begin":"767",
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   724
		"end":"785",
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   725
		"id":"dp_1_sp_3",
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   726
		"media":"kia_closeup",
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   727
		"content": {
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   728
						"mimetype":"application/x-ldt-structured",
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   729
						"title":"mon titre",
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   730
						"description":"ma description en &lt;b&gt;gras&lt;/b&gt; .",
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   731
						"color":"16763904",
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   732
						"audio":{"src":"","mimetype":"audio/mp3","href":""}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   733
					},
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   734
		"meta":
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   735
				{
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   736
					"id-ref":"dp_1",
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   737
					"dc:creator":"tcavalie",
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   738
					"dc:created":"2010-04-04T19:09:44",
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   739
					"dc:contributor":"perso",
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   740
					"dc:modified":"9/10/2007"
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   741
				}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   742
	*/
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   743
	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   744
	function Annotation (){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   745
		this.id 			= null;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   746
		this.begin 			= null;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   747
		this.end 			= null;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   748
		this.media 			= null;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   749
		this.description	= null;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   750
		this.title 			= null;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   751
		this.color 			= null;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   752
		this.onRollOver 	= onRollOverAnnotation;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   753
		this.onClick 		= onClickAnnotation;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   754
		this.toolTip 		= rollOverAnnotation;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   755
		this.draw 			= drawAnnotation;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   756
		this.drawTags		= drawTagsAnnotation;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   757
		this.tags			= null;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   758
		trace("annotation ","r�ussi")
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   759
	}	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   760
	function Annotation (id,begin,end,media,title,description,color,tags,duration){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   761
		this.id 			= id;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   762
		this.begin 			= begin;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   763
		this.end 			= end;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   764
		this.media 			= media;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   765
		this.description 	= description;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   766
		this.title 			= title;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   767
		this.color 			= color;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   768
		this.tags			= tags;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   769
		this.htmlTags		= "";
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   770
		this.duration		= duration;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   771
		//
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   772
		this.onRollOver 	= onRollOverAnnotation;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   773
		// this.onClick 	= onClickAnnotation;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   774
		this.toolTip 		= tootTipAnnotation;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   775
		this.draw 			= drawAnnotation;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   776
		this.drawTags		= drawTagsAnnotation;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   777
		// this.show 		= showAnnotationNotice;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   778
		// draw it 
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   779
		this.draw();
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   780
		this.drawTags();
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   781
		//
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   782
		trace("Annotation created : ",id);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   783
	}	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   784
	function drawAnnotation (){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   785
		//alert (this.duration);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   786
		startPourcent 	= timeToPourcent(this.begin,this.duration); // temps du m�dia 
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   787
		endPourcent 	= timeToPourcent(this.end,this.duration)-startPourcent;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   788
		$AnnotationTemplate = "<div title='"+stripHtml(this.title)+"' id='"+this.id+"'  class='ui-slider-range ui-slider-range-min ui-widget-header iri-chapter' width='100%' style=\"left:"+startPourcent+"%; width:"+endPourcent+"%; padding-top:15px; border-left:solid 1px #aaaaaa; border-right:solid 1px #aaaaaa; background:#"+DEC_HEXA_COLOR(this.color)+";\" onClick=\"LdtApiPlayer.seek('"+Math.round(this.begin/1000)+"');$jIRI('#Ldt-ShowAnnotation').slideDown();\"    ></div> ";
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   789
		//alert(this.color+" : "+DEC_HEXA_COLOR(this.color));
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   790
		
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   791
		$toolTipTemplate = "<div class='Ldt-tooltip'>"
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   792
							+"<div class='title'>"+stripHtml(this.title)+"</div>"
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   793
							+"<div class='time'>"+this.begin+" : "+this.end+"</div>"
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   794
							+"<div class='description'>"+stripHtml(this.description)+"</div>"
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   795
							+"</div>";
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   796
		
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   797
		
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   798
		$jIRI("<div>"+$AnnotationTemplate+"</div>").appendTo("#Ldt-Annotations");
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   799
		$jIRI("#"+this.id).tooltip({ effect: 'slide'});
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   800
		
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   801
		
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   802
		$jIRI("#"+this.id).fadeTo(0,0.3);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   803
		$jIRI("#"+this.id).mouseover(function() {
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   804
			$jIRI("#"+this.id).animate({opacity: 0.6}, 5)
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   805
		}).mouseout(function(){		
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   806
			$jIRI("#"+this.id).animate({opacity: 0.3}, 5)
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   807
		});
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   808
		//trace(" ### ","ADD ANOTATION : "+this.begin+" "+this.end+" "+stripHtml(this.title)+" | "+startPourcent+" | "+endPourcent+" | duration = "+this.duration);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   809
		
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   810
	}	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   811
	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   812
	function drawTagsAnnotation(){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   813
		KeywordPattern = '<a href=\"\"> '+' </a>';
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   814
		
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   815
		//trace(" !? Tags : ",this.tags);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   816
		
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   817
		if (this.tags!=undefined){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   818
			for (var i = 0; i < this.tags.length; ++i){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   819
				
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   820
				//this.htmlTags += '<span onclick=\"ShowTag('+this.tags[i]['id-ref']+');\"  > '+MyTags.getTitle(this.tags[i]['id-ref'])+' </span>'+" , ";
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   821
				this.htmlTags += '<span> '+MyTags.getTitle(this.tags[i]['id-ref'])+' </span>'+" , ";
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   822
				
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   823
			}		
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   824
		}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   825
	}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   826
	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   827
	function tootTipAnnotation() {
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   828
		// 1 chercher le div correspondant
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   829
		// 2 y mettre les information
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   830
		return this.color + ' ' + this.type + ' apple';
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   831
	}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   832
	function onRollOverAnnotation(){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   833
		this.tootTip();
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   834
	}		
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   835
	function timeToPourcent(time,timetotal){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   836
		return (parseInt(Math.round(time/timetotal*100)));
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   837
	}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   838
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   839
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   840
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   841
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   842
/* ----------------------------------------------------------------
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   843
   ----------------------------------------------------------------
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   844
  CLASSE Tags */
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   845
function Tags (object){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   846
	this.myTags 	=	object;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   847
	this.htmlTags 	= 	null;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   848
	this.weigthMax 	= 	0;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   849
	//this.mySegments  = 	new array();
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   850
}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   851
Tags.prototype.addAnnotation = function (annotation){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   852
	for (var i = 0; i < this.myTags.length; ++i){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   853
		this.myTags[i].mySegments = new Array(); 
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   854
		if (annotation.tags!=null){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   855
			for (var j = 0; j < annotation.tags.length; ++j){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   856
				if (this.myTags[i]['id'] == annotation.tags[j]['id-ref']){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   857
					this.myTags[i].mySegments.push([annotation.begin,annotation.end,annotation.id]);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   858
					var weigthTempo = this.myTags[i].mySegments.length
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   859
					var tempo = this.myTags[i].mySegments[weigthTempo-1];
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   860
					trace (" ADD Tags : ","  "+this.myTags[i]['meta']['dc:title']+" "+this.myTags[i]['id']+" : "+tempo[0]+" - "+tempo[1]);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   861
					
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   862
					if (this.weigthMax < weigthTempo ){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   863
						this.weigthMax = weigthTempo;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   864
					}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   865
				}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   866
			}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   867
		}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   868
	}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   869
}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   870
Tags.prototype.getTitle = function (id){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   871
	for (var i = 0; i < this.myTags.length; ++i){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   872
		if(this.myTags[i]['id']==id){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   873
			return(this.myTags[i]['meta']['dc:title']);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   874
		}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   875
	}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   876
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   877
}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   878
Tags.prototype.draw = function (){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   879
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   880
	trace("########### TAG DRAW "," WELL START " );
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   881
	for (var i = 0; i < this.myTags.length; ++i){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   882
		//trace(" ADD Tags : ",this.myTags[i]['id']);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   883
		if(this.myTags[i]['id']!=null){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   884
		this.htmlTags += '<span onclick=\"MyTags.show( \''+this.myTags[i]['id']
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   885
						+'\');\" style=\"font-size:'  +((this.myTags[i].mySegments.length/this.weigthMax*10)+8)
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   886
						+'px;\" alt=\"'+this.myTags[i].mySegments.length
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   887
						+'\"> '+this.myTags[i]['meta']['dc:title']+' </span>'+' , ';
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   888
		}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   889
	}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   890
	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   891
	$jIRI('#Ldt-Tags').html(this.htmlTags);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   892
	trace("######### TAG DRAWing : "," END WMAX= "+this.weigthMax );
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   893
	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   894
}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   895
Tags.prototype.show = function (id){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   896
	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   897
	var timeStartOffsetA	=	100000000000000000000;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   898
	var timeStartOffsetB	=	100000000000000000000;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   899
	var timeEndOffsetA		=	0;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   900
	var timeEndOffsetB		=	0;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   901
	var timeStartID;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   902
	var timeEndID;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   903
	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   904
	// case 1 : seul segment 
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   905
	// case 2 : 2 ou X segments 
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   906
	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   907
	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   908
	for (var i = 0; i < this.myTags.length; ++i){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   909
		if (this.myTags[i]['id']==id){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   910
			trace("######### TAG DRAWing : "," END" );		
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   911
			
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   912
			for (var j = 0; j < this.myTags[i].mySegments.length; ++j){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   913
				if(timeStartOffset> this.myTags[i].mySegments[j][0]){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   914
					timeStartOffsetA = this.myTags[i].mySegments[j][0];
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   915
					timeStartOffsetB = this.myTags[i].mySegments[j][1];
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   916
					timeStartID		 = this.myTags[i].mySegments[j][2]
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   917
				}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   918
				if(timeStartOffset> this.myTags[i].mySegments[j][0]){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   919
					timeEndOffsetA  = this.myTags[i].mySegments[j][0];
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   920
					timeEndOffsetB  = this.myTags[i].mySegments[j][1];
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   921
					timeEndID		= this.myTags[i].mySegments[j][2]
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   922
				}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   923
			}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   924
			
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   925
		}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   926
	}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   927
	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   928
	// -------------------------------------------------
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   929
	// 
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   930
	// -------------------------------------------------
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   931
	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   932
	leftPourCent 	= timeToPourcent((timeStartOffsetA*1+(timeStartOffsetB-timeStartOffsetA)/2),MyLdt.duration); 
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   933
	WidthPourCent	= timeToPourcent((timeEndOffsetA*1+(timeEndOffsetB-timeEndOffsetA)/2),MyLdt.duration)-startPourcent; 			
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   934
	$jIRI("#Ldt-Show-Tags").css('left',leftPourCent+'%');
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   935
	$jIRI("#Ldt-Show-Tags").css('width',WidthPourCent+'%');
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   936
	// like arrow script
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   937
	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   938
	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   939
	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   940
}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   941
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   942
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   943
		
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   944
/* ----------------------------------------------------------------
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   945
   ----------------------------------------------------------------
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   946
	Class tracess */
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   947
	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   948
	function Tracer (){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   949
		
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   950
	}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   951
	function addTrace(){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   952
		
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   953
	}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   954
	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   955
	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   956