web/music-the-end-etc.html
author Edwin Razafimahatratra <edwin@robotalismsoft.com>
Mon, 21 Jan 2013 21:04:36 +0100
changeset 93 7c37aaa2a8ae
parent 92 ab0871ca8819
child 94 873b0e9ff7f6
permissions -rw-r--r--
netoyage update du rep static
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
78
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
     1
<!DOCTYPE html>
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
     2
<html lang="fr">
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
     3
	<head>
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
     4
		<meta charset="utf-8">
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
     5
		<title>The End - @todo</title>
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
     6
		
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
     7
		<meta name="description" content="@todo">
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
     8
		<link rel="icon" href="static/res/img/favicon.ico" />		
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
     9
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    10
		<!-- Mobile Specific Metas -->		
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    11
		<meta name="viewport" content="user-scalable=no">
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    12
		<!--
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    13
		<meta name="viewport" content="user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, width=device-width" />
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    14
		-->
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    15
		
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    16
		<!-- Test Smartphone  -->
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    17
	    <script src="static/res/js/incdetectmobile.js"></script>        
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    18
		<script>
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    19
			if (IsSmartphone()) { location.href = "mindex.html"; }	
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    20
		</script>
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    21
		<!-- Metanav FranceTV 	-->
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    22
		<script src="http://static.francetv.fr/js/jquery.metanav-min.js" charset="utf-8"></script>
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    23
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    24
		<link rel="stylesheet" href="static/res/css/style_1024.css" />
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    25
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    26
	</head>
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    27
	<body>
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    28
		<!-- div content - site takes the full height of browser -->			
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    29
		<div id="content" class="full_hightScreen">
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    30
			<div class="btnReturn">	
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    31
	       		<button id="btnChoice" class="btn" onClick="location.href='menu_bonus.html';">Choice</button>                   		
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    32
			</div>
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    33
			<!--this div empty allows the element content_vcentering to be vertically aligned -->
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    34
			<section  id="intMusic" class="full_hightScreen">
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    35
				<div class="strut"></div><!--
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    36
				this comment corrects the white-space (display: inline);
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    37
				--><div id="bg_img" class="fullScreen_vcentering">
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    38
		    		<img id="bgimage" alt="The End, etc." src="static/res/img/choixMusique1.jpg" />
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    39
				</div>	
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    40
			</section>	
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    41
			<section id="playerAudio" class="positionAbs">
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    42
				<!--this div empty allows the element content_vcentering to be vertically aligned -->
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    43
				<div class="strut"></div><!--
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    44
				this comment corrects the white-space (display: inline);
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    45
				--><div class="fullScreen_vcentering white big_txt">
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    46
					<article class="boxAudio">
80
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
    47
						<audio id="audio1" preload="metadata">
88
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 80
diff changeset
    48
							<source src="http://clients.incandescence.com/theend/musique/MARSEILLAISE-CHANT_3.ogg" type="audio/ogg">
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 80
diff changeset
    49
  							<source src="http://clients.incandescence.com/theend/musique/MARSEILLAISE-CHANT_3.mp3" type="audio/mpeg">
78
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    50
							<p>Audio non supportée </p>
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    51
						</audio>
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    52
						<button id="playpause1" onClick="play(1)" class="btnPlayPause txt_hidden">Play</button>
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    53
		                
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    54
		                <!-- class="txt_white" can be used to color current time in white -->
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    55
		                <p id="current1" class="time">0'00''</p>
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    56
		   				<p id="title1">LA MARSEILLAISE</p><br>
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    57
						
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    58
						
80
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
    59
						<audio id="audio2" preload="metadata">
88
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 80
diff changeset
    60
							<source src="http://clients.incandescence.com/theend/musique/IDEE-CHANT_5.ogg" type="audio/ogg">
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 80
diff changeset
    61
  							<source src="http://clients.incandescence.com/theend/musique/IDEE-CHANT_5.mp3" type="audio/mpeg">
78
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    62
							<p>Audio non supportée </p>
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    63
						</audio>
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    64
						<button id="playpause2" onClick="play(2)" title="play" class="btnPlayPause txt_hidden">Play</button>
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    65
		                
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    66
		                <p id="current2" class="time">0'00''</p>
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    67
						<p id="title2">L'IDÉE</p><br>
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    68
						
80
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
    69
						<audio id="audio3" preload="metadata">
88
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 80
diff changeset
    70
							<source src="http://clients.incandescence.com/theend/musique/INTERNATIONALE-CHANT_1.ogg" type="audio/ogg">
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 80
diff changeset
    71
  							<source src="http://clients.incandescence.com/theend/musique/INTERNATIONALE-CHANT_1.mp3" type="audio/mpeg">
78
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    72
							<p>Audio non supportée </p>
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    73
						</audio>
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    74
						<button id="playpause3" onClick="play(3)" title="play" class="btnPlayPause txt_hidden">Play</button>
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    75
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    76
		                <p id="current3" class="time">0'00''</p>
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    77
		   				<p id="title3">L'INTERNATIONALE</p><br>
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    78
80
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
    79
						<audio id="audio4" preload="metadata">
88
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 80
diff changeset
    80
							<source src="http://clients.incandescence.com/theend/musique/NIDIEU-CHANT-2.ogg" type="audio/ogg">
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 80
diff changeset
    81
  							<source src="http://clients.incandescence.com/theend/musique/NIDIEU-CHANT-2.mp3" type="audio/mpeg">
78
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    82
							<p>Audio non supportée </p>
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    83
						</audio>
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    84
						<button id="playpause4" onClick="play(4)" title="play" class="btnPlayPause txt_hidden">Play</button>
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    85
		               	<p id="current4" class="time">0'00''</p>
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    86
		   				<p id="title4">NI DIEU NI MAÃŽTRE</p><br>
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    87
80
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
    88
						<audio id="audio5" preload="metadata">
88
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 80
diff changeset
    89
	   						<source src="http://clients.incandescence.com/theend/musique/ZEBU-CHANT_4.ogg" type="audio/ogg">
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 80
diff changeset
    90
  							<source src="http://clients.incandescence.com/theend/musique/ZEBU-CHANT_4.mp3" type="audio/mpeg">
78
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    91
							<p>Audio non supportée </p>
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    92
						</audio>
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    93
						<button id="playpause5" onClick="play(5)" title="play" class="btnPlayPause txt_hidden">Play</button>
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    94
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    95
		               	<p id="current5" class="time">0'00''</p>
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    96
		   				<p id="title5">L'ENVERS DU ZÉBU</p>
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    97
		   			</article>
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    98
				</div>
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    99
			</section>
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   100
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   101
		</div>
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   102
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   103
		<!-- JavaScript -->
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   104
        <script src="static/res/js/jquery-1.8.2.min.js"></script>        		
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   105
        <script>
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   106
            var playingIndex = -1;
80
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   107
            var loading = false;
78
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   108
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   109
            var play = function(audioIndex) {
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   110
80
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   111
            	if (loading) {
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   112
            		return;
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   113
            	}
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   114
78
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   115
            	var wasPlaying = playingIndex;
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   116
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   117
            	// Stop the current played audio ?
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   118
            	if (playingIndex !== -1 ) {
80
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   119
	            	var audioObj = $("#audio" + playingIndex);
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   120
	            	var audio = audioObj.get(0);
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   121
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   122
					// Unbind all events
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   123
					audioObj.unbind("canplaythrough");
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   124
					audioObj.unbind("timeupdate");
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   125
					audioObj.unbind("ended");
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   126
78
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   127
            		// Pause the audio
80
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   128
	            	audio.pause();
78
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   129
	            	setTimeValue(0);
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   130
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   131
            		// Change the button pause in play
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   132
            		$("#playpause" + playingIndex).css({"background-position" : '0 0'});
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   133
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   134
            		// Change the title color
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   135
					$("#title" + playingIndex).removeClass("gris");	
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   136
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   137
            		playingIndex = -1;
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   138
            	}
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   139
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   140
            	// Play a new audio
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   141
            	if (audioIndex !== wasPlaying) {
80
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   142
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   143
	            	var audioObj = $("#audio" + audioIndex);
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   144
	            	var audio = audioObj.get(0);
78
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   145
					playingIndex = audioIndex;
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   146
80
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   147
	            	if (audio.readyState === 4) {
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   148
						// Play the sound
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   149
						playSound(audio);
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   150
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   151
	            	} else {
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   152
		            	// Load the sound
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   153
		            	audio.load();
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   154
						loading = true;	
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   155
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   156
		            	// Add event canplaythrough
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   157
						audioObj.bind("canplaythrough", function() {
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   158
							console.log("canplaythrough");
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   159
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   160
							// Play the sound
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   161
							playSound(audio);
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   162
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   163
							// Unbind
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   164
							audioObj.unbind("canplaythrough");						
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   165
						});
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   166
					}
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   167
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   168
	            	// Add event timeupdate
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   169
					audioObj.bind("timeupdate", function() {
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   170
						if (!loading) {
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   171
		            		setTimeValue(audio.duration - audio.currentTime);
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   172
		            	}
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   173
					});
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   174
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   175
					// Add event ended
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   176
					audioObj.bind("ended", function() {
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   177
						console.log("ended");
78
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   178
	            		// Change the button pause in play
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   179
    	        		$("#playpause" + playingIndex).css({"background-position" : '0 0'});
80
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   180
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   181
    	        		// Change the title color
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   182
						$("#title" + audioIndex).removeClass("gris");	
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   183
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   184
						// Unbind
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   185
						audioObj.unbind("timeupdate");
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   186
						audioObj.unbind("ended");
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   187
						playingIndex = -1;
78
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   188
					});
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   189
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   190
            		// Change the button pause in play
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   191
            		$("#playpause" + audioIndex).css({"background-position" : '0 -30px'});
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   192
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   193
					// Change the title color
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   194
					$("#title" + audioIndex).addClass("gris");	
80
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   195
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   196
					// Set the background
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   197
					$("#bgimage").attr("src", "static/res/img/choixMusique" + (audioIndex + 1)+ ".jpg");					
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   198
            	};
78
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   199
            };
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   200
80
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   201
            var playSound = function(audio) {
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   202
				audio.currentTime = 0;
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   203
				audio.play();
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   204
				loading = false;	            	
78
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   205
            };
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   206
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   207
            var setTimeValue = function(time) {
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   208
	            $("#current" + playingIndex).html(secondsToTime(time));
80
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents: 78
diff changeset
   209
            };
78
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   210
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   211
            this.secondsToTime = function(sec) {
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   212
				var minutes = Math.floor(sec / 60);
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   213
				var seconds = Math.floor(sec - minutes * 60);
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   214
				if (seconds < 10) {
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   215
					seconds = "0" + seconds;
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   216
				}
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   217
				return "" + minutes + "'" + seconds + "''";
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   218
			};
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   219
        </script>						
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   220
	
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   221
	</body>
8c3f0b94d056 big commit after problems
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   222
</html>