Audio now works on iPad.
This commit is contained in:
		@@ -139,5 +139,11 @@
 | 
				
			|||||||
			</div>
 | 
								</div>
 | 
				
			||||||
	</div>
 | 
						</div>
 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
 | 
						<div id="openwebrx-big-grey" onclick="iosPlayButtonClick();">
 | 
				
			||||||
 | 
							<div id="openwebrx-play-button-text">
 | 
				
			||||||
 | 
							<img id="openwebrx-play-button" src="gfx/openwebrx-play-button.png" />
 | 
				
			||||||
 | 
							<br /><br />Start OpenWebRX
 | 
				
			||||||
 | 
							</div>
 | 
				
			||||||
 | 
						</div>
 | 
				
			||||||
	</body>
 | 
						</body>
 | 
				
			||||||
</html>
 | 
					</html>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -778,3 +778,31 @@ img.openwebrx-mirror-img
 | 
				
			|||||||
	margin-top: 29px;
 | 
						margin-top: 29px;
 | 
				
			||||||
	font-family: 'expletus-sans-medium';
 | 
						font-family: 'expletus-sans-medium';
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#openwebrx-big-grey
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						position: fixed;
 | 
				
			||||||
 | 
						width: 100%;
 | 
				
			||||||
 | 
						height: 100%;
 | 
				
			||||||
 | 
						margin: 0;
 | 
				
			||||||
 | 
						padding: 0;
 | 
				
			||||||
 | 
						opacity: 0.8;
 | 
				
			||||||
 | 
						background-color: #777;
 | 
				
			||||||
 | 
						left: 0;
 | 
				
			||||||
 | 
						top: 0;
 | 
				
			||||||
 | 
						z-index: 1001;	
 | 
				
			||||||
 | 
						display: none;
 | 
				
			||||||
 | 
						vertical-align: middle;
 | 
				
			||||||
 | 
						text-align: center;
 | 
				
			||||||
 | 
						color: white;
 | 
				
			||||||
 | 
						font-weight: bold;
 | 
				
			||||||
 | 
						font-size: 20pt;
 | 
				
			||||||
 | 
						cursor: pointer;
 | 
				
			||||||
 | 
						transition: opacity 0.3s linear;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#openwebrx-big-grey img
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						width: 150px;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -72,6 +72,9 @@ var rx_photo_state=1;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
function e(what) { return document.getElementById(what); }
 | 
					function e(what) { return document.getElementById(what); }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ios = /iPad|iPod|iPhone/.test(navigator.userAgent);
 | 
				
			||||||
 | 
					//alert("ios="+ios.toString()+"  "+navigator.userAgent);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function init_rx_photo()
 | 
					function init_rx_photo()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	e("webrx-top-photo-clip").style.maxHeight=rx_photo_height.toString()+"px";
 | 
						e("webrx-top-photo-clip").style.maxHeight=rx_photo_height.toString()+"px";
 | 
				
			||||||
@@ -1137,7 +1140,7 @@ function on_ws_recv(evt)
 | 
				
			|||||||
		audio_prepare(audio_data);
 | 
							audio_prepare(audio_data);
 | 
				
			||||||
		audio_buffer_current_size_debug+=audio_data.length;
 | 
							audio_buffer_current_size_debug+=audio_data.length;
 | 
				
			||||||
		audio_buffer_all_size_debug+=audio_data.length;
 | 
							audio_buffer_all_size_debug+=audio_data.length;
 | 
				
			||||||
		if(audio_initialized==0 && audio_prepared_buffers.length>audio_buffering_fill_to) audio_init()
 | 
							if(!ios && (audio_initialized==0 && audio_prepared_buffers.length>audio_buffering_fill_to)) audio_init()
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	else if(firstChars=="FFT")
 | 
						else if(firstChars=="FFT")
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
@@ -1890,6 +1893,8 @@ function openwebrx_resize()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
function openwebrx_init()
 | 
					function openwebrx_init()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						if(ios) e("openwebrx-big-grey").style.display="table-cell";
 | 
				
			||||||
 | 
						(opb=e("openwebrx-play-button-text")).style.marginTop=(window.innerHeight/2-opb.clientHeight/2).toString()+"px";
 | 
				
			||||||
	init_rx_photo();
 | 
						init_rx_photo();
 | 
				
			||||||
	open_websocket();
 | 
						open_websocket();
 | 
				
			||||||
	place_panels();
 | 
						place_panels();
 | 
				
			||||||
@@ -1902,6 +1907,14 @@ function openwebrx_init()
 | 
				
			|||||||
	waterfallColorsDefault();
 | 
						waterfallColorsDefault();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function iosPlayButtonClick()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						//On iOS, we can only start audio from a click or touch event.
 | 
				
			||||||
 | 
						audio_init();
 | 
				
			||||||
 | 
						e("openwebrx-big-grey").style.opacity=0;
 | 
				
			||||||
 | 
						window.setTimeout(function(){ e("openwebrx-big-grey").style.display="none"; },1100);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
window.setInterval(function(){
 | 
					window.setInterval(function(){
 | 
				
			||||||
	sum=0;
 | 
						sum=0;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -559,7 +559,8 @@ class WebRXHandler(BaseHTTPRequestHandler):
 | 
				
			|||||||
				if extension == "wrx" and (checkresult or receiver_failed):
 | 
									if extension == "wrx" and (checkresult or receiver_failed):
 | 
				
			||||||
					self.send_302("inactive.html")
 | 
										self.send_302("inactive.html")
 | 
				
			||||||
					return
 | 
										return
 | 
				
			||||||
				if extension == "wrx" and ((self.headers['user-agent'].count("Chrome")==0 and self.headers['user-agent'].count("Firefox")==0 and (not "Googlebot" in self.headers['user-agent'])) if 'user-agent' in self.headers.keys() else True) and (not request_param.count("unsupported")):
 | 
									anyStringsPresentInUserAgent=lambda a: reduce(lambda x,y:x or y, map(lambda b:self.headers['user-agent'].count(b), a), False)
 | 
				
			||||||
 | 
									if extension == "wrx" and ( (not anyStringsPresentInUserAgent(("Chrome","Firefox","Googlebot","iPhone","iPad","iPod"))) if 'user-agent' in self.headers.keys() else True ) and (not request_param.count("unsupported")):
 | 
				
			||||||
					self.send_302("upgrade.html")
 | 
										self.send_302("upgrade.html")
 | 
				
			||||||
					return
 | 
										return
 | 
				
			||||||
				if extension == "wrx" and cfg.max_clients<=len(clients):
 | 
									if extension == "wrx" and cfg.max_clients<=len(clients):
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user