[2] Fixed bug related to disabled audio autoplay starting from Chrome 66

This commit is contained in:
ha7ilm 2018-05-07 22:42:20 +02:00
parent b743c02f9d
commit 4e30fd57c0
1 changed files with 5 additions and 3 deletions

View File

@ -73,7 +73,8 @@ var rx_photo_state=1;
function e(what) { return document.getElementById(what); }
ios = /iPad|iPod|iPhone/.test(navigator.userAgent);
ios = /iPad|iPod|iPhone|Chrome/.test(navigator.userAgent);
is_chrome = /Chrome/.test(navigator.userAgent);
//alert("ios="+ios.toString()+" "+navigator.userAgent);
function init_rx_photo()
@ -1163,7 +1164,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(!ios && (audio_initialized==0 && audio_prepared_buffers.length>audio_buffering_fill_to)) audio_init()
if(!(ios||is_chrome) && (audio_initialized==0 && audio_prepared_buffers.length>audio_buffering_fill_to)) audio_init()
}
else if(first3Chars=="FFT")
{
@ -1622,6 +1623,7 @@ function audio_preinit()
function audio_init()
{
if(is_chrome) audio_context.resume()
if(starting_mute) toggleMute();
if(audio_client_resampling_factor==0) return; //if failed to find a valid resampling factor...
@ -2182,7 +2184,7 @@ function openwebrx_resize()
function openwebrx_init()
{
if(ios) e("openwebrx-big-grey").style.display="table-cell";
if(ios||is_chrome) 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();