Okazari/Rythm.js

Recognize youtube audio stream

limfix opened this issue · 2 comments

I'm using youtube iframe API in my project. How can I intercept the sound from the player and process it with rythm? Is it possible? Thank you!

This is currently not possible due to cross domain limitations with iframes.

I can make i work in the youtube page.
Go on a youtube video (on the official youtube.com)
Open the javascript console and paste the following :

const rythmScript = document.createElement('script')
rythmScript.src="https://cdnjs.cloudflare.com/ajax/libs/rythm.js/2.2.3/rythm.min.js"
document.head.appendChild(rythmScript)
document.getElementById('logo').classList.add('rythm-medium')
document.getElementById('search-form').classList.add('rythm-bass')

Then paste this

const rythm = new Rythm()
const video = document.querySelector('video')
rythm.connectExternalAudioElement(video)
rythm.start()

and it should work like a charm !

Problem is, when you're running this code outside of the youtube official page, you can't access to the video element within the iframe.

If you find a way to get this element, it should work pretty easily. Otherwise... we're doomed :'(

Thank you for response. Anyway your project is awesome! Keep it up 👍