title: I want to a create an audio visualizer for youtube videos, but cross-origin requests won't allow access to embedded iframe
body: <p>My objective is to create an audio visualizer that responds to the playback of a Youtube video. Unfortunately, YouTube uses an iframe, which seems to mean that accessing the media stream is impossible due to cross-origin requests (at least, I haven't been able to get it to work).</p>
  <p>Is there a front-end solution? Is there any way to hook into the browser audio, or accomplish this in some other way without accessing the iframe's inner DOM elements?</p>
  <p>What about using a library to download the video/audio and store it in local browser cache? Is it possible to sync with the embedded playback by getting a timestamp from Youtube's api and read a local copy for the audio processing? I've been trying all day to select the video element and create an audio context, but I don't know if there are any options to explore.</p>
  <p>There is a similar question about 7 years ago: <a href="https://stackoverflow.com/questions/27535244/is-there-anyway-to-visualize-youtube-audio-from-an-iframe-using-the-web-audio-ap">Is there anyway to visualize youtube audio from an iframe using the web audio api?</a>
  But the only solution required using something called &quot;youtube-audio-stream&quot; which is some kind of local app to stream youtube audio. At least, I haven't been able to get it to work with codepen, jsfiddle or codesandbox. I'd like it to be used alongside or transparently with the embedded youtube player and I'm not exactly sure if that is the direction I should be looking.</p>