kiding / beotsmusic

Standalone Mac OS X browser for Beats Music
http://beotsmusic.kiding.net
MIT License
26 stars 5 forks source link

Play Music with HTML5 Audio instead of Flash #4

Open nilsou opened 10 years ago

nilsou commented 10 years ago

Chrome does that thing where even if you don't have flash installed, they have a version embedded in the app.

I'd like to keep my computer flash free and this would help me :)

kiding commented 10 years ago

Hi, thanks for reaching out.

I do like the idea because, well, I don't like Flash either. :smile:

There might be two approaches to do so.

  1. Keep the current WebView (OS X's WebKit framework) implementation and load Flash runtime dynamically. Not yet sure it's easily possible yet. Redistributing Adobe Flash is prohibited, so we should use some open source Flash runtime projects, such as Mozilla's Shumway or Flirt. By far they are experimental so some testing would be required.
  2. This one seems more popular; Chromium Embedded Framework. But for this one, we're basically talking about removing WebView implementation and re-implement all using CEF. Also, since the whole Chromium should be embbedded, the application size may exceed 100MB.

For now, it's always recommended to use ClickToFlash.

melvinram commented 10 years ago

IMO, adding Flash to Beots doesn't make sense. The version of Flash in Beots will become outdated and will require constant upkeep. Instead, if there was a way to detect if Flash was installed or not, and just point people to https://get.adobe.com/flashplayer/ if it's not, that would solve the problem in a simpler way.

kiding commented 10 years ago

@melvinram That's a fair point. However, for the option 1 I mentioned, there might be the least need for continuous updates as long as the audio player is working; the only thing Beats Music uses Flash on their web app.

Especially, Mozilla's Shumway is supposed to work on top of the Web Standards, not as a plug-in, which means no security concern as long as Safari is safe. I haven't confirmed it works well with Beats Music though, but if it does I think it might be worth exploring it.

kiding commented 9 years ago

flash media soundmixer

After a bit of testing on Firefox Nightly, it seems Shumway doesn't work properly with Beats Music audio player, well precisely, SoundManager2. I suspect some libraries are not yet implemented at Shumway's end, but can't be sure.

By default, the player makes use of HTML5 Audio first, and Flash as a fallback. In this case, since Beats Music uses RTMP protocol for streaming music, fallback is always being used. Well, this was a good news – if I could give the MP3 URL to the player, everything should work, nothing should be broken.

It turns out, the very API endpoint for audio resources, /audio not only accepts protocol parameter rtmp but also httpd, which returns MP3 URL. After some more tricks on SoundManager2, I could manage to play tracks without Flash. Now I'm making the code more robust for deployment. Here's a proof-of-concept.

screenshot

EDIT: I've just learned that Beats Music currently uses a service provider called MediaNet for music content "fulfillment." There's a good chance Apple will change the provider to, well, itself, so things may change dramatically.

kiding commented 9 years ago

screenshot

It seems Apple (Beats) has closed the workaround. I hope there is another way, but for now let me investigate further. Thanks to @benvblanco for noticing this.

EDIT: It seems they have simply blocked the access of httpd value for protocol parameter for the tokens generated with the web app API key. This should be tricky.