src/js/LdtPlayer.js
author hamidouk
Mon, 10 Oct 2011 16:40:37 +0200
branchpopcorn-port
changeset 58 f92e6c4baae9
parent 56 72180e18b021
child 71 7bc3a4651ec3
permissions -rw-r--r--
Renamed LAYOUT.txt and added sinon.js for mockups.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
55
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
     1
/* 	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
     2
 *	Copyright 2010 Institut de recherche et d'innovation 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
     3
 *	contributor(s) : Samuel Huron 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
     4
 *	Use Silvia Pfeiffer 's javascript mediafragment implementation
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
     5
 *
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
     6
 *	contact@iri.centrepompidou.fr
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
     7
 *	http://www.iri.centrepompidou.fr 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
     8
 *	 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
     9
 *	This software is a computer program whose purpose is to show and add annotations on a video .
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    10
 *	This software is governed by the CeCILL-C license under French law and
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    11
 *	abiding by the rules of distribution of free software. You can  use, 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    12
 *	modify and/ or redistribute the software under the terms of the CeCILL-C
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    13
 *	license as circulated by CEA, CNRS and INRIA at the following URL
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    14
 *	"http://www.cecill.info". 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    15
 *	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    16
 *	The fact that you are presently reading this means that you have had
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    17
 *	knowledge of the CeCILL-C license and that you accept its terms.
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    18
*/
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    19
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    20
if ( window.IriSP === undefined && window.__IriSP === undefined ) { 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    21
	var IriSP = {}; 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    22
	var __IriSP = IriSP; /* for backward compatibility */
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    23
}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    24
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    25
		
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    26
// Official instance - to refactor ?
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    27
IriSP.MyLdt 		= null;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    28
IriSP.MyTags 		= null;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    29
IriSP.MyApiPlayer	= null;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    30
IriSP.player		= null;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    31
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    32
// genral var (old code) - to refactor 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    33
IriSP.Durration		= null;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    34
IriSP.playerLdtWidth	= null;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    35
IriSP.playerLdtHeight	= null;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    36
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    37
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    38
IriSP.init = function ( config ) {		
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    39
		if ( config === null ) {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    40
			IriSP.config 			 = IriSP.configDefault;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    41
		} else {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    42
			
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    43
			IriSP.config 			 = config;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    44
						
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    45
			if ( IriSP.config.player.params == null ) {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    46
				IriSP.config.player.params = IriSP.configDefault.player.params;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    47
			}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    48
			
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    49
			if ( IriSP.config.player.flashvars == null ) {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    50
				IriSP.config.player.flashvars = IriSP.configDefault.player.flashvars;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    51
			}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    52
			
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    53
			if ( IriSP.config.player.attributes == null ) {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    54
				IriSP.config.player.attributes = IriSP.configDefault.player.attributes;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    55
			}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    56
		}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    57
		
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    58
		var metadataSrc 		 = IriSP.config.metadata.src;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    59
		var guiContainer		 = IriSP.config.gui.container;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    60
		var guiMode				 = IriSP.config.gui.mode;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    61
		var guiLdtShareTool		 = IriSP.LdtShareTool;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    62
		
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    63
		// Localize jQuery variable
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    64
		IriSP.jQuery = null;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    65
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    66
		/* FIXME : to refactor using popcorn.getscript ? */
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    67
		/******** Load jQuery if not present *********/
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    68
		if ( window.jQuery === undefined || window.jQuery.fn.jquery !== '1.4.2' ) {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    69
			
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    70
			var script_tag = document.createElement( 'script' );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    71
			script_tag.setAttribute( "type", "text/javascript" );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    72
			script_tag.setAttribute( "src", IriSP.lib.jQuery );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    73
			
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    74
			script_tag.onload = scriptLibHandler;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    75
			script_tag.onreadystatechange = function () { // Same thing but for IE
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    76
				if ( this.readyState == 'complete' || this.readyState == 'loaded' ) {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    77
					scriptLibHandler();					
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    78
				}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    79
			};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    80
			
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    81
			// Try to find the head, otherwise default to the documentElement
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    82
			( document.getElementsByTagName("head")[0] || document.documentElement ).appendChild( script_tag );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    83
		} else {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    84
			// The jQuery version on the window is the one we want to use
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    85
			 IriSP.jQuery = window.jQuery;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    86
			 scriptLibHandler();
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    87
		}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    88
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    89
		/******** Called once jQuery has loaded ******/
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    90
		function scriptLibHandler() {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    91
			
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    92
			var script_jqUi_tooltip = document.createElement( 'script' );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    93
			script_jqUi_tooltip.setAttribute( "type", "text/javascript" );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    94
			script_jqUi_tooltip.setAttribute( "src", IriSP.lib.jQueryToolTip );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    95
			script_jqUi_tooltip.onload = scriptLoadHandler;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    96
			script_jqUi_tooltip.onreadystatechange = function () { // Same thing but for IE
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    97
				if ( this.readyState == 'complete' || this.readyState == 'loaded' ) {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    98
					scriptLoadHandler( "jquery.tools.min.js loded" );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
    99
				}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   100
			};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   101
			
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   102
			var script_swfObj = document.createElement('script');
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   103
			script_swfObj.setAttribute( "type","text/javascript" );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   104
			script_swfObj.setAttribute( "src",IriSP.lib.swfObject );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   105
			script_swfObj.onload = scriptLoadHandler;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   106
			script_swfObj.onreadystatechange = function () { // Same thing but for IE
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   107
				if ( this.readyState == 'complete' || this.readyState == 'loaded' ) {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   108
					scriptLoadHandler( "swfobject.js loded" );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   109
				}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   110
			};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   111
		
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   112
			var script_jqUi = document.createElement( 'script' );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   113
			script_jqUi.setAttribute( "type","text/javascript" );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   114
			script_jqUi.setAttribute( "src",IriSP.lib.jQueryUI );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   115
			script_jqUi.onload = scriptLoadHandler;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   116
			script_jqUi.onreadystatechange = function () { // Same thing but for IE
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   117
				if ( this.readyState == 'complete' || this.readyState == 'loaded' ) {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   118
					scriptLoadHandler( "jquery-ui.min.js loded" );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   119
				}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   120
			};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   121
		
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   122
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   123
			( document.getElementsByTagName("head")[0] || document.documentElement ).appendChild( script_jqUi_tooltip);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   124
			( document.getElementsByTagName("head")[0] || document.documentElement ).appendChild( script_jqUi );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   125
			( document.getElementsByTagName("head")[0] || document.documentElement ).appendChild( script_swfObj );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   126
			
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   127
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   128
		};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   129
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   130
		/******** Called once all lib are loaded ******/
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   131
		var loadLib = 0;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   132
		/* FIXME : ugly */
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   133
		function scriptLoadHandler( Mylib ) {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   134
			//alert(Mylib);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   135
			loadLib +=1;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   136
			if( loadLib===3 ) { 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   137
				main(); 			  
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   138
			}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   139
		};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   140
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   141
		/******** Our main function ********/
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   142
		function main() { 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   143
			
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   144
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   145
			//  Make our own IriSP.jQuery and restore window.jQuery if there was one. 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   146
			IriSP.jQuery = window.jQuery.noConflict( true );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   147
			// Call ours Jquery
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   148
			IriSP.jQuery( document ).ready( function($) { 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   149
				
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   150
				/******* Load CSS *******/
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   151
				var css_link_jquery = IriSP.jQuery( "<link>", { 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   152
					rel: "stylesheet", 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   153
					type: "text/css", 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   154
					href: IriSP.lib.cssjQueryUI,
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   155
					'class': "dynamic_css"
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   156
				} );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   157
				var css_link_custom = IriSP.jQuery( "<link>", { 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   158
					rel: "stylesheet", 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   159
					type: "text/css", 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   160
					href: IriSP.config.gui.css,
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   161
					'class': "dynamic_css"
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   162
				} );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   163
				
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   164
				css_link_jquery.appendTo( 'head' );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   165
				css_link_custom.appendTo( 'head' );   
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   166
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   167
				// to see dynamicly loaded css on IE
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   168
				if ( $.browser.msie ) {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   169
					$( '.dynamic_css' ).clone().appendTo( 'head' );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   170
				}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   171
				
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   172
				//__IriSP.trace("main","ready createMyHtml");
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   173
				IriSP.createPlayerChrome();
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   174
				
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   175
				/******* Load Metadata *******/
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   176
				IriSP.getMetadata();
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   177
			
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   178
			});
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   179
		}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   180
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   181
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   182
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   183
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   184
__IriSP.Media = function ( id, url, duration, title, description ) {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   185
		this.id 		 	= id;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   186
		this.url 		= url;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   187
		this.title 		= title;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   188
		this.description = description;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   189
		this.duration 	= duration;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   190
		this.lignes 	  	= new Array();
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   191
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   192
		IriSP.trace( "__IriSP.Media" , "Media ID : "+id);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   193
		IriSP.trace( "__IriSP.Media" , "Media URL : "+url);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   194
		IriSP.trace( "__IriSP.Media" , "Media title : "+title);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   195
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   196
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   197
__IriSP.Media.prototype.createPlayerMedia = function ( width, height, MyStreamer, MySwfPath) {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   198
		IriSP.MyApiPlayer = new __IriSP.APIplayer( width, height, this.url, this.duration, MyStreamer, MySwfPath);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   199
		//createPlayer(width,height,this.url,this.duration,MyStreamer,MySwfPath);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   200
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   201
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   202
__IriSP.Media.prototype.getMediaDuration = function () {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   203
		return (this.duration);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   204
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   205
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   206
__IriSP.Media.prototype.getMediaTitle = function (){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   207
		return (this.title);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   208
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   209
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   210
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   211
__IriSP.APIplayer = function ( width, height, url, duration, streamerPath, MySwfPath){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   212
		
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   213
		
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   214
		this.player 			= null;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   215
		this.hashchangeUpdate 	= null;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   216
		
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   217
		this.width				= width;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   218
		this.height				= height;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   219
		this.url				= url;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   220
		this.duration			= duration;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   221
		this.streamerPath		= streamerPath;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   222
		this.MySwfPath			= MySwfPath;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   223
		
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   224
		IriSP.MyApiPlayer		= this;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   225
		
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   226
		IriSP.createPlayer( this.url, this.streamerPath );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   227
		IriSP.trace( "__IriSP.APIplayer", "__IriSP.createPlayer" );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   228
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   229
	//__IriSP.config.player
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   230
	/*
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   231
	- dailymotion  // &enableApi=1&chromeless=1
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   232
	- youtube 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   233
	- html5
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   234
	- flowplayer 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   235
	- jwplayer
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   236
	*/
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   237
		
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   238
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   239
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   240
__IriSP.APIplayer.prototype.ready = function( player ) {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   241
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   242
	//__IriSP.trace("__IriSP.APIplayer.prototype.APIpReady"," __IriSP.createInterface");
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   243
	IriSP.createInterface( this.width, this.height, this.duration );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   244
	//__IriSP.trace("__IriSP.APIplayer.prototype.APIpReady","END  __IriSP.createInterface");
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   245
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   246
	// Search
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   247
	//__IriSP.jQuery("#LdtSearchInput").change(function() {__IriSP.Search(this.value);});
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   248
	//__IriSP.jQuery("#LdtSearchInput").live('change', function(event) {__IriSP.Search(this.value);}); 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   249
	IriSP.jQuery( "#LdtSearchInput" ).keydown( function() { IriSP.Search( this.value );} );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   250
	IriSP.jQuery("#LdtSearchInput").keyup( function() { IriSP.Search( this.value );} );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   251
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   252
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   253
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   254
__IriSP.APIplayer.prototype.pause = function(){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   255
	this.hashchangeUpdate = true;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   256
	IriSP.player.sendEvent( 'PAUSE' );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   257
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   258
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   259
__IriSP.APIplayer.prototype.play  = function() {  
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   260
	this.hashchangeUpdate = true;  
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   261
  var status = IriSP.player.media.paused;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   262
      
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   263
  if ( status == true ){        
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   264
    IriSP.player.play();
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   265
  } else {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   266
    IriSP.player.pause();
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   267
  }
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   268
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   269
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   270
__IriSP.APIplayer.prototype.mute  = function() {
56
72180e18b021 A lot of cleaning up - basically replaced all player-specific code by popcorn.
hamidouk
parents: 55
diff changeset
   271
  if (!IriSP.player.muted()) {    
72180e18b021 A lot of cleaning up - basically replaced all player-specific code by popcorn.
hamidouk
parents: 55
diff changeset
   272
    IriSP.player.mute(true);
72180e18b021 A lot of cleaning up - basically replaced all player-specific code by popcorn.
hamidouk
parents: 55
diff changeset
   273
    IriSP.jQuery(" .ui-icon-volume-on ").css("background-position", "-130px -160px");    
72180e18b021 A lot of cleaning up - basically replaced all player-specific code by popcorn.
hamidouk
parents: 55
diff changeset
   274
  } else {
72180e18b021 A lot of cleaning up - basically replaced all player-specific code by popcorn.
hamidouk
parents: 55
diff changeset
   275
    IriSP.player.mute(false);
72180e18b021 A lot of cleaning up - basically replaced all player-specific code by popcorn.
hamidouk
parents: 55
diff changeset
   276
    IriSP.jQuery( ".ui-icon-volume-on" ).css("background-position", "-144px -160px" );
72180e18b021 A lot of cleaning up - basically replaced all player-specific code by popcorn.
hamidouk
parents: 55
diff changeset
   277
  }
72180e18b021 A lot of cleaning up - basically replaced all player-specific code by popcorn.
hamidouk
parents: 55
diff changeset
   278
55
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   279
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   280
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   281
__IriSP.APIplayer.prototype.share = function( network ) {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   282
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   283
	/* FIXME : remove hardcoded */
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   284
	var MyMessage = encodeURIComponent( "J'écoute Les Retours du Dimanche : " );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   285
	var MyURLNow = window.location.href;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   286
	var shareURL = null;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   287
	//alert(network+" : "+MyURLNow);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   288
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   289
	/* FIXME : use a sharing library */
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   290
	if(network == "facebook"){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   291
			shareURL = "http://www.facebook.com/share.php?u=";			
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   292
		}else if(network == "twitter"){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   293
			shareURL  = "http://twitter.com/home?status="+MyMessage;	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   294
		}else if(network == "myspace"){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   295
			shareURL ="http://www.myspace.com/Modules/PostTo/Pages/?u=";
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   296
		}else if(network == "delicious"){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   297
			shareURL = "http://delicious.com/save?url=";
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   298
		}else if(network == "JameSpot"){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   299
			shareURL = "http://www.jamespot.com/?action=spotit&u=";
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   300
			//alert(network+" non actif pour l'instant : "+MyURLNow);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   301
	}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   302
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   303
	if (shareURL != null)
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   304
		window.open( shareURL+encodeURIComponent(MyURLNow) );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   305
	//window.location.href = shareURL+encodeURIComponent(MyURLNow);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   306
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   307
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   308
__IriSP.APIplayer.prototype.seek = function (time) {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   309
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   310
	if( time==0 ) { time=1; }
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   311
	
56
72180e18b021 A lot of cleaning up - basically replaced all player-specific code by popcorn.
hamidouk
parents: 55
diff changeset
   312
	IriSP.trace( "__IriSP.APIplayer.prototype.seek", time );	
72180e18b021 A lot of cleaning up - basically replaced all player-specific code by popcorn.
hamidouk
parents: 55
diff changeset
   313
	IriSP.player.currentTime( time );		
55
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   314
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   315
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   316
IriSP.currentPosition 	= 0; 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   317
IriSP.player 			= null;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   318
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   319
IriSP.createPlayer = function ( url, streamerPath ) {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   320
  IriSP.jQuery("#Ldt-PlaceHolder").html(""); // clear the message "you need flash to display this player
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   321
  
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   322
	if( IriSP.config.player.type=='dailymotion' ) {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   323
  
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   324
		IriSP.config.player.src = IriSP.config.player.src+"&chromeless=1&enableApi=1";
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   325
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   326
  } else if ( IriSP.config.player.type=='youtube' ) {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   327
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   328
    
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   329
    templ = "width: {{width}}px; height: {{height}}px; margin-bottom: 5px;";
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   330
    var str = Mustache.to_html(templ, {width: IriSP.config.gui.width, height: IriSP.config.gui.height});    
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   331
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   332
    // Popcorn.youtube wants us to specify the size of the player in the style attribute of its container div.
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   333
    IriSP.jQuery("#Ldt-PlaceHolder").attr("style", str);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   334
    
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   335
    IriSP.player = Popcorn.youtube( '#Ldt-PlaceHolder', IriSP.config.player.src, {"controls": 0} );    
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   336
    
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   337
	} else if ( IriSP.config.player.type=='jwplayer' ) {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   338
    
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   339
    // for some reason, a stream won't play when it's display: none;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   340
    IriSP.jQuery("#Ldt-PlaceHolder").attr("style", "visibility: hidden;");
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   341
    IriSP.player = Popcorn.jwplayer( '#Ldt-PlaceHolder', "", 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   342
                                     {file : "video/franceculture/franceculture_retourdudimanche20100620.flv", streamer: streamerPath, flashplayer : IriSP.config.player.src,
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   343
                                     live: true, "controlbar.position" : "none", height: IriSP.config.gui.height, width: IriSP.config.gui.width, provider: "rtmp"} ); 
56
72180e18b021 A lot of cleaning up - basically replaced all player-specific code by popcorn.
hamidouk
parents: 55
diff changeset
   344
                               
55
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   345
  }
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   346
 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   347
  IriSP.player.listen("timeupdate", IriSP.positionListener);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   348
  IriSP.player.listen("volumechange", IriSP.volumeListener);
56
72180e18b021 A lot of cleaning up - basically replaced all player-specific code by popcorn.
hamidouk
parents: 55
diff changeset
   349
  IriSP.player.listen("play", IriSP.stateMonitor);
72180e18b021 A lot of cleaning up - basically replaced all player-specific code by popcorn.
hamidouk
parents: 55
diff changeset
   350
  IriSP.player.listen("pause", IriSP.stateMonitor);
55
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   351
  IriSP.MyApiPlayer.ready();
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   352
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   353
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   354
56
72180e18b021 A lot of cleaning up - basically replaced all player-specific code by popcorn.
hamidouk
parents: 55
diff changeset
   355
IriSP.stateMonitor = function () {      
72180e18b021 A lot of cleaning up - basically replaced all player-specific code by popcorn.
hamidouk
parents: 55
diff changeset
   356
	 if(IriSP.player.paused()) {				    
72180e18b021 A lot of cleaning up - basically replaced all player-specific code by popcorn.
hamidouk
parents: 55
diff changeset
   357
		IriSP.jQuery( ".ui-icon-play" ).css( "background-position","0px -160px" );
72180e18b021 A lot of cleaning up - basically replaced all player-specific code by popcorn.
hamidouk
parents: 55
diff changeset
   358
    IriSP.jQuery( "#ldt-CtrlPlay" ).attr("title", "Pause");
72180e18b021 A lot of cleaning up - basically replaced all player-specific code by popcorn.
hamidouk
parents: 55
diff changeset
   359
	} else { /* playing */	
72180e18b021 A lot of cleaning up - basically replaced all player-specific code by popcorn.
hamidouk
parents: 55
diff changeset
   360
		IriSP.jQuery( ".ui-icon-play" ).css( "background-position", "-16px -160px" );
72180e18b021 A lot of cleaning up - basically replaced all player-specific code by popcorn.
hamidouk
parents: 55
diff changeset
   361
    IriSP.jQuery( "#ldt-CtrlPlay" ).attr("title", "Play");
55
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   362
	}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   363
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   364
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   365
IriSP.positionListener = function() {  	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   366
	IriSP.currentPosition = IriSP.player.currentTime(); 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   367
  
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   368
	var tmp = document.getElementById( "posit" );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   369
	if (tmp) { tmp.innerHTML = "position: " + IriSP.currentPosition; }
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   370
	IriSP.jQuery( "#slider-range-min" ).slider( "value", IriSP.currentPosition);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   371
	IriSP.jQuery( "#amount" ).val(IriSP.currentPosition+" s");
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   372
	// display annotation 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   373
	IriSP.MyLdt.checkTime( IriSP.currentPosition );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   374
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   375
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   376
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   377
IriSP.volumeListener   = function (obj) { 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   378
	IriSP.currentVolume = obj.volume; 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   379
	var tmp = document.getElementById("vol");
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   380
	if (tmp) { tmp.innerHTML = "volume: " + IriSP.currentVolume; }
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   381
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   382
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   383
/* 	utils */
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   384
// code from http://stackoverflow.com/questions/822452/strip-html-from-text-javascript
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   385
/* FIXME: maybe make it a little more robust */
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   386
IriSP.stripHtml = function(s){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   387
	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;');
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   388
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   389
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   390
// conversion de couleur Decimal vers HexaDecimal || 000 si fff
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   391
/* FIXME : move it somewhere else */
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   392
IriSP.DEC_HEXA_COLOR = function (dec) {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   393
	 var hexa='0123456789ABCDEF',hex='';
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   394
	 var tmp;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   395
	 while (dec>15){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   396
		  tmp = dec-(Math.floor(dec/16))*16;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   397
		  hex = hexa.charAt(tmp)+hex;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   398
		  dec = Math.floor(dec/16);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   399
	 }
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   400
	 hex = hexa.charAt(dec)+hex;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   401
	 if (hex == "FFCC00"){ hex="";/* by default color of Ldt annotation */ }
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   402
	 return(hex);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   403
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   404
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   405
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   406
/* Search  methods	*/
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   407
IriSP.SearchOldValue="";
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   408
IriSP.searchblockOpen=false;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   409
IriSP.searchblock = function () {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   410
	IriSP.trace( "__IriSP.searchblock", IriSP.searchblockOpen );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   411
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   412
	if ( IriSP.searchblockOpen == false ) {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   413
		IriSP.jQuery( ".ui-icon-search" ).css( "background-position", "-144px -112px" );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   414
		//__IriSP.jQuery("#LdtSearch").animate({height:26},250);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   415
		IriSP.jQuery("#LdtSearch").show(250);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   416
		/* FIXME : refactor this */
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   417
		IriSP.jQuery("#LdtSearchInput").css('background-color','#fff');
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   418
		IriSP.jQuery("#LdtSearchInput").focus();
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   419
		IriSP.jQuery("#LdtSearchInput").attr('value',IriSP.SearchOldValue);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   420
		IriSP.Search(IriSP.SearchOldValue);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   421
		IriSP.searchblockOpen = true;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   422
	} else {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   423
		IriSP.SearchOldValue = IriSP.jQuery("#LdtSearchInput").attr('value');
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   424
		IriSP.jQuery("#LdtSearchInput").attr('value','');
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   425
		IriSP.SearchClean();
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   426
		IriSP.jQuery(".ui-icon-search").css("background-position","-160px -112px");
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   427
		//__IriSP.jQuery("#LdtSearch").animate({height:0},250);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   428
		IriSP.jQuery("#LdtSearch").hide(250);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   429
		IriSP.searchblockOpen = false;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   430
	}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   431
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   432
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   433
/* Search with typeahead */
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   434
IriSP.Search = function ( value ){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   435
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   436
	annotations = IriSP.LDTligne.annotations;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   437
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   438
	IriSP.trace("__IriSP.Search", annotations.length+" "+value);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   439
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   440
	var found  = 0;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   441
	var findmem = 0;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   442
	var factor  = 0;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   443
	IriSP.trace(value,value.length);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   444
	var valueS = value.toLowerCase();
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   445
	IriSP.trace("__IriSP.Search", annotations.length+" "+valueS);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   446
	if(valueS.length>=3){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   447
		
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   448
		for (var i=0; i < annotations.length; ++i){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   449
			annotation = annotations[i];
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   450
			
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   451
			IriSP.jQuery("#output2").text(annotation.title+" ?= "+value);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   452
			
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   453
			chaine1 = annotation.title.toLowerCase();
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   454
			chaine2 = annotation.description.toLowerCase();
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   455
			chaine3 = annotation.htmlTags.toLowerCase();
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   456
			
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   457
			if(chaine1.indexOf(valueS,0) !=-1){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   458
				found+=1;	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   459
			}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   460
			if(chaine2.indexOf(valueS,0) !=-1){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   461
				found+=1;	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   462
			}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   463
			if(chaine3.indexOf(valueS,0) !=-1){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   464
				found+=1;	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   465
			}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   466
			
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   467
			findmem += found;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   468
			if(found>0){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   469
				factor = found*8;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   470
				IriSP.jQuery("#"+annotation.id).dequeue();
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   471
				IriSP.jQuery("#"+annotation.id).animate({height:factor},200);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   472
				IriSP.jQuery("#"+annotation.id).css('border','2px');
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   473
				IriSP.jQuery("#"+annotation.id).css('border-color','red');
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   474
				IriSP.jQuery("#"+annotation.id).animate({opacity:0.6},200);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   475
				
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   476
				IriSP.trace("!!!!!!!!!!!!!!!!!!"," ?= "+annotation.id);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   477
				IriSP.jQuery("#LdtSearchInput").css('background-color','#e1ffe1');
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   478
			}else {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   479
				IriSP.jQuery("#"+annotation.id).dequeue();
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   480
				IriSP.jQuery("#"+annotation.id).animate({height:0},250);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   481
				IriSP.jQuery("#"+annotation.id).animate({opacity:0.3},200);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   482
			}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   483
			
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   484
			found = 0;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   485
		}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   486
		if(findmem==0){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   487
				IriSP.jQuery("#LdtSearchInput").css('background-color','#f6f6f6');
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   488
		}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   489
		
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   490
	} else if(value.length==0){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   491
		IriSP.SearchClean();
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   492
		IriSP.jQuery("#LdtSearchInput").css('background-color','#fff');		
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   493
	} else {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   494
		IriSP.SearchClean();
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   495
		IriSP.jQuery("#LdtSearchInput").css('background-color','#f6f6f6');
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   496
	}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   497
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   498
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   499
IriSP.SearchClean = function (){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   500
	annotations = IriSP.LDTligne.annotations;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   501
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   502
	for (var i=0; i < annotations.length; ++i){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   503
			annotation = annotations[i];
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   504
			IriSP.jQuery("#"+annotation.id).dequeue();
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   505
			IriSP.jQuery("#"+annotation.id).animate({height:0},100);	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   506
			IriSP.jQuery("#"+annotation.id).css('border','0px');
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   507
			IriSP.jQuery("#"+annotation.id).css('border-color','red');
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   508
			IriSP.jQuery("#"+annotation.id).animate({opacity:0.3},100);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   509
		}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   510
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   511
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   512
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   513
IriSP.SearchThisSegment = function (annotation){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   514
	/* FIXME: to implement */
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   515
					IriSP.jQuery("#LdtSearchInput").text(annotation.title);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   516
					IriSP.trace("__IriSP.Ligne.prototype.checkTimeLigne",annotation.title);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   517
					/*__IriSP.jQuery("#Ldt-SaDescription").text(annotationTempo.description);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   518
					__IriSP.jQuery("#Ldt-SaKeywordText").html("Mots clefs : "+annotationTempo.htmlTags);*/
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   519
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   520
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   521
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   522
/* CLASS Ligne (annotationType) 	*/
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   523
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   524
IriSP.LDTligne 	= null;		
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   525
__IriSP.Ligne = function( id, title, description, duration ) {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   526
	this.id 		 = id;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   527
	this.title 		 = title;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   528
	this.description = description;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   529
	//
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   530
	this.annotations = new Array();
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   531
	this.duration = duration;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   532
	this.annotationOldRead = "";
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   533
	IriSP.LDTligne = this;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   534
	IriSP.trace("__IriSP.Ligne","CREATE "+IriSP.LDTligne);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   535
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   536
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   537
__IriSP.Ligne.prototype.addAnnotation = function ( id, begin, end, media, title, description, color, tags ) {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   538
	var myAnnotation = new __IriSP.Annotation(id,begin,end,media,title,description,color,tags,this.duration);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   539
	this.annotations.push(myAnnotation);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   540
	//__IriSP.trace("__IriSP.Ligne.prototype.addAnnotation  ","add annotation "+title);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   541
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   542
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   543
__IriSP.Ligne.prototype.onClickLigneAnnotation = function( id ) {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   544
	/* TODO implement */
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   545
	//changePageUrlOffset(currentPosition);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   546
	//player.sendEvent('SEEK', this.start);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   547
	//__IriSP.trace("SEEK",this.start);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   548
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   549
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   550
__IriSP.Ligne.prototype.searchLigneAnnotation = function( id ) {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   551
	/* TODO implement */
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   552
	/*for (){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   553
	}*/
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   554
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   555
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   556
__IriSP.Ligne.prototype.listAnnotations = function() {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   557
	/* TODO implement */
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   558
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   559
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   560
__IriSP.Ligne.prototype.nextAnnotation = function () {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   561
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   562
	var annotationCibleNumber = this.numAnnotation(this.annotationOldRead)+1;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   563
	var annotationCible = this.annotations[annotationCibleNumber];  
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   564
  
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   565
	if( annotationCibleNumber<this.annotations.length-1 ){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   566
		IriSP.player.currentTime(annotationCible.begin/1000);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   567
		IriSP.trace( "LIGNE  ", "| next = "+annotationCibleNumber+" - "+this.annotations.length+" | seek :"+annotationCible.begin/1000);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   568
	} else {    
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   569
		IriSP.player.currentTime(this.annotations[0].begin/1000);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   570
	}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   571
		
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   572
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   573
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   574
__IriSP.Ligne.prototype.numAnnotation = function (annotationCible){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   575
	for (var i=0; i < this.annotations.length; ++i){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   576
		if(annotationCible == this.annotations[i]){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   577
			return i;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   578
		}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   579
	}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   580
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   581
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   582
__IriSP.Ligne.prototype.checkTime = function(time){	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   583
	var annotationTempo = -1;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   584
	//__IriSP.trace("__IriSP.Ligne.prototype.checkTimeLigne",time);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   585
	//__IriSP.trace("__IriSP.Ligne.prototype.checkTimeLigne",this.annotations.length);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   586
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   587
	for (var i=0; i < this.annotations.length; ++i){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   588
		annotationTempo = this.annotations[i];	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   589
		
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   590
		//__IriSP.SearchThisSegment(annotationTempo);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   591
		
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   592
		if (time>annotationTempo.begin/1000 && time<annotationTempo.end/1000){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   593
			
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   594
				// different form the previous
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   595
				if(annotationTempo!=this.annotationOldRead){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   596
					this.annotationOldRead = annotationTempo;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   597
					IriSP.jQuery("#Ldt-SaTitle").text(annotationTempo.title);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   598
					IriSP.jQuery("#Ldt-SaDescription").text(annotationTempo.description);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   599
					IriSP.jQuery("#Ldt-SaKeywordText").html("Mots clefs : "+annotationTempo.htmlTags);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   600
					
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   601
					//__IriSP.jQuery('#Ldt-ShowAnnotation').slideDown();
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   602
					var startPourcent 	= annotationTempo.timeToPourcent((annotationTempo.begin*1+(annotationTempo.end*1-annotationTempo.begin*1)/2),annotationTempo.duration*1); 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   603
					IriSP.jQuery("#Ldt-Show-Arrow").animate({left:startPourcent+'%'},1000);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   604
					IriSP.jQuery("#"+annotationTempo.id).animate({alpha:'100%'},1000);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   605
					//alert(startPourcent);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   606
					var tempolinkurl  =  IriSP.ignoreTimeFragment(window.location.href)+"#t="+(this.annotations[i].begin/1000);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   607
				}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   608
			break;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   609
		} else {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   610
		annotationTempo = -1;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   611
		}		
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   612
		
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   613
	}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   614
	// si il y en a pas : retractation du volet 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   615
	if( annotationTempo == -1){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   616
		if(annotationTempo != this.annotationOldRead){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   617
			IriSP.trace("Check : ","pas d'annotation ici ");
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   618
			IriSP.jQuery("#Ldt-SaTitle").text("");
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   619
			IriSP.jQuery("#Ldt-SaDescription").text("");
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   620
			IriSP.jQuery("#Ldt-SaKeywordText").html("");
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   621
			IriSP.jQuery('#Ldt-ShowAnnotation').slideUp();
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   622
			if(this.annotationOldRead){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   623
				IriSP.jQuery("#"+this.annotationOldRead.id).animate({alpha:'70%'},1000);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   624
			}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   625
			//__IriSP.jQuery("#Ldt-Show-Arrow").animate({left:'0%'},1000);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   626
			this.annotationOldRead = annotationTempo;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   627
		}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   628
	}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   629
	//__IriSP.trace("__IriSP.Ligne.prototype.checkTimeLigne",annotationTempo);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   630
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   631
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   632
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   633
/* CLASS Annotation */
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   634
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   635
__IriSP.Annotation = function (){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   636
	var id 	= null;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   637
	var begin 			= null;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   638
	var end 			= null;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   639
	var media 			= null;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   640
	var description	= null;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   641
	var title 			= null;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   642
	var color 			= null;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   643
	var tags			= null;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   644
	IriSP.trace("annotation ","réussi");
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   645
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   646
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   647
__IriSP.Annotation = function( id, begin, end, media, title, description, color, tags, duration ){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   648
	this.id 			= id;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   649
	this.begin 			= begin;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   650
	this.end 			= end;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   651
	this.media 			= media;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   652
	this.description 	= description;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   653
	this.title 			= title;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   654
	this.color 			= color;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   655
	this.tags			= tags;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   656
	this.htmlTags		= "";
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   657
	this.duration		= duration;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   658
	// draw it 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   659
	this.draw();
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   660
	this.drawTags();
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   661
	//
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   662
	IriSP.trace("Annotation created : ",id);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   663
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   664
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   665
__IriSP.Annotation.prototype.draw = function(){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   666
	//alert (this.duration);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   667
	var startPourcent 	= this.timeToPourcent(this.begin,this.duration); // temps du media 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   668
	var endPourcent 	= this.timeToPourcent(this.end,this.duration)-startPourcent;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   669
	var divTitle		= this.title.substr(0,55);	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   670
		
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   671
	IriSP.jQueryAnnotationTemplate = Mustache.to_html(IriSP.annotation_template,
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   672
			{"divTitle" : divTitle, "id" : this.id, "startPourcent" : startPourcent,
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   673
			"endPourcent" : endPourcent, "hexa_color" : IriSP.DEC_HEXA_COLOR(this.color),
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   674
			"seekPlace" : Math.round(this.begin/1000)});
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   675
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   676
	IriSP.jQuerytoolTipTemplate = Mustache.to_html(IriSP.tooltip_template, 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   677
				{"title" : this.title, "begin" : this.begin, "end" : this.end,
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   678
				"description": this.description});
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   679
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   680
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   681
	IriSP.jQuery("<div>"+IriSP.jQueryAnnotationTemplate+"</div>").appendTo("#Ldt-Annotations");
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   682
	// TOOLTIP BUG ! 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   683
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   684
	IriSP.jQuery("#"+this.id).tooltip({ effect: 'slide'});
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   685
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   686
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   687
	IriSP.jQuery("#"+this.id).fadeTo(0,0.3);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   688
	IriSP.jQuery("#"+this.id).mouseover(function() {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   689
		IriSP.jQuery("#"+this.id).animate({opacity: 0.6}, 5);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   690
	}).mouseout(function(){		
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   691
		IriSP.jQuery("#"+this.id).animate({opacity: 0.3}, 5);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   692
	});
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   693
	IriSP.trace("__IriSP.Annotation.prototype.draw","ADD ANOTATION : "+this.begin+" "+this.end+" "+IriSP.stripHtml(this.title)+" | "+startPourcent+" | "+endPourcent+" | duration = "+this.duration);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   694
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   695
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   696
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   697
__IriSP.Annotation.prototype.drawTags = function(){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   698
	/* FIXME : to implement */
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   699
	var KeywordPattern = '<a href=\"\"> '+' </a>';
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   700
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   701
	//__IriSP.trace(" !? Tags : ",this.tags);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   702
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   703
	if (this.tags!=undefined){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   704
		for (var i = 0; i < this.tags.length; ++i){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   705
			
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   706
			//this.htmlTags += '<span onclick=\"ShowTag('+this.tags[i]['id-ref']+');\"  > '+MyTags.getTitle(this.tags[i]['id-ref'])+' </span>'+" , ";
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   707
			this.htmlTags += '<span> '+IriSP.MyTags.getTitle(this.tags[i]['id-ref'])+' </span>'+" , ";
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   708
			
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   709
		}		
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   710
	}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   711
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   712
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   713
__IriSP.Annotation.prototype.tootTipAnnotation = function() {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   714
	// 1 chercher le div correspondant
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   715
	// 2 y mettre les information
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   716
	return this.color + ' ' + this.type + ' apple';
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   717
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   718
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   719
__IriSP.Annotation.prototype.onRollOverAnnotation = function (){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   720
	this.tootTip();
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   721
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   722
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   723
__IriSP.Annotation.prototype.timeToPourcent = function(time,timetotal){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   724
	return (parseInt(Math.round(time/timetotal*100)));
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   725
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   726
 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   727
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   728
/* CLASS Tags */
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   729
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   730
__IriSP.Tags = function(object){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   731
	this.myTags 	=	object;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   732
	this.htmlTags 	= 	null;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   733
	this.weigthMax 	= 	0;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   734
	//this.mySegments  = 	new array();
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   735
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   736
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   737
__IriSP.Tags.prototype.addAnnotation = function (annotation){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   738
	for (var i = 0; i < this.myTags.length; ++i){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   739
		this.myTags[i].mySegments = new Array(); 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   740
		if (annotation.tags!=null){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   741
			for (var j = 0; j < annotation.tags.length; ++j){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   742
				if (this.myTags[i]['id'] == annotation.tags[j]['id-ref']){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   743
					this.myTags[i].mySegments.push([annotation.begin,annotation.end,annotation.id]);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   744
					var weigthTempo = this.myTags[i].mySegments.length;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   745
					var tempo = this.myTags[i].mySegments[weigthTempo-1];
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   746
					//__IriSP.trace ("__IriSP.Tags.prototype.addAnnotation ","  "+this.myTags[i]['meta']['dc:title']+" "+this.myTags[i]['id']+" : "+tempo[0]+" - "+tempo[1]);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   747
					
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   748
					if (this.weigthMax < weigthTempo ){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   749
						this.weigthMax = weigthTempo;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   750
					}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   751
				}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   752
			}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   753
		}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   754
	}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   755
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   756
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   757
__IriSP.Tags.prototype.getTitle = function (id){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   758
	for (var i = 0; i < this.myTags.length; ++i){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   759
		if(this.myTags[i]['id']==id){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   760
			return(this.myTags[i]['meta']['dc:title']);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   761
		}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   762
	}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   763
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   764
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   765
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   766
__IriSP.Tags.prototype.draw = function (){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   767
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   768
	IriSP.trace("__IriSP.Tags.prototype.draw"," !!! WELL START " );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   769
	for (var i = 0; i < this.myTags.length; ++i){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   770
		IriSP.trace("__IriSP.Tags.prototype.draw"," ADD Tags : "+this.myTags[i]['id']);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   771
		if(this.myTags[i]['id']!=null){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   772
		this.htmlTags += '<span onclick=\"MyTags.show( \''+this.myTags[i]['id']
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   773
						+'\');\" style=\"font-size:'  +((this.myTags[i].mySegments.length/this.weigthMax*10)+8)
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   774
						+'px;\" alt=\"'+this.myTags[i].mySegments.length
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   775
						+'\"> '+this.myTags[i]['meta']['dc:title']+' </span>'+' , ';
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   776
		}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   777
	}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   778
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   779
	IriSP.jQuery('#Ldt-Tags').html(this.htmlTags);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   780
	IriSP.trace("__IriSP.Tags.prototype.draw"," !!!!  END WMAX= "+this.weigthMax );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   781
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   782
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   783
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   784
__IriSP.Tags.prototype.show = function (id){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   785
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   786
	var timeStartOffsetA	=	100000000000000000000;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   787
	var timeStartOffsetB	=	100000000000000000000;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   788
	var timeEndOffsetA		=	0;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   789
	var timeEndOffsetB		=	0;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   790
	var timeStartID;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   791
	var timeEndID;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   792
	var WidthPourCent;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   793
	var leftPourCent;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   794
	var timeStartOffset;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   795
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   796
	// case 1 : seul segment 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   797
	// case 2 : 2 ou X segments 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   798
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   799
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   800
	for (var i = 0; i < this.myTags.length; ++i){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   801
		if (this.myTags[i]['id']==id){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   802
			IriSP.trace("######### TAG DRAWing : "," END" );		
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   803
			
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   804
			for (var j = 0; j < this.myTags[i].mySegments.length; ++j){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   805
				if(timeStartOffset> this.myTags[i].mySegments[j][0]){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   806
					timeStartOffsetA = this.myTags[i].mySegments[j][0];
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   807
					timeStartOffsetB = this.myTags[i].mySegments[j][1];
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   808
					timeStartID		 = this.myTags[i].mySegments[j][2]
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   809
				}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   810
				if(timeStartOffset> this.myTags[i].mySegments[j][0]){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   811
					timeEndOffsetA  = this.myTags[i].mySegments[j][0];
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   812
					timeEndOffsetB  = this.myTags[i].mySegments[j][1];
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   813
					timeEndID		= this.myTags[i].mySegments[j][2]
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   814
				}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   815
			}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   816
			
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   817
		}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   818
	}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   819
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   820
	// -------------------------------------------------
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   821
	// 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   822
	// -------------------------------------------------
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   823
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   824
	leftPourCent 	= IriSP.timeToPourcent((timeStartOffsetA*1+(timeStartOffsetB-timeStartOffsetA)/2),IriSP.MyLdt.duration); 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   825
	WidthPourCent	= IriSP.timeToPourcent((timeEndOffsetA*1+(timeEndOffsetB-timeEndOffsetA)/2),IriSP.MyLdt.duration)-leftPourCent; 			
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   826
	//WidthPourCent	= timeToPourcent((timeEndOffsetA*1+(timeEndOffsetB-timeEndOffsetA)/2),MyLdt.duration)-startPourcent; 			
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   827
	IriSP.jQuery("#Ldt-Show-Tags").css('left',leftPourCent+'%');
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   828
	IriSP.jQuery("#Ldt-Show-Tags").css('width',WidthPourCent+'%');
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   829
	IriSP.jQuery("#Ldt-Show-Tags").text('joijoij');
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   830
	// like arrow script
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   831
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   832
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   833
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   834
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   835