Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Browser support #5

Open
ungive opened this issue Apr 25, 2024 · 9 comments
Open

Browser support #5

ungive opened this issue Apr 25, 2024 · 9 comments
Labels
enhancement New feature or request needs media processing pipeline This needs a rework of how media is processed internally

Comments

@ungive
Copy link
Owner

ungive commented Apr 25, 2024

Overview

It would be great if Music Presence could support browsers. This is not trivial to implement though, as browsers can usually play way more than just music. Most notably, videos a user is playing might interfere with the original intention behind Music Presence: The user doesn't want to show which video they are watching, but only which music they are listening to. For this reason media from browser's must be filtered in some way.

Ideas

  • More of a workaround: Using one browser only for playing music. Music Presence could share media from that browser without needing to filter anything. Example: Run Spotify in Brave Browser, which has been installed next to the default browser of the user. Music Presence could then simply share all media from that browser in the Discord status. One could even go so far and treat "Brave" as "Spotify" and show the Spotify icon for media from that browser. This is trivial to implement, but not very elegant.
  • Installing a browser extension in the browser, which would then be able to detect from which domain the media is coming and we could filter with that domain (e.g. "open.spotify.com", "listen.tidal.com", etc.). Working with the domain of the site would be perfect, but installing an extension next to the desktop application isn't really great. I'm afraid this is the only reliable solution though.
  • Getting the browser window title and extracting the streaming service from it. Most streaming services keep their name in the title at all times. E.g. "... - YouTube Music". Some don't tho, like Spotify: If media is playing, "Spotify" is not in the title anymore. This has tons of problems though: The browser title could change in the future. A single browser window can have multiple tabs. Only the currently active tab will determine the window title. The user would have to open the media-playing tab before it works with Music Presence (albeit they should need to do that to control the music anyway). And probably the biggest problem: How do we know if the currently active tab in a browser window is the one that is actually playing the media for that browser?

A browser extension is likely the way to go here.

Any input and ideas are welcome!

@ungive ungive pinned this issue Apr 25, 2024
@ungive ungive added the discussion Discussion about development label Apr 25, 2024
@ungive ungive added the enhancement New feature or request label May 15, 2024
@ungive ungive modified the milestones: Version 2.2.0, Version 2.3.0 May 15, 2024
@ungive
Copy link
Owner Author

ungive commented Jun 3, 2024

Currently working on a browser extension to detect media.

@ungive ungive modified the milestones: Version 2.3.0, Version 2.2.0 Jun 4, 2024
@ungive ungive moved this to Todo in Music Presence Jun 4, 2024
@ungive ungive moved this from Todo to Paused in Music Presence Jun 4, 2024
@ungive ungive removed the discussion Discussion about development label Jun 8, 2024
@ungive ungive removed this from the Version 2.2.0 milestone Jul 28, 2024
@ungive ungive unpinned this issue Jul 28, 2024
@ungive ungive added the needs media processing pipeline This needs a rework of how media is processed internally label Nov 15, 2024
@ekimeister
Copy link

I've never written browser extensions nor do I know how the extension gathers its metadata and whether it needs access to website data to function. But if the browser extension requires granting access to site data on every site, starting with no such permissions and granting access only to sites that you need to pass metadata on from to the app would be ideal.

I've seen behaviour like this on some Firefox extensions, where you enable features for specific sites, and only then it asks you to give permissions to access that site's data. I generally prefer extensions that limit their permissions to what's strictly necessary. Of course there are exemptions, e.g. a password manager or an ad blocker where full access is unavoidable by design and usability.

Thanks.

@ungive
Copy link
Owner Author

ungive commented Jan 4, 2025

The extension as I've written it so far is open-source: https://github.com/ungive/media-control-extension

Anyone who installs it would be able to verify it does nothing malicious. I'm not sure anymore, but I think I had to use <all_urls> in the content script. I will look into it again, when I continue working on the extension though.

@XXX10Tacles
Copy link

The extension as I've written it so far is open-source: https://github.com/ungive/media-control-extension

Anyone who installs it would be able to verify it does nothing malicious. I'm not sure anymore, but I think I had to use <all_urls> in the content script. I will look into it again, when I continue working on the extension though.

How to install that?

@XXX10Tacles
Copy link

Also question, my windows detects music from browser so why app cant detect ?

Image

@ungive
Copy link
Owner Author

ungive commented Feb 24, 2025

How to install that?

The extension as it's written now isn't helping with showing a Discord status at the moment, you can only observe and control media playback of your browser tabs. I also haven't made any release so far, you'd have to build it from source. I could do that if you want to try it out.

Also question, my windows detects music from browser so why app cant detect ?

It's detected from the browser, but Music Presence whitelists media players. With browsers specifically it's impossible to tell the exact website the media is coming from, so Music Presence can't tell if it's from e.g. YouTube or another site that you might very much not want to see in your status. Enabling the browser as a whole is not really desirable for most users, so a browser extension is the way to go.

I will continue working on this soon.

@XXX10Tacles
Copy link

How to install that?

The extension as it's written now isn't helping with showing a Discord status at the moment, you can only observe and control media playback of your browser tabs. I also haven't made any release so far, you'd have to build it from source. I could do that if you want to try it out.

Also question, my windows detects music from browser so why app cant detect ?

It's detected from the browser, but Music Presence whitelists media players. With browsers specifically it's impossible to tell the exact website the media is coming from, so Music Presence can't tell if it's from e.g. YouTube or another site that you might very much not want to see in your status. Enabling the browser as a whole is not really desirable for most users, so a browser extension is the way to go.

I will continue working on this soon.

Why not add feature to detect browsers as well and if users do not want, just give them option in settings menu to disable ?

@ungive
Copy link
Owner Author

ungive commented Mar 4, 2025

Why not add feature to detect browsers as well and if users do not want, just give them option in settings menu to disable ?

The initial approach for me was to whitelist every player explicitly, so that users are encouraged to report when a media player does not work and I can collect media player identifiers to better support them, see #4.

That excluded allowing for just any media player to be shown in the status directly. I also didn't want to view a browser as a "media player" and whitelist it, mainly because it's really not a media player, but also since in many cases a user will at some point consume some other media they simply don't want to share in their status and they might have forgotten to turn the browser off again.

In effect it's a design choice. At least I could see myself stepping on my toes numerous times when allowing browser media to be shown in my status without finer grained control.

@ungive
Copy link
Owner Author

ungive commented Mar 4, 2025

To add to that, a browser from Music Presence's point of view is not a "media player" but more like an "application environment". You run web applications in a browser and by enabling a whole browser to be shown in your status you enable any and all of those applications you run in that browser.

If you move that analogy to your operating system instead of your browser, that would be like enabling all apps on your computer without getting a choice which one you want to enable. Either all of them or none.

From a design perspective I don't want that. The user should be able to choose which web application (or website) to share and which not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs media processing pipeline This needs a rework of how media is processed internally
Projects
Status: Paused
Development

No branches or pull requests

3 participants