src/js/LdtPlayer.js
author hamidouk
Mon, 10 Oct 2011 13:55:37 +0200
branchpopcorn-port
changeset 55 a5440e1a18a8
parent 43 59a78986f19e
child 56 72180e18b021
permissions -rw-r--r--
A bunch of changes to make the code use popcorn. Bumped the version of jwplayer we were using.
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
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
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   215
/*  FIXME : API player - work in progress ... need refactoring of code */ 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   216
__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
   217
		
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   218
		
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   219
		this.player 			= null;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   220
		this.hashchangeUpdate 	= null;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   221
		
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   222
		this.width				= width;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   223
		this.height				= height;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   224
		this.url				= url;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   225
		this.duration			= duration;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   226
		this.streamerPath		= streamerPath;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   227
		this.MySwfPath			= MySwfPath;
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.MyApiPlayer		= this;
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
		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
   232
		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
   233
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   234
	//__IriSP.config.player
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   235
	/*
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   236
	- 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
   237
	- youtube 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   238
	- html5
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   239
	- flowplayer 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   240
	- jwplayer
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
		
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   243
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   244
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   245
__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
   246
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   247
	//__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
   248
	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
   249
	//__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
   250
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
	// hashchange EVENT
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   253
	if ( window.addEventListener ){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   254
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   255
	// for firefox  hashchange EVENT
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   256
		window.addEventListener( "hashchange", function() {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   257
		  var url = window.location.href;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   258
		  var time = IriSP.retrieveTimeFragment( url );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   259
		  IriSP.trace( "__IriSP.APIplayer.prototype.ready", time );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   260
		  if( IriSP.MyApiPlayer.hashchangeUpdate==null ){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   261
			IriSP.MyApiPlayer.seek( time );
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
		  } else {			  
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   264
			IriSP.MyApiPlayer.hashchangeUpdate = null;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   265
		  }
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   266
		}, false );
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
	} else if (window.attachEvent){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   269
	// for ie hashchange EVENT
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   270
		window.attachEvent( "onhashchange", function() {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   271
		  IriSP.trace( "hashchange",time );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   272
		  var url = window.location.href;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   273
		  var time = IriSP.retrieveTimeFragment( url );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   274
		  if( IriSP.MyApiPlayer.hashchangeUpdate == null ){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   275
			IriSP.MyApiPlayer.seek(time);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   276
		  } else {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   277
			IriSP.MyApiPlayer.hashchangeUpdate = null;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   278
		  }
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   279
		}, false);
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
	*/
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   282
	// Search
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   283
	//__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
   284
	//__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
   285
	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
   286
	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
   287
	
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
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   290
__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
   291
	this.hashchangeUpdate = true;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   292
	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
   293
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   294
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   295
__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
   296
	this.hashchangeUpdate = true;  
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   297
  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
   298
      
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   299
  if ( status == true ){        
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   300
    IriSP.player.play();
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   301
  } else {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   302
    IriSP.player.pause();
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   303
  }
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   304
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   305
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   306
__IriSP.APIplayer.prototype.mute  = function() {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   307
	IriSP.player.sendEvent( 'MUTE' );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   308
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   309
	//alert(__IriSP.jQuery(".ui-icon-volume-on").css("background-position-x"));
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   310
	/* FIXME : remove hardcoded values */
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   311
	if ( IriSP.jQuery( ".ui-icon-volume-on" ).css( "background-position" ) == "-144px -160px" ){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   312
		IriSP.jQuery(" .ui-icon-volume-on ").css(" background-position ", "-130px -160px");
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   313
	} else {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   314
		IriSP.jQuery( ".ui-icon-volume-on" ).css( "background-position", "-144px -160px" );
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
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   317
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   318
/* FIXME : rename */
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   319
__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
   320
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   321
	/* FIXME : remove hardcoded */
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   322
	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
   323
	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
   324
	var shareURL = null;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   325
	//alert(network+" : "+MyURLNow);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   326
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   327
	/* 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
   328
	if(network == "facebook"){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   329
			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
   330
		}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
   331
			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
   332
		}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
   333
			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
   334
		}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
   335
			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
   336
		}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
   337
			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
   338
			//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
   339
	}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   340
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   341
	if (shareURL != null)
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   342
		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
   343
	//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
   344
};
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
__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
   347
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   348
	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
   349
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   350
	IriSP.trace( "__IriSP.APIplayer.prototype.seek", time );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   351
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   352
	IriSP.player.currentTime( time );	
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
	//this.changePageUrlOffset( time );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   355
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   356
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   357
__IriSP.APIplayer.prototype.update = function (time) {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   358
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   359
	if( time != 0 ) {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   360
		this.hashchangeUpdate = true;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   361
		
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   362
		IriSP.trace( "__IriSP.APIplayer.prototype.update" ,time);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   363
		IriSP.player.sendEvent( 'SEEK', time );
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
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   366
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   367
__IriSP.APIplayer.prototype.changePageUrlOffset = function ( time ) {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   368
	//alert(time);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   369
  IriSP.trace( "__IriSP.APIplayer.prototype.changePageUrlOffset" , "CHANGE URL "+ time);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   370
  
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   371
  window.location.hash = "#t=" + time;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   372
  window.location.href =  window.location.href;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   373
  
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
/* Media Fragment functionality by Silvia Pfeiffer */ 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   377
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   378
IriSP.jumpToTimeoffset = function ( form ) {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   379
	var time = form.time.value;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   380
	IriSP.MyApiPlayer.changePageUrlOffset( time );
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
IriSP.retrieveTimeFragment = function ( url ) {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   384
  var pageoffset = 0;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   385
  var offsettime = 0;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   386
  
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   387
  if ( url.split("#")[1] != null ) {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   388
	pageoffset = url.split( "#" )[1];
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   389
		if ( pageoffset.substring( 2 ) != null ) {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   390
			offsettime = pageoffset.substring( 2 );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   391
		}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   392
	}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   393
	return offsettime;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   394
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   395
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   396
IriSP.ignoreTimeFragment = function( url ){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   397
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   398
	var pageurl = url;
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
	if ( url.split( "#" )[1] != null ) {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   401
		pageurl = url.split( "#" )[0];
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   402
	}
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
	return pageurl;
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
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   407
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   408
/* code specific to jwplayer / creation and listener */
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   409
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   410
IriSP.currentPosition 	= 0; 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   411
IriSP.currentVolume   	= 50; 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   412
IriSP.player 			= null;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   413
IriSP.startPosition 	= null;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   414
IriSP.firstplay	 		= false;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   415
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   416
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   417
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   418
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
   419
  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
   420
  
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   421
	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
   422
  
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   423
		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
   424
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   425
  } 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
   426
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   427
    
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   428
    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
   429
    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
   430
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   431
    // 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
   432
    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
   433
    
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   434
    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
   435
    
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   436
	} 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
   437
    
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   438
    // 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
   439
    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
   440
    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
   441
                                     {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
   442
                                     live: true, "controlbar.position" : "none", height: IriSP.config.gui.height, width: IriSP.config.gui.width, provider: "rtmp"} ); 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   443
    
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   444
    /*
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   445
    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
   446
                                     {file : "/mdp/video.mp4", 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
   447
                                     "controlbar.position" : "none", height: 300, width: 360, "duration" : 18} );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   448
    */                              
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   449
  }
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.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
   452
  IriSP.player.listen("volumechange", IriSP.volumeListener);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   453
  IriSP.MyApiPlayer.ready();
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   454
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   455
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
/* jw player api */
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   458
IriSP.playerReady  = function (thePlayer) {
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
	//__IriSP.trace("__IriSP.playerReady","PLAYER READY !!!!!!!!!!!!");
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   461
	IriSP.player = window.document[thePlayer.id];
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   462
	//__IriSP.trace("__IriSP.playerReady","API CALL "+__IriSP.player);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   463
	IriSP.MyApiPlayer.ready( IriSP.player );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   464
	//__IriSP.trace("__IriSP.playerReady","API CALL END ");
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
	var url = document.location.href;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   467
	var time = IriSP.retrieveTimeFragment( url );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   468
	//__IriSP.trace("__IriSP.playerReady"," "+url+" "+time );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   469
	IriSP.startPosition = time;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   470
	//__IriSP.trace("__IriSP.playerReady"," LISTENER LAUCHER");
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   471
	IriSP.addListeners();	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   472
	//__IriSP.trace("__IriSP.playerReady"," LISTENER END");
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   473
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   474
};
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.addListeners = function () {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   477
	if ( IriSP.player ) { 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   478
		IriSP.trace("__IriSP.addListeners","ADD  Listener ");
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   479
		IriSP.player.addModelListener( "TIME", "__IriSP.positionListener");
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   480
		IriSP.player.addControllerListener( "VOLUME", "__IriSP.volumeListener" );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   481
		IriSP.player.addModelListener( 'STATE', '__IriSP.stateMonitor' );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   482
	} else {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   483
		IriSP.setTimeout( "__IriSP.addListeners()", 100 );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   484
	}
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
	// et changer les boutons
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   487
};
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
IriSP.stateMonitor = function ( obj ) { 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   490
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   491
	 if(obj.newstate == 'PAUSED') {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   492
		IriSP.trace( "__IriSP.stateMonitor", "PAUSE" );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   493
		IriSP.MyApiPlayer.changePageUrlOffset( IriSP.currentPosition );			
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   494
		IriSP.jQuery( ".ui-icon-play" ).css( "background-position","0px -160px" );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   495
		
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   496
	} else if (obj.newstate == 'PLAYING' ){
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
		IriSP.trace( "__IriSP.stateMonitor", "PLAYING "+IriSP.startPosition );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   499
		
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   500
		// force buffering even if autostart is disabled. 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   501
		if ( IriSP.config.player.flashvars.autostart == "false" && IriSP.firstplay == false && IriSP.startPosition == 0 ) {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   502
			IriSP.trace("__IriSP.stateMonitor","first stop ???");
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   503
			IriSP.MyApiPlayer.play();
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   504
			IriSP.firstplay = true;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   505
			IriSP.MyLdt.checkTime( 1 );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   506
		}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   507
		
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   508
		// once that the video is loaded, move it to the correct timecode
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   509
		if( IriSP.startPosition!=null ){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   510
			IriSP.MyApiPlayer.update( IriSP.startPosition );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   511
			IriSP.startPosition = null;
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
		
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   514
		
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   515
		IriSP.jQuery( ".ui-icon-play" ).css( "background-position", "-16px -160px" );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   516
	} else if (obj.newstate == 'BUFFERING'){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   517
		IriSP.trace( "__IriSP.stateMonitor", "BUFFERING : "+IriSP.config.player.flashvars.autostart );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   518
		//changePageUrlOffset(currentPosition);
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
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   523
IriSP.positionListener = function() {  	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   524
	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
   525
  
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   526
	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
   527
	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
   528
	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
   529
	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
   530
	// display annotation 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   531
	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
   532
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   533
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   534
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   535
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
   536
	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
   537
	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
   538
	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
   539
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   540
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
/* dailymotion api 	*/
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   543
onDailymotionPlayerReady = function (playerid) {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   544
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   545
	//alert(playerid);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   546
	IriSP.player = document.getElementById( IriSP.config.player.attributes.id );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   547
	IriSP.MyApiPlayer.ready( IriSP.player );
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
	var url = document.location.href;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   550
	var time = IriSP.retrieveTimeFragment( url );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   551
	IriSP.startPosition = time;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   552
	IriSP.DailymotionAddListeners();	
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
	IriSP.MyApiPlayer.ready(playerid);
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
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   557
IriSP.DailymotionAddListeners = function () {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   558
	if ( IriSP.player ) { 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   559
		IriSP.trace( "__IriSP.addListeners","ADD  Listener " );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   560
		//__IriSP.player.addEventListener("onStateChange", "__IriSP.DailymotionPositionListener");
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   561
		setTimeout( "__IriSP.DailymotionPositionListener()", 100);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   562
		IriSP.DailymotionPositionListener();
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   563
		/* FIXME : works only with jwplayer */
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   564
		IriSP.player.addModelListener( "VOLUME", "__IriSP.volumeListener" );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   565
		//__IriSP.player.addModelListener('STATE', '__IriSP.stateMonitor');
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   566
	} else {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   567
		IriSP.setTimeout( "__IriSP.DailymotionAddListeners()", 100);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   568
	}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   569
};
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
IriSP.DailymotionPositionListener = function() { 
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
	IriSP.currentPosition = IriSP.player.getCurrentTime();
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   574
	//__IriSP.trace("__IriSP.DailymotionPositionListener",__IriSP.currentPosition);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   575
	//__IriSP.trace("__IriSP.currentPosition",__IriSP.currentPosition);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   576
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   577
	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
   578
	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
   579
	// afficher annotation 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   580
	/*__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
   581
	*/
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   582
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   583
	setTimeout( "__IriSP.DailymotionPositionListener()", 10 );
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   584
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   585
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
/* 	utils */
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   588
// 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
   589
/* 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
   590
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
   591
	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
   592
};
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
// 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
   595
/* 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
   596
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
   597
	 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
   598
	 var tmp;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   599
	 while (dec>15){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   600
		  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
   601
		  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
   602
		  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
   603
	 }
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   604
	 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
   605
	 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
   606
	 return(hex);
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
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   609
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   610
/* Search  methods	*/
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   611
IriSP.SearchOldValue="";
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   612
IriSP.searchblockOpen=false;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   613
IriSP.searchblock = function () {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   614
	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
   615
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   616
	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
   617
		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
   618
		//__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
   619
		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
   620
		/* FIXME : refactor this */
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   621
		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
   622
		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
   623
		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
   624
		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
   625
		IriSP.searchblockOpen = true;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   626
	} else {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   627
		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
   628
		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
   629
		IriSP.SearchClean();
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   630
		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
   631
		//__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
   632
		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
   633
		IriSP.searchblockOpen = false;
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
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   636
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   637
/* Search with typeahead */
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   638
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
   639
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   640
	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
   641
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   642
	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
   643
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   644
	var found  = 0;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   645
	var findmem = 0;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   646
	var factor  = 0;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   647
	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
   648
	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
   649
	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
   650
	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
   651
		
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   652
		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
   653
			annotation = annotations[i];
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   654
			
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   655
			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
   656
			
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   657
			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
   658
			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
   659
			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
   660
			
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   661
			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
   662
				found+=1;	
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
			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
   665
				found+=1;	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   666
			}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   667
			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
   668
				found+=1;	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   669
			}
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
			findmem += found;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   672
			if(found>0){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   673
				factor = found*8;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   674
				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
   675
				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
   676
				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
   677
				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
   678
				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
   679
				
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   680
				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
   681
				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
   682
			}else {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   683
				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
   684
				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
   685
				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
   686
			}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   687
			
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   688
			found = 0;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   689
		}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   690
		if(findmem==0){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   691
				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
   692
		}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   693
		
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   694
	} 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
   695
		IriSP.SearchClean();
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   696
		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
   697
	} else {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   698
		IriSP.SearchClean();
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   699
		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
   700
	}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   701
};
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
IriSP.SearchClean = function (){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   704
	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
   705
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   706
	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
   707
			annotation = annotations[i];
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   708
			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
   709
			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
   710
			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
   711
			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
   712
			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
   713
		}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   714
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   715
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   716
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   717
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
   718
	/* FIXME: to implement */
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   719
					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
   720
					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
   721
					/*__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
   722
					__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
   723
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   724
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
/* CLASS Ligne (annotationType) 	*/
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
IriSP.LDTligne 	= null;		
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   729
__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
   730
	this.id 		 = id;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   731
	this.title 		 = title;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   732
	this.description = description;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   733
	//
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   734
	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
   735
	this.duration = duration;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   736
	this.annotationOldRead = "";
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   737
	IriSP.LDTligne = this;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   738
	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
   739
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   740
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   741
__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
   742
	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
   743
	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
   744
	//__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
   745
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   746
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   747
__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
   748
	/* TODO implement */
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   749
	//changePageUrlOffset(currentPosition);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   750
	//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
   751
	//__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
   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
__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
   755
	/* TODO implement */
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   756
	/*for (){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   757
	}*/
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   758
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   759
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   760
__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
   761
	/* TODO implement */
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
__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
   765
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   766
	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
   767
	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
   768
  
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   769
	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
   770
		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
   771
		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
   772
	} else {    
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   773
		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
   774
	}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   775
		
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
__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
   779
	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
   780
		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
   781
			return i;
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
};
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
__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
   787
	var annotationTempo = -1;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   788
	//__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
   789
	//__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
   790
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   791
	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
   792
		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
   793
		
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   794
		//__IriSP.SearchThisSegment(annotationTempo);
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
		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
   797
			
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   798
				// 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
   799
				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
   800
					this.annotationOldRead = annotationTempo;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   801
					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
   802
					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
   803
					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
   804
					
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   805
					//__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
   806
					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
   807
					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
   808
					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
   809
					//alert(startPourcent);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   810
					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
   811
				}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   812
			break;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   813
		} else {
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   814
		annotationTempo = -1;
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
	// 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
   819
	if( annotationTempo == -1){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   820
		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
   821
			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
   822
			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
   823
			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
   824
			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
   825
			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
   826
			if(this.annotationOldRead){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   827
				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
   828
			}
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-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
   830
			this.annotationOldRead = annotationTempo;
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
	//__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
   834
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   835
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   836
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   837
/* CLASS Annotation */
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   838
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   839
__IriSP.Annotation = function (){
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   840
	var id 	= null;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   841
	var begin 			= null;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   842
	var end 			= null;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   843
	var media 			= null;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   844
	var description	= null;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   845
	var title 			= null;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   846
	var color 			= null;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   847
	var tags			= null;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   848
	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
   849
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   850
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   851
__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
   852
	this.id 			= id;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   853
	this.begin 			= begin;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   854
	this.end 			= end;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   855
	this.media 			= media;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   856
	this.description 	= description;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   857
	this.title 			= title;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   858
	this.color 			= color;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   859
	this.tags			= tags;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   860
	this.htmlTags		= "";
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   861
	this.duration		= duration;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   862
	// draw it 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   863
	this.draw();
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   864
	this.drawTags();
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   865
	//
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   866
	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
   867
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   868
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   869
__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
   870
	//alert (this.duration);
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   871
	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
   872
	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
   873
	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
   874
		
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   875
	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
   876
			{"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
   877
			"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
   878
			"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
   879
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   880
	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
   881
				{"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
   882
				"description": this.description});
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   883
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   884
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   885
	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
   886
	// TOOLTIP BUG ! 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   887
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   888
	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
   889
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   890
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   891
	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
   892
	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
   893
		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
   894
	}).mouseout(function(){		
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   895
		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
   896
	});
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   897
	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
   898
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   899
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   900
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   901
__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
   902
	/* FIXME : to implement */
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   903
	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
   904
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   905
	//__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
   906
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   907
	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
   908
		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
   909
			
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   910
			//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
   911
			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
   912
			
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   913
		}		
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   914
	}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   915
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   916
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   917
__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
   918
	// 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
   919
	// 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
   920
	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
   921
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   922
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   923
__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
   924
	this.tootTip();
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   925
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   926
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   927
__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
   928
	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
   929
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   930
 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   931
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   932
/* CLASS Tags */
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   933
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   934
__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
   935
	this.myTags 	=	object;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   936
	this.htmlTags 	= 	null;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   937
	this.weigthMax 	= 	0;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   938
	//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
   939
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   940
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   941
__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
   942
	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
   943
		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
   944
		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
   945
			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
   946
				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
   947
					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
   948
					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
   949
					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
   950
					//__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
   951
					
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   952
					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
   953
						this.weigthMax = weigthTempo;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   954
					}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   955
				}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   956
			}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   957
		}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   958
	}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   959
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   960
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   961
__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
   962
	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
   963
		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
   964
			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
   965
		}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   966
	}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   967
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   968
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   969
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   970
__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
   971
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   972
	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
   973
	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
   974
		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
   975
		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
   976
		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
   977
						+'\');\" 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
   978
						+'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
   979
						+'\"> '+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
   980
		}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   981
	}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   982
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   983
	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
   984
	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
   985
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   986
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   987
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   988
__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
   989
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   990
	var timeStartOffsetA	=	100000000000000000000;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   991
	var timeStartOffsetB	=	100000000000000000000;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   992
	var timeEndOffsetA		=	0;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   993
	var timeEndOffsetB		=	0;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   994
	var timeStartID;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   995
	var timeEndID;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   996
	var WidthPourCent;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   997
	var leftPourCent;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   998
	var timeStartOffset;
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
   999
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
  1000
	// 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
  1001
	// 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
  1002
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
  1003
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
  1004
	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
  1005
		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
  1006
			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
  1007
			
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
  1008
			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
  1009
				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
  1010
					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
  1011
					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
  1012
					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
  1013
				}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
  1014
				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
  1015
					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
  1016
					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
  1017
					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
  1018
				}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
  1019
			}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
  1020
			
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
  1021
		}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
  1022
	}
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
  1023
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
  1024
	// -------------------------------------------------
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
  1025
	// 
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
  1026
	// -------------------------------------------------
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
  1027
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
  1028
	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
  1029
	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
  1030
	//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
  1031
	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
  1032
	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
  1033
	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
  1034
	// like arrow script
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
  1035
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
  1036
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
  1037
	
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
  1038
};
a5440e1a18a8 A bunch of changes to make the code use popcorn. Bumped the version of jwplayer
hamidouk
parents: 43
diff changeset
  1039