superframe icon indicating copy to clipboard operation
superframe copied to clipboard

AudioAnalyser only works with autoplay

Open softpunch opened this issue 9 years ago • 4 comments

Hi Kevin!

I really like your current set of audioanalyser tools, but I can only seem to get the visualizers to work if autoplay is enabled on the src audio.

I've tried all sorts of workarounds, but if anything other than autoplay triggers the audio, the visualizers don't function.

If I comment out the line that connects the audioContext to the destination, the audio (correctly) is not audible when triggered. That leads me to believe the audio is in fact getting routed through the audioContext, even if the visualizers aren't working.

Any ideas?

I'm using the latest stable build (0.4.0) and mainly testing on Chrome.

softpunch avatar Dec 31 '16 00:12 softpunch

So if you trigger the audio another way, you can still hear the audio, but analyser data isn't coming through? I am not sure, maybe we have to connect everything only once the audio starts playing?

ngokevin avatar Dec 31 '16 00:12 ngokevin

That's probably it. Maybe I can rig a component to do that... I'll give it a shot!

softpunch avatar Dec 31 '16 00:12 softpunch

Doesn't have to be a separate component, but let me know if that's the issue, and we can update the component to handle both autoplay/non-autoplay.

ngokevin avatar Dec 31 '16 00:12 ngokevin

I tried hastily throwing together some setTimeout functions, but I don't think AFrame (or anybody else, really) likes that.

I'll take a look at this again soon.

softpunch avatar Dec 31 '16 01:12 softpunch