From fff461ac2aff37ab581374cc684bfefc0b2f973e Mon Sep 17 00:00:00 2001 From: flashwave Date: Tue, 25 Jun 2024 23:27:31 +0000 Subject: [PATCH] Cleaned up the autoplay detection code. --- src/mami.js/audio/autoplay.js | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/mami.js/audio/autoplay.js b/src/mami.js/audio/autoplay.js index ae99939..d1c0ccc 100644 --- a/src/mami.js/audio/autoplay.js +++ b/src/mami.js/audio/autoplay.js @@ -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(); - } catch(ex) { - if('name' in ex && ex.name !== 'NotAllowedError' && ex.name !== 'AbortError') { - console.error(ex); - throw ex; - } - - return false; - } - } catch(ex) {} + await $e('audio', { src: 'data:audio/mpeg;base64,' + MamiSRLE.decode(MamiDetectAutoPlaySource) }).play(); + } catch(ex) { + return false; + } return true; };