this is an extension to another question i’ve asked
i want to embed a game on a website and i want it to automaticaly focus on the iframe. but whenever i try anything like iframe.contentWindow.focus() it focuses on the iframe but the iframe doesnt have any sound
the code for the game was written in a special program so the code is all jumbled and hard to comprehend. though i did find a script that can test the audio. what i want is for this to return true.
testAudio(){
playTestAudio();return _yb1&&g_WebAudioContext&&g_WebAudioContext.state!==_fa1._ga1
}
function playTestAudio() {
if(_yb1||_zb1)return;
_zb1=true;
var _lb1=new Audio(_X91);
_lb1.controls=false;
_lb1.autoplay=true;
_lb1.preload="none";
document.body.appendChild(_lb1);
try{
var _Bb1=_lb1.play();
if(_Bb1!==undefined) {
_Bb1.then(function() {
debug("WebAudio autoplay test passed.");
_yb1=true;
_zb1=false;
_Cb1();
document.body.removeChild(_lb1)
}).catch(function(error) {
console.log("WebAudio autoplay test failed: ",error);
document.body.removeChild(_lb1);
_zb1=false;
_Db1()
})
}else {
console.log("WebAudio autoplay test failed: Playback promise invalid.");
document.body.removeChild(_lb1);
_zb1=false;
_Db1()
}
}
catch(_wC){debug("WebAudio autoplay test failed with exception: "+_wC);
document.body.removeChild(_lb1);_zb1=false;_Db1()}
}
this is the location of the script file if needed
lacation.scripts.net