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 () => {
try {
const audio = $e('audio', { src: 'data:audio/mpeg;base64,' + MamiSRLE.decode(MamiDetectAutoPlaySource) });
try {
await audio.play();
await $e('audio', { src: 'data:audio/mpeg;base64,' + MamiSRLE.decode(MamiDetectAutoPlaySource) }).play();
} catch(ex) {
if('name' in ex && ex.name !== 'NotAllowedError' && ex.name !== 'AbortError') {
console.error(ex);
throw ex;
}
return false;
}
} catch(ex) {}
return true;
};