client/player/src/js/LdtPlayer.js
author hurons
Tue, 14 Sep 2010 13:15:28 +0200
changeset 51 28d21b2123ba
parent 30 2f27e07f9974
child 53 93fac34ead58
child 54 608159aa29a6
permissions -rw-r--r--
independant JS version for the player
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
     1
/* 
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
     2
 * 	
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
     3
 *	Copyright 2010 Institut de recherche et d�innovation 
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
     4
 *	contributor(s) : Samuel Huron 
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
     5
 *	 
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
     6
 *	contact@iri.centrepompidou.fr
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
     7
 *	http://www.iri.centrepompidou.fr 
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
     8
 *	 
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
     9
 *	This software is a computer program whose purpose is to show and add annotations on a video .
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    10
 *	This software is governed by the CeCILL-C license under French law and
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    11
 *	abiding by the rules of distribution of free software. You can  use, 
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    12
 *	modify and/ or redistribute the software under the terms of the CeCILL-C
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    13
 *	license as circulated by CEA, CNRS and INRIA at the following URL
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    14
 *	"http://www.cecill.info". 
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    15
 *	
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    16
 *	The fact that you are presently reading this means that you have had
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    17
 *	knowledge of the CeCILL-C license and that you accept its terms.
28
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    18
*/
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
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    21
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    22
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    23
if(window.__IriSP === undefined ){ var __IriSP={};}
28
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    24
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    25
// Player Configuration  
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    26
__IriSP.config = {
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    27
		metadata:{
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    28
			format:'cinelab',
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    29
			src:'http://exp.iri.centrepompidou.fr/franceculture/franceculture/ldt/cljson/id/ef4dcc2e-8d3b-11df-8a24-00145ea4a2be',
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    30
			load:'jsonp'
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    31
		},
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    32
		gui:{
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    33
			width:650,
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    34
			height:0,
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    35
			mode:'radio',
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    36
			container:'LdtPlayer',
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    37
			debug:false, 
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    38
			css:'../src/css/LdtPlayer.css'
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    39
		},
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    40
		player:{
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    41
			type:'jwplayer',
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    42
			src:'../res/swf/player.swf'
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    43
		},
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    44
		module:null
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    45
	};
28
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    46
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    47
__IriSP.lib = {
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    48
			jQuery:"http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js",
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    49
			jQueryUI:"http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/jquery-ui.min.js",
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    50
			jQueryToolTip:"http://cdn.jquerytools.org/1.2.4/all/jquery.tools.min.js",
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    51
			swfObject:"http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    52
		};
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    53
		
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    54
// Player Variable
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    55
__IriSP.LdtShareTool = ""+
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    56
"\n<a onclick=\"__IriSP.MyApiPlayer.share('delicious');\" title='partager avec delicious'><span class='share shareDelicious'>&nbsp;</span></a>"+		
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    57
"\n<a onclick=\"__IriSP.MyApiPlayer.share('facebook');\" title='partager avec facebook'> <span class='share shareFacebook'>&nbsp;</span></a>"+
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    58
"\n<a onclick=\"__IriSP.MyApiPlayer.share('twitter');\" title='partager avec twitter'>  <span class='share shareTwitter'>&nbsp;</span></a>"+
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    59
"\n<a onclick=\"__IriSP.MyApiPlayer.share('myspace');\" title='partager avec Myspace'>  <span class='share shareMySpace'>&nbsp;</span></a>"+
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    60
"\n<a onclick=\"__IriSP.MyApiPlayer.share('jamespot');\" title='partager avec JamesPot'>  <span class='share shareJamesPot'>&nbsp;</span></a>";
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    61
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    62
// Official instance - to refactor ?
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    63
__IriSP.MyLdt 		= null;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    64
__IriSP.MyTags 		= null;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    65
__IriSP.MyApiPlayer	= null;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    66
__IriSP.player		= null;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    67
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    68
// genral var (old code) - to refactor 
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    69
__IriSP.Durration		= null;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    70
__IriSP.playerLdtWidth= null;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    71
__IriSP.playerLdtHeight= null;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    72
28
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    73
	
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    74
 
28
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
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    77
__IriSP.init = function (config){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    78
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    79
		__IriSP.config 			 = config;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    80
		var metadataSrc 		 = __IriSP.config.metadata.src;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    81
		var guiContainer		 = __IriSP.config.gui.container;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    82
		var guiMode				 = __IriSP.config.gui.mode;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    83
		var guiLdtShareTool		 = __IriSP.LdtShareTool;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    84
		// Localize jQuery variable
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    85
		__IriSP.jQuery = null;
28
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
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    88
		/******** Load jQuery if not present *********/
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    89
		if (window.jQuery === undefined || window.jQuery.fn.jquery !== '1.4.2') {
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    90
			var script_tag = document.createElement('script');
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    91
			script_tag.setAttribute("type","text/javascript");
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    92
			script_tag.setAttribute("src",__IriSP.lib.jQuery);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    93
				//"http://cdn.jquerytools.org/1.2.4/full/jquery.tools.min.js");
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    94
			script_tag.onload = scriptLibHandler;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    95
			script_tag.onreadystatechange = function () { // Same thing but for IE
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    96
				if (this.readyState == 'complete' || this.readyState == 'loaded') {
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    97
					scriptLibHandler();
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    98
					
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
    99
				}
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   100
			};
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   101
			// Try to find the head, otherwise default to the documentElement
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   102
			(document.getElementsByTagName("head")[0] || document.documentElement).appendChild(script_tag);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   103
		} else {
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   104
			// The jQuery version on the window is the one we want to use
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   105
			 __IriSP.jQuery = window.jQuery;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   106
			scriptLibHandler();
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   107
		}
28
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   108
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   109
		/******** Called once jQuery has loaded ******/
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   110
		function scriptLibHandler() {
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   111
			
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   112
			var script_jqUi_tooltip = document.createElement('script');
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   113
			script_jqUi_tooltip.setAttribute("type","text/javascript");
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   114
			script_jqUi_tooltip.setAttribute("src",__IriSP.lib.jQueryToolTip);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   115
			script_jqUi_tooltip.onload = scriptLoadHandler;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   116
			script_jqUi_tooltip.onreadystatechange = function () { // Same thing but for IE
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   117
				if (this.readyState == 'complete' || this.readyState == 'loaded') {
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   118
					scriptLoadHandler("jquery.tools.min.js loded");
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   119
				}
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   120
			};
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   121
			
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   122
			var script_swfObj = document.createElement('script');
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   123
			script_swfObj.setAttribute("type","text/javascript");
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   124
			script_swfObj.setAttribute("src",__IriSP.lib.swfObject);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   125
			script_swfObj.onload = scriptLoadHandler;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   126
			script_swfObj.onreadystatechange = function () { // Same thing but for IE
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   127
				if (this.readyState == 'complete' || this.readyState == 'loaded') {
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   128
					scriptLoadHandler("swfobject.js loded");
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   129
				}
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   130
			};
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   131
		
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   132
			var script_jqUi = document.createElement('script');
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   133
			script_jqUi.setAttribute("type","text/javascript");
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   134
			script_jqUi.setAttribute("src",
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   135
				"http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/jquery-ui.min.js");
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   136
			script_jqUi.onload = scriptLoadHandler;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   137
			script_jqUi.onreadystatechange = function () { // Same thing but for IE
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   138
				if (this.readyState == 'complete' || this.readyState == 'loaded') {
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   139
					scriptLoadHandler("jquery-ui.min.js loded");
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   140
				}
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   141
			};
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   142
		
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   143
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   144
			
28
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   145
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   146
			(document.getElementsByTagName("head")[0] || document.documentElement).appendChild(script_jqUi_tooltip);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   147
			(document.getElementsByTagName("head")[0] || document.documentElement).appendChild(script_jqUi);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   148
			(document.getElementsByTagName("head")[0] || document.documentElement).appendChild(script_swfObj);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   149
			
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   150
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   151
		};
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   152
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   153
		/******** Called once all lib are loaded ******/
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   154
		var loadLib = 0;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   155
		function scriptLoadHandler(Mylib) {
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   156
			//alert(Mylib);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   157
			loadLib +=1;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   158
			if(loadLib===3){ 
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   159
				main(); 			  
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   160
			}else {
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   161
				// __IriSP.jQuery('#'+__IriSP.config.gui.container).html("Loading library ...");
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   162
			}
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   163
		};
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   164
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   165
		/******** Our main function ********/
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   166
		function main() { 
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   167
			
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   168
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   169
			//  Make __IriSP.jQuery and restore window.jQuery 
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   170
			__IriSP.jQuery = window.jQuery.noConflict(true);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   171
			// Call MY Jquery
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   172
			__IriSP.jQuery(document).ready(function($) { 
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   173
				
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   174
				/******* Load CSS *******/
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   175
				var css_link_jquery = __IriSP.jQuery("<link>", { 
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   176
					rel: "stylesheet", 
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   177
					type: "text/css", 
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   178
					href: "../res/css/jq-css/themes/base/jquery.ui.all.css",
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   179
					'class': "dynamic_css"
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   180
				});
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   181
				var css_link_custom = __IriSP.jQuery("<link>", { 
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   182
					rel: "stylesheet", 
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   183
					type: "text/css", 
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   184
					href: __IriSP.config.gui.css ,
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   185
					'class': "dynamic_css"
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   186
				});
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   187
				
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   188
				css_link_jquery.appendTo('head');
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   189
				css_link_custom.appendTo('head');   
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   190
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   191
				// to see dynamicly loaded css on IE
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   192
				if ($.browser.msie) {
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   193
					$('.dynamic_css').clone().appendTo('head');
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   194
				}
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   195
				
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   196
				//__IriSP.trace("main","ready createMyHtml");
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   197
				
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   198
				__IriSP.createMyHtml();
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   199
				//__IriSP.trace("main","end createMyHtml");
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   200
				
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   201
				/******* Load Metadata *******/
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   202
				
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   203
				__IriSP.jQuery.ajax({
28
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   204
					  dataType: 'jsonp',
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   205
					  url:metadataSrc,
28
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   206
					  success : function(json){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   207
					  
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   208
							__IriSP.trace("ajax","success");
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   209
							
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   210
							// START PARSING ----------------------- 
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   211
							if(json === ""){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   212
								alert("ERREUR DE CHARGEMENT JSON");
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   213
							} else {
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   214
							  
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   215
							  
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   216
								// # CREATE MEDIA  							//
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   217
								// # JUSTE ONE PLAYER FOR THE MOMENT		//
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   218
								//__IriSP.jQuery("<div></div>").appendTo("#output");
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   219
								var MyMedia = new  __IriSP.Media(
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   220
																	json.medias[0].id,
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   221
																	json.medias[0].href,
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   222
																	json.medias[0]['meta']['dc:duration'],
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   223
																	json.medias[0]['dc:title'],
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   224
																	json.medias[0]['dc:description']);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   225
								
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   226
								__IriSP.trace("__IriSP.MyApiPlayer",
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   227
																	__IriSP.config.gui.width+"   "
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   228
																	+ __IriSP.config.gui.height + " "
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   229
																	+ json.medias[0].href + " "
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   230
																	+ json.medias[0]['meta']['dc:duration'] + " "
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   231
																	+ json.medias[0]['meta']['item']['value']);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   232
								
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   233
								// Create APIplayer
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   234
								__IriSP.MyApiPlayer = new __IriSP.APIplayer(
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   235
																	__IriSP.config.gui.width,
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   236
																	__IriSP.config.gui.height,
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   237
																	json.medias[0].href,
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   238
																	json.medias[0]['meta']['dc:duration'],
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   239
																	json.medias[0]['meta']['item']['value']);
28
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   240
							
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   241
								// # CREATE THE FIRST LINE  				//
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   242
								__IriSP.trace("__IriSP.init.main","__IriSP.Ligne");
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   243
								__IriSP.MyLdt = new __IriSP.Ligne (
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   244
																	json['annotation-types'][0].id,
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   245
																	json['annotation-types'][0]['dc:title'],
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   246
																	json['annotation-types'][0]['dc:description'],
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   247
																	json.medias[0]['meta']['dc:duration']);			
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   248
								
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   249
								// CREATE THE TAG CLOUD 					//
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   250
								__IriSP.trace("__IriSP.init.main","__IriSP.Tags");
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   251
								__IriSP.MyTags =  new __IriSP.Tags (json.tags);
28
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   252
							
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   253
								// CREATE THE ANNOTATIONS  				    //
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   254
								// JUSTE FOR THE FIRST TYPE   			 	//
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   255
								__IriSP.jQuery.each(json.annotations, function(i,item) {
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   256
									if (item.meta['id-ref'] == __IriSP.MyLdt.id) {
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   257
										//__IriSP.trace("__IriSP.init.main","__IriSP.MyLdt.addAnnotation");
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   258
										__IriSP.MyLdt.addAnnotation(
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   259
													item.id,
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   260
													item.begin,
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   261
													item.end,
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   262
													item.media,
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   263
													item.content.title,
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   264
													item.content.description,
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   265
													item.content.color,
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   266
													item.tags);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   267
									}
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   268
										//MyTags.addAnnotation(item);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   269
								});	
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   270
								__IriSP.jQuery.each(json.lists, function(i,item) {
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   271
									__IriSP.trace("lists","");
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   272
								});	
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   273
								__IriSP.jQuery.each(json.views, function(i,item) {
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   274
									__IriSP.trace("views","");
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   275
								});	
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   276
							}
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   277
							// END PARSING ----------------------- //  
28
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   278
						
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   279
										
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   280
					},error : function(data){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   281
						  alert("ERROR : "+data);
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   282
					}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   283
				  });	
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   284
			
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   285
			
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   286
			});
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   287
		}
28
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   288
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   289
};
28
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   290
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   291
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   292
__IriSP.createMyHtml = function(){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   293
		var width = __IriSP.config.gui.width;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   294
		
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   295
		// AUDIO  */
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   296
		// PB dans le html : ; 
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   297
		__IriSP.jQuery(  "<div id='Ldt-Root'>\n"+
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   298
			"	<div id='Ldt-PlaceHolder'>\n"+
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   299
			"		<a href='http://www.adobe.com/go/getflashplayer'>Get flash</a> to see this player	\n"+
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   300
			"	</div>\n"+
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   301
			"	<div id='Ldt-controler' class='demo'>\n"+
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   302
			"		<div class='Ldt-Control1' >\n"+
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   303
			"			<button id='ldt-CtrlPlay' onclick='__IriSP.MyApiPlayer.play()'>Lecture / Pause </button>\n"+
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   304
			"			<button id='ldt-CtrlNext' onclick='__IriSP.MyLdt.nextAnnotation()'>Suivant</button>\n"+
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   305
			"		</div>\n"+
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   306
			"		<div id='Ldt-Annotations' class='ui-slider'>\n"+
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   307
			"			<div id='slider-range-min'></div>\n"+
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   308
			"	</div>\n"+
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   309
			"		<div class='Ldt-Control2'>\n"+
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   310
			"			<button id='ldt-CtrlLink'> Partager </button>\n"+
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   311
			"			<button id='ldt-CtrlSound' onclick='__IriSP.MyApiPlayer.mute()'>Sound</button>\n"+
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   312
			"		</div>\n"+
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   313
			"  <div class='cleaner'>&nbsp\;</div> \n"+
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   314
			"  <div id='Ldt-Show-Arrow-container'>\n"+
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   315
			"  	<div id='Ldt-Show-Arrow'> </div>\n"+
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   316
			"  </div>\n"+
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   317
			"</div>\n"+
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   318
			"<div>\n"+
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   319
			" <div id='ldt-Show'> </div>\n"+
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   320
			"	<div id='Ldt-ShowAnnotation-audio' class='demo' >\n"+
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   321
			"		<div id='Ldt-SaTitle'></div>\n"+
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   322
			"		<div id='Ldt-SaDescription'></div>\n"+
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   323
			" 		<div class='cleaner'><!--&nbsp\;--></div>\n"+
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   324
			" </div>\n"+
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   325
			" <div id='Ldt-SaKeyword'>\n"+
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   326
			" <div id='Ldt-SaKeywordText'>  </div>\n"+
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   327
			" <div class='cleaner'></div>\n"+
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   328
			" <div id='Ldt-SaShareTools'>\n"+
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   329
			" \n"+
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   330
			" "+__IriSP.LdtShareTool+"\n"+
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   331
			" \n"+
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   332
			"  </div>\n"+
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   333
			" <div class='cleaner'></div>"+
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   334
			"</div>  "+
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   335
			//"<div id='Ldt-Tags'> Mots clefs : </div>"+
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   336
			"</div>"+
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   337
			"<div id='Ldt-output'></div>").appendTo("#"+__IriSP.config.gui.container);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   338
		
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   339
		__IriSP.trace("__IriSP.createHtml","end");
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   340
		
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   341
		__IriSP.jQuery("#Ldt-Annotations").width(width-(75*2));
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   342
		__IriSP.jQuery("#Ldt-Show-Arrow-container").width(width-(75*2));
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   343
		__IriSP.jQuery("#Ldt-ShowAnnotation-audio").width(width-10);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   344
		__IriSP.jQuery("#Ldt-ShowAnnotation-video").width(width-10);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   345
		__IriSP.jQuery("#Ldt-SaKeyword").width(width-10);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   346
		__IriSP.jQuery("#Ldt-controler").width(width-10);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   347
		__IriSP.jQuery("#Ldt-Control").attr("z-index","100");
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   348
		__IriSP.jQuery("#Ldt-controler").hide();
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   349
		
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   350
		__IriSP.jQuery("<div id='Ldt-load-container'><div id='Ldt-loader'>&nbsp;</div> Chargement... </div>").appendTo("#Ldt-ShowAnnotation-audio");
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   351
	
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   352
		if(__IriSP.config.gui.mode=='radio'){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   353
			__IriSP.jQuery("#Ldt-load-container").attr("width",__IriSP.config.gui.width);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   354
		}
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   355
		// Show or not the output
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   356
		if(__IriSP.config.gui.debug===true){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   357
			__IriSP.jQuery("#Ldt-output").show();
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   358
		} else {
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   359
			__IriSP.jQuery("#Ldt-output").hide();
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   360
		}
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   361
		
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   362
};
28
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   363
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   364
__IriSP.Media = function (id,url,duration,title,description){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   365
		this.id 		 	= id;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   366
		this.url 		= url;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   367
		this.title 		= title;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   368
		this.description = description;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   369
		this.duration 	= duration;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   370
		this.lignes 	  	= new Array();
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   371
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   372
		__IriSP.trace("__IriSP.Media","Media ID : "+id);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   373
		__IriSP.trace("__IriSP.Media","Media URL : "+url);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   374
		__IriSP.trace("__IriSP.Media","Media title : "+title);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   375
}
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   376
__IriSP.Media.prototype.createPlayerMedia = function (width,height,MyStreamer,MySwfPath){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   377
		__IriSP.MyApiPlayer = new __IriSP.APIplayer(width,height,this.url,this.duration,MyStreamer,MySwfPath);
28
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   378
		//createPlayer(width,height,this.url,this.duration,MyStreamer,MySwfPath);
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   379
}
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   380
__IriSP.Media.prototype.getMediaDuration = function (){
28
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   381
		return (this.duration);
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   382
}
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   383
__IriSP.Media.prototype.getMediaTitle = function (){
28
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   384
		return (this.title);
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   385
}
28
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   386
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   387
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   388
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   389
/* 	INTERFACE : SLIDER ( CONTROL BAR ) | BUTTON ()   */
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   390
__IriSP.createInterface = function(width,height,duration){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   391
				
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   392
		__IriSP.jQuery("#Ldt-controler").show();
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   393
		//__IriSP.jQuery("#Ldt-Root").css('display','visible');
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   394
		__IriSP.trace("__IriSP.createInterface",width+","+height+","+duration+",");
28
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   395
		
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   396
		 __IriSP.jQuery("#Ldt-ShowAnnotation").click(function () { 
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   397
			 //__IriSP.jQuery(this).slideUp(); 
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   398
		});
28
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   399
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   400
		var LdtpPlayerY = __IriSP.jQuery("#Ldt-PlaceHolder").attr("top");
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   401
		var LdtpPlayerX = __IriSP.jQuery("#Ldt-PlaceHolder").attr("left");
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   402
		__IriSP.jQuery("#slider-range-min").slider({ //range: "min",
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   403
			value: 0,
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   404
			min: 1,
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   405
			max: duration/1000,//1:54:52.66 = 3600+3240+
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   406
			step: 0.1,
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   407
			slide: function(event, ui) {
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   408
				
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   409
				//__IriSP.jQuery("#amount").val(ui.value+" s");
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   410
				//player.sendEvent('SEEK', ui.value)
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   411
				__IriSP.MyApiPlayer.seek(ui.value);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   412
				//changePageUrlOffset(ui.value);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   413
				//player.sendEvent('PAUSE')
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   414
			}
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   415
		});
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   416
		__IriSP.trace("__IriSP.createInterface","ICI");
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   417
		__IriSP.jQuery("#amount").val(__IriSP.jQuery("#slider-range-min").slider("value")+" s");
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   418
		__IriSP.jQuery(".Ldt-Control1 button:first").button({
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   419
			icons: {
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   420
				primary: 'ui-icon-play'
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   421
			},
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   422
			text: false
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   423
		}).next().button({
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   424
			icons: {
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   425
				primary: 'ui-icon-seek-next'
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   426
			},
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   427
			 text: false
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   428
		});
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   429
		__IriSP.jQuery(".Ldt-Control2 button:first").button({
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   430
			icons: {
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   431
				primary: 'ui-icon-transferthick-e-w'//,
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   432
				//secondary: 'ui-icon-volume-off'
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   433
			},
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   434
			text: false
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   435
		}).next().button({
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   436
			icons: {
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   437
				primary: 'ui-icon-volume-on'
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   438
			},
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   439
			 text: false
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   440
		});
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   441
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   442
		// /!\ PB A MODIFIER 
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   443
		//__IriSP.MyTags.draw();
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   444
		__IriSP.trace("__IriSP.createInterface","ICI2");
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   445
		__IriSP.jQuery("#ldt-CtrlPlay").attr("style","background-color:#CD21C24;");
28
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   446
		
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   447
		__IriSP.jQuery("#Ldt-load-container").hide();
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   448
		
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   449
		if(__IriSP.config.gui.mode=="radio" & __IriSP.jQuery.browser.msie!=true){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   450
			__IriSP.jQuery("#Ldtplayer1").attr("height","0");
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   451
		}
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   452
		__IriSP.trace("__IriSP.createInterface","3");
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   453
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   454
		__IriSP.trace("__IriSP.createInterface","END");
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   455
		
28
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
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   459
/*  API player - work in progress ... need refactoring of code */ 
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   460
__IriSP.APIplayer = function (width,height,url,duration,streamerPath,MySwfPath){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   461
		
28
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   462
		
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   463
		this.player 			= null;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   464
		this.hashchangeUpdate 	= null;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   465
		
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   466
		this.width				= width;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   467
		this.height				= height;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   468
		this.url				= url;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   469
		this.duration			= duration;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   470
		this.streamerPath		= streamerPath;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   471
		this.MySwfPath			= MySwfPath;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   472
		
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   473
		__IriSP.MyApiPlayer		= this;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   474
		
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   475
		__IriSP.createPlayer(width,height,this.url,this.duration,this.streamerPath,this.MySwfPath);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   476
		__IriSP.trace("__IriSP.APIplayer","__IriSP.createPlayer");
28
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   477
		
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   478
}
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   479
__IriSP.APIplayer.prototype.ready = function(player){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   480
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   481
	//__IriSP.trace("__IriSP.APIplayer.prototype.APIpReady"," __IriSP.createInterface");
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   482
	__IriSP.createInterface(this.width,this.height,this.duration);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   483
	__IriSP.trace("__IriSP.APIplayer.prototype.APIpReady","END  __IriSP.createInterface");
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   484
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   485
	
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   486
	// hashchange EVENT
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   487
	if (window.addEventListener){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   488
	
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   489
	// pour FIREFOX  hashchange EVENT
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   490
		window.addEventListener("hashchange", function() {
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   491
		  var url = window.location.href;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   492
		  var time = __IriSP.retrieveTimeFragment(url);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   493
		  __IriSP.trace("__IriSP.APIplayer.prototype.ready",time);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   494
		  if(__IriSP.MyApiPlayer.hashchangeUpdate==null){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   495
			__IriSP.MyApiPlayer.seek(time);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   496
		  }else{
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   497
			__IriSP.MyApiPlayer.hashchangeUpdate=null;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   498
		  }
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   499
		}, false);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   500
	 
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   501
	} 
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   502
	else if (window.attachEvent){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   503
	// FOR IE hashchange EVENT
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   504
	
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   505
		window.attachEvent("onhashchange", function() {
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   506
		  __IriSP.trace("hashchange",time);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   507
		  var url = window.location.href;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   508
		  var time = __IriSP.retrieveTimeFragment(url);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   509
		  if(__IriSP.MyApiPlayer.hashchangeUpdate==null){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   510
			__IriSP.MyApiPlayer.seek(time);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   511
		  }else{
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   512
			__IriSP.MyApiPlayer.hashchangeUpdate=null;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   513
		  }
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   514
		}, false);
28
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
	
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   517
}
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   518
__IriSP.APIplayer.prototype.pause = function(){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   519
	this.hashchangeUpdate = true;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   520
	__IriSP.player.sendEvent('PAUSE');
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   521
}
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   522
__IriSP.APIplayer.prototype.play  = function(){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   523
	this.hashchangeUpdate = true;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   524
	__IriSP.player.sendEvent('PLAY');
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   525
}
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   526
__IriSP.APIplayer.prototype.mute  = function(){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   527
	__IriSP.player.sendEvent('MUTE');
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   528
}
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   529
__IriSP.APIplayer.prototype.share = function(network){
28
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   530
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   531
	var MyMessage = "Je regarde :";
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   532
	var MyURLNow = window.location.href;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   533
	var shareURL;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   534
	//alert(network+" : "+MyURLNow);
28
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   535
	
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   536
	if(network == "facebook"){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   537
			shareURL = "http://www.facebook.com/share.php?u=";			
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   538
		}else if(network == "twitter"){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   539
			shareURL  = "http://twitter.com/home?status="+MyMessage;	
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   540
		}else if(network == "myspace"){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   541
			shareURL ="http://www.myspace.com/Modules/PostTo/Pages/?u=";
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   542
		}else if(network == "delicious"){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   543
			shareURL = "http://delicious.com/save?url=";
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   544
		}else if(network == "JameSpot"){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   545
			shareURL = "http://www.jamespot.com/?action=spotit&u=";
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   546
			//alert(network+" non actif pour l'instant : "+MyURLNow);
28
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
	
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   549
	window.location.href = shareURL+encodeURIComponent(MyURLNow);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   550
}
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   551
__IriSP.APIplayer.prototype.seek  = function (time){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   552
	__IriSP.player.sendEvent('SEEK', time);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   553
	this.changePageUrlOffset(time);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   554
}	
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   555
__IriSP.APIplayer.prototype.update = function (time){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   556
	this.hashchangeUpdate = true;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   557
	__IriSP.player.sendEvent('SEEK', time);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   558
}
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   559
__IriSP.APIplayer.prototype.changePageUrlOffset = function (time) {
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   560
	//alert(time);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   561
  __IriSP.trace("__IriSP.APIplayer.prototype.changePageUrlOffset","CHANGE URL "+time);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   562
  window.location.hash = "#t=" + time;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   563
  window.location.href =  window.location.href;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   564
}
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   565
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   566
/* MEDIA FRAGMENT FUNCTION */
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   567
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   568
__IriSP.jumpToTimeoffset = function (form) {
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   569
	var time = form.time.value;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   570
	__IriSP.MyApiPlayer.changePageUrlOffset(time);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   571
}
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   572
__IriSP.retrieveTimeFragment = function (url) {
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   573
  var pageoffset = 0;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   574
  var offsettime = 0;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   575
  
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   576
  if (url.split("#")[1] != null) {
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   577
	pageoffset = url.split("#")[1];
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   578
		if (pageoffset.substring(2) != null) {
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   579
			offsettime = pageoffset.substring(2);
28
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   580
		}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   581
	}
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   582
	return offsettime;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   583
}  
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   584
__IriSP.ignoreTimeFragment = function(url){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   585
 if (url.split("#")[1] != null) {
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   586
	var pageurl= url.split("#")[0];
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   587
 }
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   588
 return pageurl;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   589
}
28
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
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   592
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   593
/* CODE SPECIAL JW PLAYER  creation + listener */
28
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   594
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   595
__IriSP.currentPosition 	= 0; 
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   596
__IriSP.currentVolume   	= 50; 
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   597
__IriSP.player 			= null;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   598
__IriSP.startPosition 	= null;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   599
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   600
__IriSP.createPlayer = function (width,height,url,duration,streamerPath,MySwfPath) {
28
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   601
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   602
	__IriSP.trace("__IriSP.createPlayer","start");			
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   603
	
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   604
	__IriSP.myUrlFragment = url.split(streamerPath);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   605
	var file = __IriSP.myUrlFragment[1];
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   606
	var streamer = streamerPath;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   607
	
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   608
	var flashvars = {
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   609
		streamer:streamer,
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   610
		file:file, 
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   611
		live:"true",
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   612
		autostart:"true",
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   613
		controlbar:"none",
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   614
		playerready:"__IriSP.playerReady"
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   615
	}
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   616
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   617
	var params = {
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   618
		allowfullscreen:"true", 
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   619
		allowscriptaccess:"always",
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   620
		wmode:"transparent"
28
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   621
	}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   622
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   623
	var attributes = {
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   624
		id:"Ldtplayer1",  
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   625
		name:"Ldtplayer1"
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   626
	}
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   627
	
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   628
	__IriSP.trace("__IriSP.createPlayer","SWFOBJECT src:"+__IriSP.config.player.src+" " +width+" "+height);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   629
	swfobject.embedSWF(__IriSP.config.player.src, "Ldt-PlaceHolder", width, height, "9.0.115", false, flashvars, params, attributes);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   630
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   631
	// need a methode to 
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   632
	// re execute if this swf call does'nt work 
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   633
}
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   634
__IriSP.playerReady  = function (thePlayer) {
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   635
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   636
	//__IriSP.trace("__IriSP.playerReady","PLAYER READY !!!!!!!!!!!!");
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   637
	__IriSP.player = window.document[thePlayer.id];
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   638
	//__IriSP.trace("__IriSP.playerReady","API CALL "+__IriSP.player);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   639
	__IriSP.MyApiPlayer.ready(__IriSP.player);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   640
	//__IriSP.trace("__IriSP.playerReady","API CALL END ");
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   641
	
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   642
	var url = document.location.href;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   643
	var time = __IriSP.retrieveTimeFragment(url);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   644
	//__IriSP.trace("__IriSP.playerReady"," "+url+" "+time );
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   645
	__IriSP.startPosition = time;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   646
	//__IriSP.trace("__IriSP.playerReady"," LISTENER LAUCHER");
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   647
	__IriSP.addListeners();	
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   648
	//__IriSP.trace("__IriSP.playerReady"," LISTENER END");
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   649
	
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   650
}
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   651
__IriSP.addListeners = function () {
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   652
	if (__IriSP.player) { 
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   653
		__IriSP.trace("__IriSP.addListeners","ADD  Listener ");
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   654
		__IriSP.player.addModelListener("TIME", "__IriSP.positionListener");
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   655
		__IriSP.player.addControllerListener("VOLUME", "__IriSP.volumeListener");
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   656
		__IriSP.player.addModelListener('STATE', '__IriSP.stateMonitor');
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   657
	} else {
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   658
		__IriSP.setTimeout("addListeners()",100);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   659
	}
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   660
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   661
	// et changer les boutons
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   662
}
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   663
__IriSP.stateMonitor = function (obj) { 
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   664
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   665
	 if(obj.newstate == 'PAUSED')
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   666
    {
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   667
		__IriSP.trace("__IriSP.stateMonitor","PAUSE");
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   668
		__IriSP.MyApiPlayer.changePageUrlOffset(__IriSP.currentPosition);			
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   669
		
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   670
	} else if (obj.newstate == 'PLAYING'){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   671
		// une fois la video prete a lire  la déplacer au bon timecode 
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   672
		if(__IriSP.startPosition!=null){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   673
			__IriSP.MyApiPlayer.update(__IriSP.startPosition);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   674
			__IriSP.startPosition = null;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   675
		}
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   676
	} else if (obj.newstate == 'BUFFERING'){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   677
		__IriSP.trace("__IriSP.stateMonitor","BUFFERING : ");
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   678
		//changePageUrlOffset(currentPosition);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   679
	}
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   680
	
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   681
}
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   682
__IriSP.positionListener = function(obj) { 
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   683
	//__IriSP.trace("__IriSP.positionListener",obj.position);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   684
	__IriSP.currentPosition = obj.position; 
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   685
	var tmp = document.getElementById("posit");
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   686
	if (tmp) { tmp.innerHTML = "position: " + __IriSP.currentPosition; }
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   687
	__IriSP.jQuery("#slider-range-min").slider("value", obj.position);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   688
	__IriSP.jQuery("#amount").val(obj.position+" s");
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   689
	// afficher annotation 
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   690
	__IriSP.MyLdt.checkTime(__IriSP.currentPosition);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   691
}
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   692
__IriSP.volumeListener   = function (obj) { 
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   693
	__IriSP.currentVolume = obj.percentage; 
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   694
	var tmp = document.getElementById("vol");
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   695
	if (tmp) { tmp.innerHTML = "volume: " + __IriSP.currentVolume; }
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   696
}	
28
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   697
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
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   701
/* 	UTIL */
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   702
// code from http://stackoverflow.com/questions/822452/strip-html-from-text-javascript
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   703
__IriSP.stripHtml = function(s){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   704
	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;');
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   705
}
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   706
// conversion de couleur Decimal vers HexaDecimal || 000 si fff 
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   707
__IriSP.DEC_HEXA_COLOR = function (dec){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   708
	 var hexa='0123456789ABCDEF',hex='';
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   709
	 var tmp;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   710
	 while (dec>15){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   711
		  tmp = dec-(Math.floor(dec/16))*16;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   712
		  hex = hexa.charAt(tmp)+hex;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   713
		  dec = Math.floor(dec/16);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   714
	 }
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   715
	 hex = hexa.charAt(dec)+hex;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   716
	 if (hex == "FFCC00"){ hex="";/* by default color of Ldt annotation */ }
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   717
	 return(hex);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   718
}
28
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
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   721
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   722
/* CLASS Ligne (annotationType) 	*/
28
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   723
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   724
__IriSP.LDTligne 	= null;		
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   725
__IriSP.Ligne = function (id,title,description,duration){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   726
	this.id 		 = id;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   727
	this.title 		 = title;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   728
	this.description = description;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   729
	//
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   730
	this.annotations = new Array();
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   731
	this.duration = duration;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   732
	__IriSP.LDTligne = this;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   733
	__IriSP.trace("__IriSP.Ligne","CREATE "+__IriSP.LDTligne);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   734
}	
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   735
__IriSP.Ligne.prototype.addAnnotation = function (id,begin,end,media,title,description,color,tags){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   736
	var myAnnotation = new __IriSP.Annotation(id,begin,end,media,title,description,color,tags,this.duration);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   737
	this.annotations.push(myAnnotation);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   738
	//__IriSP.trace("__IriSP.Ligne.prototype.addAnnotation  ","add annotation "+title);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   739
}
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   740
__IriSP.Ligne.prototype.onClickLigneAnnotation = function(id){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   741
	//changePageUrlOffset(currentPosition);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   742
	//player.sendEvent('SEEK', this.start);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   743
	//__IriSP.trace("SEEK",this.start);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   744
}
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   745
__IriSP.Ligne.prototype.searchLigneAnnotation = function(id){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   746
	/*for (){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   747
	}*/
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   748
}
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   749
__IriSP.Ligne.prototype.listAnnotations = function(){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   750
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   751
}
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   752
__IriSP.Ligne.prototype.nextAnnotation = function (){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   753
	var annotationCibleNumber = this.numAnnotation(this.annotationOldRead)+1;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   754
	var annotationCible = this.annotations[annotationCibleNumber];
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   755
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   756
	if(annotationCibleNumber<this.annotations.length-1){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   757
		annotationCible.begin
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   758
		__IriSP.player .sendEvent('SEEK', annotationCible.begin/1000);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   759
		__IriSP.trace("LIGNE  ","| next = "+annotationCibleNumber+" - "+this.annotations.length+" | seek :"+annotationCible.begin/1000);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   760
	}else{
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   761
		__IriSP.player .sendEvent('SEEK', this.annotations[0].begin/1000);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   762
	}
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   763
	
28
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   764
	
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   765
}
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   766
__IriSP.Ligne.prototype.numAnnotation = function (annotationCible){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   767
	for (var i=0; i < this.annotations.length; ++i){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   768
		if(annotationCible == this.annotations[i]){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   769
			return i;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   770
		}
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   771
	}
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   772
}
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   773
__IriSP.Ligne.prototype.checkTime = function(time){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   774
	var annotationTempo = -1;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   775
	//__IriSP.trace("__IriSP.Ligne.prototype.checkTimeLigne",time);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   776
	
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   777
	for (var i=0; i < this.annotations.length; ++i){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   778
		var annotationTempo = this.annotations[i];	
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   779
		if (time>annotationTempo.begin/1000 && time<annotationTempo.end/1000){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   780
			
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   781
				// different form the previous
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   782
				if(annotationTempo!=this.annotationOldRead){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   783
					this.annotationOldRead = annotationTempo;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   784
					//__IriSP.trace("Check : ","annotation ici : "+i+" title "+annotationTempo.title);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   785
					//__IriSP.jQuery('#Ldt-ShowAnnotation').slideUp();
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   786
					//http://api.jquery.com/delay/  -> 1.4
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   787
					//__IriSP.jQuery("#Ldt-SaTitle").delay(100).text(annotationTempo.title);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   788
					//__IriSP.jQuery("#Ldt-SaDescription").delay(100).text(annotationTempo.description);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   789
					//__IriSP.jQuery('#Ldt-ShowAnnotation').delay(100).slideDown();
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   790
					//__IriSP.trace("__IriSP.Ligne.prototype.checkTimeLigne",annotationTempo.title+" "+annotationTempo.description );
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   791
					__IriSP.jQuery("#Ldt-SaTitle").text(annotationTempo.title);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   792
					__IriSP.jQuery("#Ldt-SaDescription").text(annotationTempo.description);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   793
					
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   794
					__IriSP.jQuery("#Ldt-SaDescription").text(annotationTempo.description);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   795
					__IriSP.jQuery("#Ldt-SaKeywordText").html("Mots clefs : "+annotationTempo.htmlTags);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   796
					
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   797
					//__IriSP.jQuery('#Ldt-ShowAnnotation').slideDown();
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   798
					var startPourcent 	= annotationTempo.timeToPourcent((annotationTempo.begin*1+(annotationTempo.end*1-annotationTempo.begin*1)/2),annotationTempo.duration*1); 
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   799
					__IriSP.jQuery("#Ldt-Show-Arrow").animate({left:startPourcent+'%'},1000);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   800
					//alert(startPourcent);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   801
					var tempolinkurl  =  __IriSP.ignoreTimeFragment(window.location.href)+"#t="+(this.annotations[i].begin/1000);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   802
				}
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   803
			break;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   804
		} 
28
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   805
		
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   806
	}
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   807
	// si il y en a pas : retractation du volet 
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   808
	if( annotationTempo == -1){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   809
		if(annotationTempo!=this.annotationOldRead){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   810
			__IriSP.trace("Check : ","pas d'annotation ici ");
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   811
			__IriSP.jQuery('#Ldt-ShowAnnotation').slideUp();
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   812
			this.annotationOldRead = annotationTempo;
28
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   813
		}
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
	
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   816
}
28
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   817
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   818
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   819
/* CLASS Annotation */
28
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   820
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   821
__IriSP.Annotation = function (){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   822
	var id 			= null;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   823
	var begin 			= null;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   824
	var end 			= null;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   825
	var media 			= null;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   826
	var description	= null;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   827
	var title 			= null;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   828
	var color 			= null;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   829
	var tags			= null;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   830
	__IriSP.trace("annotation ","r�ussi")
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   831
}	
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   832
__IriSP.Annotation = function(id,begin,end,media,title,description,color,tags,duration){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   833
	this.id 			= id;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   834
	this.begin 			= begin;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   835
	this.end 			= end;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   836
	this.media 			= media;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   837
	this.description 	= description;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   838
	this.title 			= title;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   839
	this.color 			= color;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   840
	this.tags			= tags;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   841
	this.htmlTags		= "";
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   842
	this.duration		= duration;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   843
	// draw it 
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   844
	this.draw();
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   845
	this.drawTags();
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   846
	//
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   847
	__IriSP.trace("Annotation created : ",id);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   848
}	
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   849
__IriSP.Annotation.prototype.draw = function(){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   850
	//alert (this.duration);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   851
	var startPourcent 	= this.timeToPourcent(this.begin,this.duration); // temps du media 
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   852
	var endPourcent 	= this.timeToPourcent(this.end,this.duration)-startPourcent;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   853
	var titleForDiv		= this.title.substr(0,55);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   854
	
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   855
	__IriSP.jQueryAnnotationTemplate = "<div title='"+__IriSP.stripHtml(titleForDiv)+"' 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:#"+__IriSP.DEC_HEXA_COLOR(this.color)+";\" onClick=\"__IriSP.MyApiPlayer.seek('"+Math.round(this.begin/1000)+"');__IriSP.jQuery('#Ldt-ShowAnnotation').slideDown();\"    ></div> ";
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   856
	//alert(this.color+" : "+DEC_HEXA_COLOR(this.color));
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   857
	
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   858
	__IriSP.jQuerytoolTipTemplate = "<div class='Ldt-tooltip'>"
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   859
						+"<div class='title'>"+__IriSP.stripHtml(this.title)+"</div>"
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   860
						+"<div class='time'>"+this.begin+" : "+this.end+"</div>"
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   861
						+"<div class='description'>"+__IriSP.stripHtml(this.description)+"</div>"
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   862
						+"</div>";
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   863
	
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   864
	
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   865
	__IriSP.jQuery("<div>"+__IriSP.jQueryAnnotationTemplate+"</div>").appendTo("#Ldt-Annotations");
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   866
	// TOOLTIP BUG ! 
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   867
	
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   868
	__IriSP.jQuery("#"+this.id).tooltip({ effect: 'slide'});
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   869
	
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   870
	
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   871
	__IriSP.jQuery("#"+this.id).fadeTo(0,0.3);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   872
	__IriSP.jQuery("#"+this.id).mouseover(function() {
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   873
		__IriSP.jQuery("#"+this.id).animate({opacity: 0.6}, 5)
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   874
	}).mouseout(function(){		
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   875
		__IriSP.jQuery("#"+this.id).animate({opacity: 0.3}, 5)
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   876
	});
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   877
	__IriSP.trace("__IriSP.Annotation.prototype.draw","ADD ANOTATION : "+this.begin+" "+this.end+" "+__IriSP.stripHtml(this.title)+" | "+startPourcent+" | "+endPourcent+" | duration = "+this.duration);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   878
	
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   879
}	
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   880
__IriSP.Annotation.prototype.drawTags = function(){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   881
	var KeywordPattern = '<a href=\"\"> '+' </a>';
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   882
	
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   883
	//__IriSP.trace(" !? Tags : ",this.tags);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   884
	
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   885
	if (this.tags!=undefined){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   886
		for (var i = 0; i < this.tags.length; ++i){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   887
			
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   888
			//this.htmlTags += '<span onclick=\"ShowTag('+this.tags[i]['id-ref']+');\"  > '+MyTags.getTitle(this.tags[i]['id-ref'])+' </span>'+" , ";
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   889
			this.htmlTags += '<span> '+__IriSP.MyTags.getTitle(this.tags[i]['id-ref'])+' </span>'+" , ";
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   890
			
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   891
		}		
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   892
	}
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   893
}
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   894
__IriSP.Annotation.prototype.tootTipAnnotation = function() {
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   895
	// 1 chercher le div correspondant
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   896
	// 2 y mettre les information
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   897
	return this.color + ' ' + this.type + ' apple';
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   898
}
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   899
__IriSP.Annotation.prototype.onRollOverAnnotation = function (){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   900
	this.tootTip();
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   901
}		
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   902
__IriSP.Annotation.prototype.timeToPourcent = function(time,timetotal){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   903
	return (parseInt(Math.round(time/timetotal*100)));
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   904
}
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   905
 
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   906
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   907
/* CLASS Tags */
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   908
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   909
__IriSP.Tags = function(object){
28
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   910
	this.myTags 	=	object;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   911
	this.htmlTags 	= 	null;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   912
	this.weigthMax 	= 	0;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   913
	//this.mySegments  = 	new array();
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   914
}
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   915
__IriSP.Tags.prototype.addAnnotation = function (annotation){
28
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   916
	for (var i = 0; i < this.myTags.length; ++i){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   917
		this.myTags[i].mySegments = new Array(); 
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   918
		if (annotation.tags!=null){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   919
			for (var j = 0; j < annotation.tags.length; ++j){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   920
				if (this.myTags[i]['id'] == annotation.tags[j]['id-ref']){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   921
					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
   922
					var weigthTempo = this.myTags[i].mySegments.length
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   923
					var tempo = this.myTags[i].mySegments[weigthTempo-1];
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   924
					//__IriSP.trace ("__IriSP.Tags.prototype.addAnnotation ","  "+this.myTags[i]['meta']['dc:title']+" "+this.myTags[i]['id']+" : "+tempo[0]+" - "+tempo[1]);
28
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
					if (this.weigthMax < weigthTempo ){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   927
						this.weigthMax = weigthTempo;
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
	}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   933
}
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   934
__IriSP.Tags.prototype.getTitle = function (id){
28
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   935
	for (var i = 0; i < this.myTags.length; ++i){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   936
		if(this.myTags[i]['id']==id){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   937
			return(this.myTags[i]['meta']['dc:title']);
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
}
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   942
__IriSP.Tags.prototype.draw = function (){
28
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   943
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   944
	__IriSP.trace("__IriSP.Tags.prototype.draw"," !!! WELL START " );
28
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   945
	for (var i = 0; i < this.myTags.length; ++i){
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   946
		__IriSP.trace("__IriSP.Tags.prototype.draw"," ADD Tags : "+this.myTags[i]['id']);
28
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   947
		if(this.myTags[i]['id']!=null){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   948
		this.htmlTags += '<span onclick=\"MyTags.show( \''+this.myTags[i]['id']
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   949
						+'\');\" 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
   950
						+'px;\" alt=\"'+this.myTags[i].mySegments.length
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   951
						+'\"> '+this.myTags[i]['meta']['dc:title']+' </span>'+' , ';
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
	
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   955
	__IriSP.jQuery('#Ldt-Tags').html(this.htmlTags);
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   956
	__IriSP.trace("__IriSP.Tags.prototype.draw"," !!!!  END WMAX= "+this.weigthMax );
28
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   957
	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   958
}
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   959
__IriSP.Tags.prototype.show = function (id){
28
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   960
	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   961
	var timeStartOffsetA	=	100000000000000000000;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   962
	var timeStartOffsetB	=	100000000000000000000;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   963
	var timeEndOffsetA		=	0;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   964
	var timeEndOffsetB		=	0;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   965
	var timeStartID;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   966
	var timeEndID;
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   967
	var WidthPourCent;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   968
	var leftPourCent;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   969
	var timeStartOffset;
28
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   970
	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   971
	// case 1 : seul segment 
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   972
	// case 2 : 2 ou X segments 
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   973
	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   974
	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   975
	for (var i = 0; i < this.myTags.length; ++i){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   976
		if (this.myTags[i]['id']==id){
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   977
			__IriSP.trace("######### TAG DRAWing : "," END" );		
28
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   978
			
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   979
			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
   980
				if(timeStartOffset> this.myTags[i].mySegments[j][0]){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   981
					timeStartOffsetA = this.myTags[i].mySegments[j][0];
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   982
					timeStartOffsetB = this.myTags[i].mySegments[j][1];
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   983
					timeStartID		 = this.myTags[i].mySegments[j][2]
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   984
				}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   985
				if(timeStartOffset> this.myTags[i].mySegments[j][0]){
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   986
					timeEndOffsetA  = this.myTags[i].mySegments[j][0];
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   987
					timeEndOffsetB  = this.myTags[i].mySegments[j][1];
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   988
					timeEndID		= this.myTags[i].mySegments[j][2]
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   989
				}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   990
			}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   991
			
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   992
		}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   993
	}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   994
	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   995
	// -------------------------------------------------
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   996
	// 
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   997
	// -------------------------------------------------
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
   998
	
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
   999
	leftPourCent 	= __IriSP.timeToPourcent((timeStartOffsetA*1+(timeStartOffsetB-timeStartOffsetA)/2),__IriSP.MyLdt.duration); 
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
  1000
	WidthPourCent	= __IriSP.timeToPourcent((timeEndOffsetA*1+(timeEndOffsetB-timeEndOffsetA)/2),__IriSP.MyLdt.duration)-leftPourCent; 			
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
  1001
	//WidthPourCent	= timeToPourcent((timeEndOffsetA*1+(timeEndOffsetB-timeEndOffsetA)/2),MyLdt.duration)-startPourcent; 			
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
  1002
	__IriSP.jQuery("#Ldt-Show-Tags").css('left',leftPourCent+'%');
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
  1003
	__IriSP.jQuery("#Ldt-Show-Tags").css('width',WidthPourCent+'%');
28
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
  1004
	// like arrow script
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
  1005
	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
  1006
	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
  1007
	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
  1008
}
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
  1009
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
  1010
		
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
  1011
/* CLASS TRACE */
28
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
  1012
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
  1013
__IriSP.traceNum=0;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
  1014
__IriSP.trace = function(msg,value){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
  1015
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
  1016
	if(__IriSP.config.gui.debug===true){
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
  1017
		__IriSP.traceNum += 1;
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
  1018
		__IriSP.jQuery("<div>"+__IriSP.traceNum+" - "+msg+" : "+value+"</div>").appendTo("#Ldt-output");
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
  1019
	}
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
  1020
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
  1021
}
28
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
  1022
	
51
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
  1023
	
28d21b2123ba independant JS version for the player
hurons
parents: 30
diff changeset
  1024
	
28
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
  1025
	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
  1026
	
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
  1027