YouTube Music Desktop


There is no official Desktop-App for YouTube Music.
Google Play Music Desktop Player exists but it uses a lot of resources on my laptop, is kinda slow and doesn't use Windows Close-, Maximize- and Minimize-Buttons, they use their own design.
So I decided to make my own Desktop-Player for YouTube Music.
I made an Electron-BrowserWindow which just displays the YouTube or YouTube Music Webpage, found the classes or ID's of the "Play"-, "Forward"- and "Backward"-Buttons on the YouTube Page in the DOM-Inspector and registered global keybindings for the media-keys in Electron. Whenever one of these keys is pressed, Electron executes some JavaScript on the Webpage. Just a simple click on the corresponding Button.
Now I finally have a lightweight YouTube Music Desktop-App.

Unfortunately, it doesn't quite work as expected... At least on my machine, it has to be the first program to bind the media keys, otherwise it can't bind them at all. Since the app is always running I just put it in autostart, so it's the first to register those keys. To prevent accidentally closing the app & not being able to get the keybindings to work anymore, the app minimizes to the system tray if it gets closed. It can be closed for real in the context menu of the tray-icon.

Code on GitHub