otommod / browser-mpris2

Implements the MPRIS2 interface for Chrome and Firefox
92 stars 21 forks source link

Soundcloud support #10

Closed mikroskeem closed 5 years ago

mikroskeem commented 6 years ago

Just making todo list(if it exists) bigger :smile:

Would be nice to have

// enhancement

otommod commented 6 years ago

So, I poked around the site a bit. It's quite the complex webapp, as everything is these days.

Play/pause and next/previous, through the UI, work fine. Let's do some seeking then. That's where the problems start.

There is no <audio> tag to be found in the DOM. Not an insurmountable problem but we have to resort to annoying solutions (monkeypatching the document.createElement function with our own that tracks <audio>). Moreover, SoundCloud don't use normal files but blobs. Now, on its own that is not a problem. However, on seek a new blob is created that is not the full song so the currentTime and duration on the <audio> element are mostly wrong.

So next idea: use the UI for seeking just like everything else. However, my fake MouseEvents don't register for whatever reason. From what I can see in SoundCloud's code isTrusted is never checked so I don't know what the problem is.

I thought of using the API but it can't be used to control the playback on the site itself, only for external playback inside other apps or sites. At least, I don't think it can.

So, in conclusion, I'll make half the site work. It's probably the half most people use anyways through MPRIS2 but it'd still be nice if I could also make seeking work. If someone knows how, feel free to request a pull!

otommod commented 6 years ago

Checkout the soundcloud branch for a very rough first try.

otommod commented 6 years ago

Ping; with the recent changes I think this is mostly resolved.

mikroskeem commented 6 years ago

Ah right, I had to test this. Will do that tomorrow :smile:

otommod commented 5 years ago

ping

artizirk commented 5 years ago

@mikroskeem @otommod i just tested the soundcloud branch and it works on my machine.

I only tested play/pause and prev/next track and track info