visualizer-micro
visualizer-micro copied to clipboard
Version 0.2.1 not working in Safari
Hello!
I noticed that the repo here is labelled as 0.1.0 – I’ve installed 0.2.1 from npm so firstly – wondering why the mismatch, but secondly, vm.supported returns false in Safari and obviously I can see your example here works perfectly... although I did notice the syntax seems to have changed (varies inconsistently between supported and isSupported` in the docs.
Thanks for your work on this!
Simon
So I’m fairly sure this is because an update omits any reference to Safari’s requirement for webkitAudioContext instead of AudioContext.
You assign this.context = new AudioContext(); but without a check like window.AudioContext = window.AudioContext || window.webkitAudioContext;
I’m unsure how to fix this in the scope of your package, as making the window check in my own Vue application’s mounted hook works for my own interactions with the AudioContext API but doesn’t fix the issue with this package not working – a shame!
Let me know if this is something easily rectified, I’m pretty sure it’s just adding the window adjustment above?
Thanks,
Simon
OK so I did get this working in the end, it was very basic as suspected!
window.AudioContext = window.AudioContext || window.webkitAudioContext;
this.vm = new VisualizerMicro();
I was assigning webkitAudioContext after the VisualiserMicro was being created. Still – I think it would be really helpful to have a note that webkitAudioContext needs to be assigned in your documentation. This would be especially helpful as this is not done in your example source code either; as it uses an outdated version of this package which did previously handle this problem for the user.
Hey @simonhrogers, thanks for all the detail. I stepped away from this project so I hadnt seen these.
Glad you got things working. I'll update the docs and the package next time I have a chance to dive into this project