web/int_music.html
author cavaliet
Wed, 16 Jan 2013 12:12:51 +0100
changeset 79 a7e88f60f627
parent 78 8c3f0b94d056
child 80 46b897524cc4
permissions -rw-r--r--
migration for tag to title in contributions.

<!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" ontimeupdate="update()">
							<source src="audio.ogg" type="audio/ogg">
  							<source src="http://clients.incandescence.com/theend/MP3/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" ontimeupdate="update()">
							<source src="audio.ogg" type="audio/ogg">
  							<source src="http://clients.incandescence.com/theend/MP3/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" ontimeupdate="update()">
							<source src="audio.ogg" type="audio/ogg">
  							<source src="http://clients.incandescence.com/theend/MP3/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" ontimeupdate="update()">
							<source src="audio.ogg" type="audio/ogg">
  							<source src="http://clients.incandescence.com/theend/MP3/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" ontimeupdate="update()">
	   						<source src="audio.ogg" type="audio/ogg">
  							<source src="http://clients.incandescence.com/theend/MP3/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 play = function(audioIndex) {

            	var wasPlaying = playingIndex;

            	// Stop the current played audio ?
            	if (playingIndex !== -1 ) {
            		// Pause the audio
	            	$("#audio" + playingIndex).get(0).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) {
            		// Reset position and play the audio
	            	var audio = $("#audio" + audioIndex).get(0);
	            	audio.play();
	            	audio.currentTime = 0;
					playingIndex = audioIndex;

					// Add event on the end
					$("#audio" + audioIndex).bind("ended", function() {
	            		// Change the button pause in play
    	        		$("#playpause" + playingIndex).css({"background-position" : '0 0'});
						playingIndex = -1;						
					});

            		// Change the button pause in play
            		$("#playpause" + audioIndex).css({"background-position" : '0 -30px'});

					// Set the background
					$("#bgimage").attr("src", "static/res/img/choixMusique" + (audioIndex + 1)+ ".jpg");

					// Change the title color
					$("#title" + audioIndex).addClass("gris");	
            	}
            };

            var update = function() {
            	if (playingIndex !== -1) {
		            var audio = $("#audio" + playingIndex).get(0);
		            setTimeValue(audio.duration - audio.currentTime);
            	}
            };

            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>