Cleaned up the autoplay detection code.
This commit is contained in:
parent
60e7cc39fb
commit
fff461ac2a
1 changed files with 4 additions and 13 deletions
|
@ -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;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue