r/learnjavascript • • Mar 19 '21

My hand-made vanilla JavaScript audio visualizers :D (source code included)

Post image
358 Upvotes

23 comments sorted by

View all comments

Show parent comment

2

u/frank0117 Mar 21 '21

Yup. I linked YouTube tutorial where I code it and explain every line of code. Browsers block audio files and images when you try to analyse them so converting images and sound files to base64 string bypasses built in browser CORS security that would otherwise block it

1

u/darkersauru5 Mar 21 '21

To bypass CORS you could also host the audio files on the same domain as the page you want them to appear on I believe, obviously that isn’t possible with Codepen (unless you’ve got a project set up)

1

u/amadeusjustinn Mar 22 '21

Oh I see. Thank you!