Is there a global way to detect when audio is playing or starts playing in the browser.
something like along the idea of if(window.mediaPlaying()){...>
if(window.mediaPlaying()){...
There is a playbackState property (https://developer.mozilla.org/en-US/docs/Web/API/MediaSession/playbackState), but not all browsers support it.
playbackState
if(navigator.mediaSession.playbackState === "playing"){...