diff --git a/htdocs/index.wrx b/htdocs/index.wrx index d91bb80..c6323ed 100644 --- a/htdocs/index.wrx +++ b/htdocs/index.wrx @@ -139,5 +139,11 @@ +
+
+ +

Start OpenWebRX +
+
diff --git a/htdocs/openwebrx.css b/htdocs/openwebrx.css index 00873ab..66e157e 100644 --- a/htdocs/openwebrx.css +++ b/htdocs/openwebrx.css @@ -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; +} + diff --git a/htdocs/openwebrx.js b/htdocs/openwebrx.js index 137d333..0055b13 100644 --- a/htdocs/openwebrx.js +++ b/htdocs/openwebrx.js @@ -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; diff --git a/openwebrx.py b/openwebrx.py index dea3a9b..d9b661e 100755 --- a/openwebrx.py +++ b/openwebrx.py @@ -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):