web/music-the-end-etc.html
changeset 92 ab0871ca8819
parent 88 eeb0a6f3c07d
child 94 873b0e9ff7f6
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/music-the-end-etc.html	Mon Jan 21 21:00:24 2013 +0100
@@ -0,0 +1,222 @@
+<!DOCTYPE html>
+<html lang="fr">
+	<head>
+		<meta charset="utf-8">
+		<title>The End - @todo</title>
+		
+		<meta name="description" content="@todo">
+		<link rel="icon" href="static/res/img/favicon.ico" />		
+
+		<!-- Mobile Specific Metas -->		
+		<meta name="viewport" content="user-scalable=no">
+		<!--
+		<meta name="viewport" content="user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, width=device-width" />
+		-->
+		
+		<!-- Test Smartphone  -->
+	    <script src="static/res/js/incdetectmobile.js"></script>        
+		<script>
+			if (IsSmartphone()) { location.href = "mindex.html"; }	
+		</script>
+		<!-- Metanav FranceTV 	-->
+		<script src="http://static.francetv.fr/js/jquery.metanav-min.js" charset="utf-8"></script>
+
+		<link rel="stylesheet" href="static/res/css/style_1024.css" />
+
+	</head>
+	<body>
+		<!-- div content - site takes the full height of browser -->			
+		<div id="content" class="full_hightScreen">
+			<div class="btnReturn">	
+	       		<button id="btnChoice" class="btn" onClick="location.href='menu_bonus.html';">Choice</button>                   		
+			</div>
+			<!--this div empty allows the element content_vcentering to be vertically aligned -->
+			<section  id="intMusic" class="full_hightScreen">
+				<div class="strut"></div><!--
+				this comment corrects the white-space (display: inline);
+				--><div id="bg_img" class="fullScreen_vcentering">
+		    		<img id="bgimage" alt="The End, etc." src="static/res/img/choixMusique1.jpg" />
+				</div>	
+			</section>	
+			<section id="playerAudio" class="positionAbs">
+				<!--this div empty allows the element content_vcentering to be vertically aligned -->
+				<div class="strut"></div><!--
+				this comment corrects the white-space (display: inline);
+				--><div class="fullScreen_vcentering white big_txt">
+					<article class="boxAudio">
+						<audio id="audio1" preload="metadata">
+							<source src="http://clients.incandescence.com/theend/musique/MARSEILLAISE-CHANT_3.ogg" type="audio/ogg">
+  							<source src="http://clients.incandescence.com/theend/musique/MARSEILLAISE-CHANT_3.mp3" type="audio/mpeg">
+							<p>Audio non supportée </p>
+						</audio>
+						<button id="playpause1" onClick="play(1)" class="btnPlayPause txt_hidden">Play</button>
+		                
+		                <!-- class="txt_white" can be used to color current time in white -->
+		                <p id="current1" class="time">0'00''</p>
+		   				<p id="title1">LA MARSEILLAISE</p><br>
+						
+						
+						<audio id="audio2" preload="metadata">
+							<source src="http://clients.incandescence.com/theend/musique/IDEE-CHANT_5.ogg" type="audio/ogg">
+  							<source src="http://clients.incandescence.com/theend/musique/IDEE-CHANT_5.mp3" type="audio/mpeg">
+							<p>Audio non supportée </p>
+						</audio>
+						<button id="playpause2" onClick="play(2)" title="play" class="btnPlayPause txt_hidden">Play</button>
+		                
+		                <p id="current2" class="time">0'00''</p>
+						<p id="title2">L'IDÉE</p><br>
+						
+						<audio id="audio3" preload="metadata">
+							<source src="http://clients.incandescence.com/theend/musique/INTERNATIONALE-CHANT_1.ogg" type="audio/ogg">
+  							<source src="http://clients.incandescence.com/theend/musique/INTERNATIONALE-CHANT_1.mp3" type="audio/mpeg">
+							<p>Audio non supportée </p>
+						</audio>
+						<button id="playpause3" onClick="play(3)" title="play" class="btnPlayPause txt_hidden">Play</button>
+
+		                <p id="current3" class="time">0'00''</p>
+		   				<p id="title3">L'INTERNATIONALE</p><br>
+
+						<audio id="audio4" preload="metadata">
+							<source src="http://clients.incandescence.com/theend/musique/NIDIEU-CHANT-2.ogg" type="audio/ogg">
+  							<source src="http://clients.incandescence.com/theend/musique/NIDIEU-CHANT-2.mp3" type="audio/mpeg">
+							<p>Audio non supportée </p>
+						</audio>
+						<button id="playpause4" onClick="play(4)" title="play" class="btnPlayPause txt_hidden">Play</button>
+		               	<p id="current4" class="time">0'00''</p>
+		   				<p id="title4">NI DIEU NI MAÎTRE</p><br>
+
+						<audio id="audio5" preload="metadata">
+	   						<source src="http://clients.incandescence.com/theend/musique/ZEBU-CHANT_4.ogg" type="audio/ogg">
+  							<source src="http://clients.incandescence.com/theend/musique/ZEBU-CHANT_4.mp3" type="audio/mpeg">
+							<p>Audio non supportée </p>
+						</audio>
+						<button id="playpause5" onClick="play(5)" title="play" class="btnPlayPause txt_hidden">Play</button>
+
+		               	<p id="current5" class="time">0'00''</p>
+		   				<p id="title5">L'ENVERS DU ZÉBU</p>
+		   			</article>
+				</div>
+			</section>
+
+		</div>
+
+		<!-- JavaScript -->
+        <script src="static/res/js/jquery-1.8.2.min.js"></script>        		
+        <script>
+            var playingIndex = -1;
+            var loading = false;
+
+            var play = function(audioIndex) {
+
+            	if (loading) {
+            		return;
+            	}
+
+            	var wasPlaying = playingIndex;
+
+            	// Stop the current played audio ?
+            	if (playingIndex !== -1 ) {
+	            	var audioObj = $("#audio" + playingIndex);
+	            	var audio = audioObj.get(0);
+
+					// Unbind all events
+					audioObj.unbind("canplaythrough");
+					audioObj.unbind("timeupdate");
+					audioObj.unbind("ended");
+
+            		// Pause the audio
+	            	audio.pause();
+	            	setTimeValue(0);
+
+            		// Change the button pause in play
+            		$("#playpause" + playingIndex).css({"background-position" : '0 0'});
+
+            		// Change the title color
+					$("#title" + playingIndex).removeClass("gris");	
+
+            		playingIndex = -1;
+            	}
+
+            	// Play a new audio
+            	if (audioIndex !== wasPlaying) {
+
+	            	var audioObj = $("#audio" + audioIndex);
+	            	var audio = audioObj.get(0);
+					playingIndex = audioIndex;
+
+	            	if (audio.readyState === 4) {
+						// Play the sound
+						playSound(audio);
+
+	            	} else {
+		            	// Load the sound
+		            	audio.load();
+						loading = true;	
+
+		            	// Add event canplaythrough
+						audioObj.bind("canplaythrough", function() {
+							console.log("canplaythrough");
+
+							// Play the sound
+							playSound(audio);
+
+							// Unbind
+							audioObj.unbind("canplaythrough");						
+						});
+					}
+
+	            	// Add event timeupdate
+					audioObj.bind("timeupdate", function() {
+						if (!loading) {
+		            		setTimeValue(audio.duration - audio.currentTime);
+		            	}
+					});
+
+					// Add event ended
+					audioObj.bind("ended", function() {
+						console.log("ended");
+	            		// Change the button pause in play
+    	        		$("#playpause" + playingIndex).css({"background-position" : '0 0'});
+
+    	        		// Change the title color
+						$("#title" + audioIndex).removeClass("gris");	
+
+						// Unbind
+						audioObj.unbind("timeupdate");
+						audioObj.unbind("ended");
+						playingIndex = -1;
+					});
+
+            		// Change the button pause in play
+            		$("#playpause" + audioIndex).css({"background-position" : '0 -30px'});
+
+					// Change the title color
+					$("#title" + audioIndex).addClass("gris");	
+
+					// Set the background
+					$("#bgimage").attr("src", "static/res/img/choixMusique" + (audioIndex + 1)+ ".jpg");					
+            	};
+            };
+
+            var playSound = function(audio) {
+				audio.currentTime = 0;
+				audio.play();
+				loading = false;	            	
+            };
+
+            var setTimeValue = function(time) {
+	            $("#current" + playingIndex).html(secondsToTime(time));
+            };
+
+            this.secondsToTime = function(sec) {
+				var minutes = Math.floor(sec / 60);
+				var seconds = Math.floor(sec - minutes * 60);
+				if (seconds < 10) {
+					seconds = "0" + seconds;
+				}
+				return "" + minutes + "'" + seconds + "''";
+			};
+        </script>						
+	
+	</body>
+</html>
\ No newline at end of file