web/music-the-end-etc.html
changeset 94 873b0e9ff7f6
parent 92 ab0871ca8819
equal deleted inserted replaced
93:7c37aaa2a8ae 94:873b0e9ff7f6
    25 
    25 
    26 	</head>
    26 	</head>
    27 	<body>
    27 	<body>
    28 		<!-- div content - site takes the full height of browser -->			
    28 		<!-- div content - site takes the full height of browser -->			
    29 		<div id="content" class="full_hightScreen">
    29 		<div id="content" class="full_hightScreen">
    30 			<div class="btnReturn">	
    30 			<div class="boxReturn">	
    31 	       		<button id="btnChoice" class="btn" onClick="location.href='menu_bonus.html';">Choice</button>                   		
    31 	       		<button class="btnReturn" onClick="location.href='the-end-etc.html';">Retour</button>  
    32 			</div>
    32 			</div>
       
    33 			
    33 			<!--this div empty allows the element content_vcentering to be vertically aligned -->
    34 			<!--this div empty allows the element content_vcentering to be vertically aligned -->
    34 			<section  id="intMusic" class="full_hightScreen">
    35 			<section  id="intMusic" class="full_hightScreen">
    35 				<div class="strut"></div><!--
    36 				<div class="strut"></div><!--
    36 				this comment corrects the white-space (display: inline);
    37 				this comment corrects the white-space (display: inline);
    37 				--><div id="bg_img" class="fullScreen_vcentering">
    38 				--><div id="bg_img" class="fullScreen_vcentering">
   142 
   143 
   143 	            	var audioObj = $("#audio" + audioIndex);
   144 	            	var audioObj = $("#audio" + audioIndex);
   144 	            	var audio = audioObj.get(0);
   145 	            	var audio = audioObj.get(0);
   145 					playingIndex = audioIndex;
   146 					playingIndex = audioIndex;
   146 
   147 
   147 	            	if (audio.readyState === 4) {
   148 	            	if (audio.readyState === 4 || audio.readyState === 3) {
   148 						// Play the sound
   149 						// Play the sound
   149 						playSound(audio);
   150 						playSound(audio);
   150 
   151 
   151 	            	} else {
   152 	            	} else {
   152 		            	// Load the sound
   153 		            	// Load the sound
   153 		            	audio.load();
   154 		            	audio.load();
   154 						loading = true;	
   155 						loading = true;	
   155 
   156 
   156 		            	// Add event canplaythrough
       
   157 						audioObj.bind("canplaythrough", function() {
   157 						audioObj.bind("canplaythrough", function() {
   158 							console.log("canplaythrough");
       
   159 
       
   160 							// Play the sound
   158 							// Play the sound
   161 							playSound(audio);
   159 							playSound(audio);
   162 
   160 
   163 							// Unbind
   161 							// Unbind
   164 							audioObj.unbind("canplaythrough");						
   162 							audioObj.unbind("canplaythrough");						
   172 		            	}
   170 		            	}
   173 					});
   171 					});
   174 
   172 
   175 					// Add event ended
   173 					// Add event ended
   176 					audioObj.bind("ended", function() {
   174 					audioObj.bind("ended", function() {
   177 						console.log("ended");
       
   178 	            		// Change the button pause in play
   175 	            		// Change the button pause in play
   179     	        		$("#playpause" + playingIndex).css({"background-position" : '0 0'});
   176     	        		$("#playpause" + playingIndex).css({"background-position" : '0 0'});
   180 
   177 
   181     	        		// Change the title color
   178     	        		// Change the title color
   182 						$("#title" + audioIndex).removeClass("gris");	
   179 						$("#title" + audioIndex).removeClass("gris");