Audio now works on iPad.

This commit is contained in:
ha7ilm 2016-03-27 00:47:26 +01:00
parent 7b1d698575
commit 70a04da98b
4 changed files with 50 additions and 2 deletions

View File

@ -138,6 +138,12 @@
</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>
</html>

View File

@ -778,3 +778,31 @@ img.openwebrx-mirror-img
margin-top: 29px;
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;
}

View File

@ -72,6 +72,9 @@ var rx_photo_state=1;
function e(what) { return document.getElementById(what); }
ios = /iPad|iPod|iPhone/.test(navigator.userAgent);
//alert("ios="+ios.toString()+" "+navigator.userAgent);
function init_rx_photo()
{
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_buffer_current_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")
{
@ -1890,6 +1893,8 @@ function openwebrx_resize()
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();
open_websocket();
place_panels();
@ -1902,6 +1907,14 @@ function openwebrx_init()
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(){
sum=0;

View File

@ -559,7 +559,8 @@ class WebRXHandler(BaseHTTPRequestHandler):
if extension == "wrx" and (checkresult or receiver_failed):
self.send_302("inactive.html")
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")
return
if extension == "wrx" and cfg.max_clients<=len(clients):