Cleaned up the autoplay detection code.

This commit is contained in:
flash 2024-06-25 23:27:31 +00:00
parent 60e7cc39fb
commit fff461ac2a

View file

@ -5,19 +5,10 @@ const MamiDetectAutoPlaySource = '/+NIxA!!FhpbmcA#PA$wA@fgAV$#q$#/$#A#OUxBTUUzLj
const MamiDetectAutoPlay = async () => { const MamiDetectAutoPlay = async () => {
try { try {
const audio = $e('audio', { src: 'data:audio/mpeg;base64,' + MamiSRLE.decode(MamiDetectAutoPlaySource) }); await $e('audio', { src: 'data:audio/mpeg;base64,' + MamiSRLE.decode(MamiDetectAutoPlaySource) }).play();
try {
await audio.play();
} catch(ex) { } catch(ex) {
if('name' in ex && ex.name !== 'NotAllowedError' && ex.name !== 'AbortError') {
console.error(ex);
throw ex;
}
return false; return false;
} }
} catch(ex) {}
return true; return true;
}; };