Oooooh boy, here comes another "Fuck you" to Chrome!
As many people might already know, I've been setting up and having 24/7 stations up on the new
Worlio Radio. One of the neat gimmicks of the page is that there are visualizers available, three as of now, and you can switch through them by clicking on the visualizer.
Two problems had cropped up while working on this, and they both involve Chrome being a fucking dumbass.
Problem #1: Audio would not play in Chrome, but would be perfectly fine in Firefox.
The reason? Chrome is shitheads and don't follow JS spec. The page uses the Audio object and controls that instead of slapping an audio element on the page, and then sources it into an AudioContext so the visualizers could work. Spec states that the creation of an AudioContext is allowed but must only be resumed via a users interaction. To sum it up, this basically means I can create all the AudioContext elements I want but if I want to play from any of them, a user has to click on something or interact with something that directs to it resuming. Firefox follows this spec to the T, while Chrome is very strict considering it's Google. Chrome requires the AudioContext to be created only via a users interaction, which makes no sense because not only is it off-spec, it's also entirely useless in practice. AudioContext can't do anything unless it's playing, which the spec handles the requirement fine. I ended up solving this by adding some checks to see if the variable was initialized.
Problem #2: AudioContext cannot be re-routed after it's already been routed... only in Chrome
The spec does not specify that an Audio can only be routed once through an AudioContext, it just says that it can re-route an Audio through. Firefox has no issue with this and will just consider the previous AudioContext route dead and re-route the player into the context. Chrome will completely stop the media playing, making the context invalid and erroring out in console. Chrome doesn't need to do this, and it benefits nothing to prevent it. This forces visualization switching through Chrome to require re-selecting the channel to play the radio and see visualizers. It's so annoying, it's not even worth trying to fix.
I've had nothing but issues with inconsistencies that have made no sense when it comes to browser engines, 99% of the time it boiling down to Chrome is a fucking piece of shit browser and their Blink engine is only worse. I'm almost at my wits end.