12 ms·
I hacked SONOS and YouTube the same day
- kclay 5y agoI assume this is what the SonosTube[1] app does. It's pretty nice [1] https://play.google.com/store/apps/details?id=frontier.sonostube https://play.google.com/store/apps/details?id=frontier.sonos...
- winternett 5y agoEvery day I'm frustrated by apps that I know were once highly simple and functional. The idea that we're paying for devices and apps that are artificially limited and hobbled by others seeking more profit really has me worried about the future. For example, Winamp ran several years as a music player, although it was not a very profitable operation, it functioned just like every other consumer music player since the 70s, with play, stop, track skipping, fast-forward, shuffle play etc... Now music players have completely screwed up the model for a music player. They more often don't function properly unless a subscription is paid for.... They insert ads into music playlists, they often skip more than one track, they don't truly shuffle music, and they also add a ton of frustration with buffering and connectivity issues into the simple process of listening to music, even when I play my locally stored collection of music on them. The practice of reducing features in something as simple as a music player, a device that is meant for enjoyment shows how grim the concept of a software-driven world should be. Products are rarely solving problems now, they are only introducing new and stupid problems, and not innovating further. It's a huge problem that should be addressed. I'm tired of hobbled functionality, hack the planet. :P
- lpapez 5y agoThere are literally hundreds of simple (and open-source) music players out there, including Winamp you mentioned and its offspring. What is preventing you from using those? IMO, this is the same argument like when people say "modern music sucks" without ever searching for amazing new bands outside the mainstream.
- RC_ITR 5y agoI think GP is confusing 'I went to the store and bought this CD, and burned it to MP3, which plays for free on Winamp' with 'Winamp was free and now I have to pay for that same experience via streaming.''
- omgitsabird 5y agoWith the right attitude, you can rip from streams and play it for free from Winamp. You can also buy a lot of music as an MP3.
- BiteCode_dev 5y agoMost people don't have the medium. I have 30Go of music files on my laptop, that I carefull update, and backup. I add to the collection once in a while. But few do that anymore: no cd player in devices, and file systems are being abstracted away remember? So they listen to music on youtube, spotify, soundcloud, etc. They don't own the music, hence they can't chose the player.
- winternett 5y agoYouTube music offered to import my personal music library (on my phone). I declined, because the last time I allowed that to happen on Google Play Music (now retired) it was covertly deleting music from my library, and carefully picking which songs to play every time I used it. You simply can't trust free apps any more. Probably can't even trust many of the paid ones because making people buy the same thing multiple times is more profitable for opportunistic individuals. Keep backups in multiple (independent) locations.
- BiteCode_dev 5y agoFree as in free beer apps no. But FOSS apps are still there for you. VLC is to this day the best video players, across all OS, and can read music. It's as not convenient to play music though.
- nexuist 5y ago> They insert ads into music playlists, they often skip more than one track, they don't truly shuffle music, and they also add a ton of frustration with buffering and connectivity issues into the simple process of listening to music Why are you comparing music players to streaming services? That's like comparing a Honda Civic to a cement mixer. You don't use both to accomplish the same job even if they both have four wheels and a gas pedal.
- winternett 5y agoStreaming services leverage playlists, and they insert ads into those playlists. Streaming services like Spotify, are music players by nature obviously...
- filoleg 5y agoYou are just being pedantic, while the parent comment offered a fairly useful distinction between those two types of services, even though it might not be the dictionary definition. >Streaming services like Spotify, are music players by nature obviously... Both a cement mixer and a honda civic are vehicles that one can drive on the road by nature. The point still stands that they shouldn't be compared directly, as they serve completely different purposes (despite them both being drivable vehicles).
- jethro_tell 5y agoif you pay for spotify, there are no ads, just like if you paid for your music and a music player there would be no ads. And before you tell me you got your music and player on the high seas, you can still do that so I don't see how anything has changed.
- nitrogen 5y agoThe "job to be done" is still listening to music on demand.
- folkrav 5y agoMusic players were decoding local files and spitting out the output, now they're streaming platforms. Despite fitting the same niche of "I want to listen to music" for many people, they're not selling you the same product at all. AFAIK the local players still exist, many still in active development, for those who want to own their data.
- HotHotLava 5y agoThe ownership question is orthogonal though, a Sonos speaker is also able to play your self-hosted music collection from a local samba share.
- deleted 5y ago[deleted]
- bluescrn 5y agoSonos built a great system then destroyed it with greed/planned obsolesence. They shafted so many customers with the S1/S2 incompatibility, leaving so many expensive and perfectly capable 'legacy' systems unable to add new (S2) devices. It was purely to try and force people to upgrade perfectly decent devices, and prematurely turn a whole lot of S1 devices into e-waste. While their products are still good, I wouldn't buy one again for fear of them introducing an S3 and rendering another set of devices obsolete.
- djrogers 5y agoI was upset at the time, but in hindsight, and given how they've managed to continue to support both S1 and S2 product lines, I can't really say they did it wrong. Bifurcating your app to continue to provide support for 10+ year old hardware is a lot better than simply EOL'ing said hardware.
- bluescrn 5y agoThe problem is that '10 years old' in computing is fairly ancient, whereas in hi-fi, quality hardware will keep going for many decades with minimal maintenance. Not sure why they felt the need to split the app into two rather than support the control of all devices through a single app, even if the S1 devices have a bit less functionality, or if S1 and S2 devices can't be grouped into a single zone. And then they've prevented some new devices from running with the S1 app. My parents tried to buy an extra speaker, but it didn't work with their S1 system (whereas only a few months ago, they added a soundbar that worked fine) It's a mess. It could have been handled a lot better. What new features do you even get with S2 that require more powerful hardware?
- avianlyric 5y ago> What new features do you even get with S2 that require more powerful hardware? * Airplay * Hi-res audio formats * Better onboarding experience (BLE based, and can take advantage of iOS APIs to share Wifi password) * Support for DTS and Dolby Atmos I suspect the reason for bifurcation is because the speakers form a cluster on your network. The apps don’t talk to individual speakers, the speakers elect a cluster leader and the app talks only with the leader. The leader then figures out how to get your command to the target speaker, which may be via your normal wifi, but could also be via the private Sonos Net mesh network the speakers form. They want all the speakers to run exactly the same firmware because it’ll significantly reduce the complexity of their net code. No need to write forward or backwards compatible protocols, every speaks the same language. Side effect of this choice is that your firmware features become limited by your oldest hardware, even with feature flags, binary size could still be an issue for old devices. So this means at some point you need either: 1. Start running two firmware versions, and some how make your net code forward/backwards compatible. Very difficult when dealing with tightly defined high entropy protocols needs for low latency comms, and super tight timing requirements. 2. Split make a set of your devices stuck on old software and incompatible with new hardware. So new and old can no longer join the same cluster. But simplify your net code. Sonos obviously chose option 2, and I can understand why they made that choice. As for the apps, having them communicate with two different Sonos clusters, and somehow merge the UI sounds like a UI nightmare. Not unsolvable, but it wouldn’t surprise me if they tried it, and decided the experience was so crap and confusing, they were better of just making two apps. Given what Sonos do, and rather extreme technical requirements of syncing audio to within a millisecond or two over dodgy wifi connections. I can sympathise with the difficult technical and product decisions that led to S1/S2. I personally doubt it’s an artificial limitation created for cynical profit pumping. But I can totally see it as way of reducing their software development complexity and costs, which is not an unreasonable business decision (Sonos isn’t a charity after all).
- tehwebguy 5y agoYou can pick up this bluetooth board for $0.79 + $1.67 shipping to the US and solder it inside of your favorite dumb speakers: https://www.aliexpress.com/item/4000437975620.html https://www.aliexpress.com/item/4000437975620.html [The red one for sale at the moment doesn't make any sounds when you connect to it, the $0.79 black unit speaks ("now in bluetooth mode") when I connect to it, not great]
- jethro_tell 5y agoBluetooth doesn't really cut it for me in a multi-person household, though If I was on my own I would be fine like that. We have multiple people constantly playing, and multiple locations to play to. Bluetooth is good for a single speaker and single primary playing device but doesn't really solve multi-room multi-user music very well.
- nitrogen 5y agoWe really need an open standard for wireless and wired audio distribution, so different brands can interoperate.
- jethro_tell 5y agoVendor lock in and DRM make media playing such a shit show even 10 years after it should be super simple.
- ganlaw 5y agoVery interesting read. As a purely front end engineer, I am always fascinated by other peoples ability to reverse engineer everyday systems that I use and complain about. If I wanted to learn more about reverse engineering, do you have any recommended readings or talks?
- davewritescode 5y agoThis one is pretty simple. All the communication with the sonos device happens in the clear and the protocols are actually pretty well documented. Getting good at using wireshark is a good place to start. This project is pretty dead but I remember using it a few years ago https://github.com/stephen/airsonos https://github.com/stephen/airsonos
- korijn 5y agoStart by reverse engineering things in your comfort zone. You must already use a couple of libraries in your front end work. Hone your reverse engineering skills by trying to implement the same thing yourself. It's mostly about the ability to figure out how something works by observing and testing its behavior.
- IceDane 5y agoThere is really not any way to give anyone a guide to doing what this guy does because it's not applying any special techniques to do anything. This isn't a binary reversing guide using a specific way to decode an encrypted executable, or whatever. This is quite literally just a guy who uses what he knows to figure out what is going on, and then learn more as is needed. It will help not to put yourself into a box beforehand, like calling yourself a "purely frontend engineer." This is the kind of useless label for yourself that only serves to make you yourself think that you should stay in some arbitrary, badly specified corner of CS knowledge. Literally just read about things, then use that knowledge to deconstruct other things. That's all that's going on.
- _0ffh 5y agoI have something much, much worse: I've got a rabbit hole! Here's two mirrors of a quite old website that is heavy on reverse engineering lore. While technological details may be outdated, many of the teachings certainly still apply. http://www.darkridge.com/~jpr5/mirror/fravia.org/index.html http://www.darkridge.com/~jpr5/mirror/fravia.org/index.html http://woodmann.com/fravia/ http://woodmann.com/fravia/ Edit: Sorry that the page is somewhat labyrinthine.
- AmazingTurtle 5y ago
- polishdude20 5y agoWould the conversion of the MP4 be able to be done using ffmpeg?
- mattmar96 5y agoYes, even as a stream. The author mentions that a streaming conversion of mp4 to mp3 would be very difficult/impossible. I actually built that exact system for a simple youtube->mp3 downloader. FFMpeg can perform a streaming mp4->mp3 conversion. See here: https://github.com/matttt/youtubesampler/blob/master/main.js#L15 https://github.com/matttt/youtubesampler/blob/master/main.js...
- deadf00d 5y agoIt's not impossible, but it would be way less efficient as it need complete re-encoding of the audio, as my system just re-format the container format.
- amaccuish 5y agoOne day I'll wireshark the weird streaming protocol they use instead of just upgrading to SMB2/3. I'm pretty sure it's HTTP.
- 71a54xd 5y agoThe co-working space I used to go right out of college used to have Sonos speakers. Occasionally, there'd be times when I wanted to work where the couches were but didn't want to listen to blaring pop music or something that was too rhythmic later in the day, so I started looking for ways to interrupt the audio stream going to the sonos devices. It turns out after a bit of snooping with nmap and looking at some Sonos forums that two specific ports are used to maintain sync between Sonos speakers and stream data to them. Then I just wrote a python script that would blast these ports with TCP traffic on the wifi (which the sonos speakers were also connected to) and would use the script when I wanted peace and quiet without headphones. Turns out that networking class I took in college wasn't a waste afterall.
- sgarman 5y ago1.) Could you not have just asked them to change the music? 2. Did that cause any other degradation to the network?
- iypx 5y ago1. - Not OP, but I believe the moment you put some music/radio on speakers for other people to listen, legally, you become a broadcaster. You can't just play anything you want, you need a license :) I recall my last workplace mentioning they're paying a few thousands a year to stream just one radio station, same 20-30 songs 24/7...
- chinathrow 5y agoFor those on Linux, Noson works great to control SONOS.
- deadf00d 5y agoBut wait... That's my article ! Thank you guys for reading and sharing. I get so much great returns and kind messages. I'll keep you updated for the app !
- lucas_v 5y ago
- alex_young 5y agoDon’t people usually create profiles shortly before they decide to post something for the first time?
- robbedpeter 5y agoWell it's definitely unusual to do it after.
- userbinator 5y ago"I hacked SONOS and YouTube and HN on the same day".
- deleted 5y ago[deleted]
- motoxpro 5y agoThat's not strange. They saw the article/someone told them it was here, they signed up to say thank you...
- WillPostForFood 5y agoa minute before this comment was posted
- thatguy0900 5y ago
- makeworld 5y agoInteresting. I feel like the code could be simplified and be a lot more resistant to YouTube changes by just using yt-dlp, and selecting (or automatically extracting with ffmpeg) the audio-only AAC format YouTube serves. That would get rid of the YouTube request and MP4 parsing code.
- X-Cubed 5y agoI'm not sure it would, as the article seems to say that Sonos requires an ADTS container for the AAC audio, which YouTube doesn't offer. So the app takes an MP4 container, filters its contents to find the AAC audio blocks, then repacks them in an ADTS container.
- deadf00d 5y ago^ good reply
- Guillaume86 5y agoI think ffmpeg adds ADTS by default when extracting AAC from MP4 but don't quote me on that.
- Sesse__ 5y agoTypically the other way around; ADTS is a way to get AAC within MPEG-TS through means of a wrapper. If you remux AAC from MPEG-TS (like e.g. a satellite feed) into MP4, it strips away the ADTS wrapper (and adds a single ASC header for the MP4 stream metadata) using the aac_adtstoasc filter. I never really understood why you couldn't just put AAC directly into MPEG-TS without the ADTS wrapper, but MPEG-TS is pretty weird (and with super-high overhead) anyway.
- charcircuit 5y agoWhere is the part where YouTube gets hacked?
- hirako2000 5y agoI also can't find how that's hacking YT. There was a time, not so long ago, security bugs hunters would claim they found some oddities within a sub module of some software, then disclose how it leads to escalation of privileges, 7 other severe flaws leading to remote code execution, ending with a mention that it makes half of the internet vulnerable since it's Apache or some other broadly used utility.
- X-Cubed 5y agoHacking doesn't just refer to security vulnerabilities and unauthorized access. "A hacker is a person skilled in information technology who uses their technical knowledge to achieve a goal or overcome an obstacle, within a computerized system by non-standard means." https://en.wikipedia.org/wiki/Hacker https://en.wikipedia.org/wiki/Hacker
- butwhywhyoh 5y agoEven by your definition, you would consider writing an MP4 parser as "hacking YouTube"?
- d8c6c050cb0a4d7 5y agoSeems reasonable by the above definition. I would say the standard way to consume audio from youtube is to play the video on youtube.com or in the app, not by writing an MP4 parser.
- butwhywhyoh 5y agoSpoiler alert: it doesn't. But that won't stop them from making this nonsense clickbait headline I guess. I guess parsing an MP4 file from YouTube is now classified as "hacking YouTube".
- deadf00d 5y ago
- FridayoLeary 5y agoI'm a bit alien to these kind of things and i cannot believe that a speaker could be limited in such a way. It's sole function is to play sound from a device and it utterly fails at that. Why do people put up with such rubbish? I get upset when i see a speaker without a jack port. Also, the article is excellent but the title lets it down. Can i suggest it be changed to something like "reverse engineering SONOS to play YouTube". If deadf00d is still on maybe you should also rethink the title?
- deadf00d 5y agoYep, maybe the title is a bit weird, I wanted something catchy at first, and I think it worked great. Maybe a would do something different from now.
- alar44 5y agoYou're missing the point of Sonos entirely. It's generally used to create zones in a house or workspace. It's not meant to be just a bluetooth receiver, there are a zillion other products that do that just fine.
- avianlyric 5y agoHow exactly is it limited? The author wants a speaker to pull a video off YouTube, which isn’t exactly know for be friendly to non-official clients, and play the audio. Please find me any speaker in the world that can be given a YouTube URL and will play the video audio with no other equipment involved. I’ve tried writing the URL on the speaker cone of my boring speaker, unfortunately no sound is coming out. If the author just wanted to plug speakers into his computer and get sound, then he would have bought a non-smart speaker and amp. But clearly the author likes the ability to stream audio from the internet directly to his speakers. It’s just unfortunate that YouTube refuses to let people easily access the audio stream from their videos.
- NoPicklez 5y agoIt's a WiFi connected speaker which is controlled through an app that you register music services on. This means that the audio ecosystem isn't reliant on streaming the music from your device, but from the service itself. All of the speakers are connected through the main controller app that you can use to group into rooms and setup as a home theatre. I've had their products for the last 7 years and they've never missed a beat.
- NoPicklez 5y agoAn important reason why you can't play Youtube videos through Sonos is because the music providers are linked into the app. This means that it doesn't rely on the device to play the music. It also means that when I open up the app I can play music from my housemates Apple music account, as well as my Spotify account. But I agree, they did remove the ability push music from some apps directly to the Sonos app on Android & PC. For me I play Youtube videos by Chromecasting them to the TV, which is connected to my Sonos playbar and the rest of the ecosystem.
- deadf00d 5y agoYep, the Sonos bar is the exception. But most of the products from sonos doesn't even have a audio input ! That's the why of this project. You can only control a Sonos beam from their crappy app and what's drove me crazy.
- NoPicklez 5y agoAgreed, my only gripe is that the app has never been snappy fast.
- GrifMD 5y agoThe lack of audio input's is driving me bonkers. I have a record player and Sonos Beam. To use it, I have to plug in a mic adapter into my MacBook and connected that to the record player, then use Loopback Audio to redirect the input audio as Airplay audio to my Sonos Beam. Truly how "analog" audio was supposed to be listened to. I've tried getting a Raspberry Pi and following some guides to turn it into an internet radio broadcaster that I can then pipe into Sonos, but the audio quality was always atrocious and the case that came with my Pi kit has a fan that is super loud. I could get a Sonos Port for 700 AUD and do it the official way... but my record player is only like 300 AUD so it doesn't seem worth it. Here's hoping I can find a cheap used one. Sonos needs to add an analog audio in port on more of their devices.
- NoPicklez 5y agoI just don't think Sonos speakers are built for that type of use case, they are first and foremost a wireless speaker and always have been. They were never designed to allow for devices to plug directly into the speakers, as it wouldn't then be controllable across the array of other Sonos devices, which is the point. I agree that it wouldn't take much to do so and it would increase its accessibility, but I just don't think they have an appetite to do that. The Sonos port device which they have had to allow you to physically connect devices has always been atrociously expensive. To think that I could buy two of their rear Sonos speakers and still have money left over be cheaper than the port is just silly.
- hbarka 5y agoI just bought a Sonos soundbar and I have never had such a difficult time getting an app to pair and function with the device. It was also quite invasive requiring Location to be enabled, Microphone to be enabled, Local Devices to be accessed, just to get it to set up. It was already connected via HDMI and optical cable, as hardwired as you can get, and there were still cloud hoops to go through.
- nitinreddy88 5y agoIf you have purchased Sonos without reading how it works, probably the mistake is yours. First time setup requires this because Sonos uses your phone microphone to automatically measure your surrounding wall space to tune itself to best experience. In fact, this is why everyone loves Sonos as all you need is phone and everything is tuned.
- hbarka 5y agoYes you’re right regarding the True Sound customization using the mic. My difficulty is the Sonos app keeps dropping connection because my router is set DHCP and the app expects the same static IP address as the day before but I have dynamic addressing. Doesn’t occur with my other IoT.
- cordenr 5y agoNB: TrueSound requires an iPhone, it doesn't work in the Android app. I had to have a friend run the setup for me. I didn't read/notice this when I researched soundbar options. Had I known this in advance I probably wouldn't have selected it.
- imwillofficial 5y agoWhat is with the super bold font for products and technologies. Made reading the article a chore
- denysvitali 5y agoShameless plug: I did something similar 6 years ago and created sonos-web. Sadly I stopped working on the project, but it was indeed cool to play Youtube videos on your Sonos device (among other things). https://github.com/denysvitali/sonos-web/ https://github.com/denysvitali/sonos-web/ https://github.com/denysvitali/sonos-web/blob/master/plugins/youtube/main.js https://github.com/denysvitali/sonos-web/blob/master/plugins... Screenshots on the README are not available anymore, but I managed to find these: http://stadt-bremerhaven.de/wp-content/uploads/2016/08/sonos-web.jpg http://stadt-bremerhaven.de/wp-content/uploads/2016/08/sonos... https://stadt-bremerhaven.de/sonos-web-open-source-loesung-fuer-sonos-bedienung/ https://stadt-bremerhaven.de/sonos-web-open-source-loesung-f...
- CyanDeparture 5y agoGreat article. Thanks very much for it. There's a typo in the heading "Or how to play YouTube videos on you SONOS, easy and for free." I think might want "your SONOS" instead. :)
- voqv 5y agoI need to try to do this for HEOS
- pontifier 5y agoI recently built the Murfie music service app for SONOS. You can go to a web page served by any SONOS device and tell it a url to treat as a music service. Code up a SOAP service there and you'll be able to do anything that any other music service does. I'd never done anything with SOAP before, so there was a bit of a learning curve, but once I got over that hurdle most of the other coding was fairly easy. Their developer portal explains basically all of the things you can do. Getting the service approved was the hardest part.