Closed Coriou closed 5 years ago
True, You can actually play a downloaded original YouTube file directly on Sonos (from a local fileshare). So playing the steam shouldn't be a large hurdle
Uh, that's a great news! I'll update the code accordingly as soon as I'm near my Sonos sound system (aka when I'm home)
I took a look today, but wasn't able to play the URL provided by youtube-dl. I haven't found a way to play .aac
files w/ Sonos. Apparently my Play:3 only plays MP3 from http://
URIs.
Check my youtube-fix-28 branch
I haven't worked on this project since this issue actually... My habit of working on a project, then just abandoning it...
So, I checked my code (I could put it on Github as it's really not sensible, but I feel very uncomfortable because it's quite shit tbh) and here's what I remembered :
Can you double check this, and if you're still having problems I'll try to clean and put my code online as a reference.
Wait a second. Do they seriously only consider the file extension? I thought they were using the Content-Type
header field. WTF
I'll try again by adding .mp4
to the URL and report back
Yeah, 16375c8 fixed it. Thank you for your suggestions! Now I'm also able to seek the songs played on YT :rocket:
Nice job !
Thank you again for your suggestions! I also fixed the Soundcloud problem, therefore we can now seek songs easily
Hey, I was just browsing through your code because I'm currently setting up a little system at home to easily stream Youtube to my Sonos speakers. I wish I found this project before...
Anyway, I got it working and I have a little tip for your plugin (sorry I don't have time to PR this) :
In most cases, you actually don't need to transcode the video. I thought so too at first and it's how I was doing it. But it turns out, Youtube serves (for most videos) a format that Sonos can read. Look in the formats sent by ytdl and you just need to pick the audio codec
aac
in themp4
container. You can use the URL to stream directly from Youtube with all the good stuff (most important to me was consistent seeking because the way you're doing it now doesn't allow for real seeking through the track).I can maybe PR this later if you don't do it. Ideally, you'd fall-back on transcoding if the desired format wasn't served by Youtube. So far, in my very humble testing, I've only found 1 video that didn't work using this technique and that I had to transcode.
EDIT : Here's an example URL I got from ytdl that you can feed directly to Sonos (link)