hvianna / audioMotion-analyzer

High-resolution real-time graphic audio spectrum analyzer JavaScript module with no dependencies.
https://audioMotion.dev
GNU Affero General Public License v3.0
636 stars 62 forks source link

Support Request: Radio stream wont play. #26

Open lexterror opened 2 years ago

lexterror commented 2 years ago

Hi,

The following stream does not play at all.

http://stream.syntheticfm.com:8040/stream

However it does work with a regular html5 audio player.

Thank you!

TiagoCavalcante commented 2 years ago

@lexterror I was having this problem too, seems you need to add crossOrigin="anonymous" to the audio element, and only start the analyzer after the audio starts playing, e.g.:

<audio
  ref={audioRef}
  crossOrigin="anonymous"
  onPlay={() => {
    if (!binded) {
      analyzer.connectInput(audioRef.current);
      binded = true;
    }
    analyzer.toggleAnalyzer(true);
  }}
  onPause={() => {
    analyzer.toggleAnalyzer(false);
  }}
/>
hvianna commented 2 years ago

Maybe related to mixed-content restriction (HTTP x HTTPS). Check the browser console for error messages.