discord-music-presence icon indicating copy to clipboard operation
discord-music-presence copied to clipboard

Browser support

Open ungive opened this issue 2 months ago • 0 comments

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 avatar Apr 25 '24 01:04 ungive