LINE Music media keys

LINE Music media keys

LINE MUSIC

I recently switched from Spotify to LINE Music. LINE Music doesn't have a desktop client, but a web player. The player doesn't support the media keys: "next track" and "previous track", which was a dealbreaker for me. I still wanted to use LINE Music because of the Japanese and Korean music content, so I created a script to make the media buttons work. The script is manually clicking the "next song" and "previous song" buttons in the web interface when I press the media keys.

The script is adding a keyboard listener for the nexttrack and previoustrack keys on the keyboard. When we press these keys we manually click the DOM elements on the web page that plays the next or previous track.

media buttons

To make this script run everytime I open LINE Music, I created a script using TamperMonkey, a Google Chrome extension. For more details about how you can use this yourself, visit my GitHub repository and follow the instructions there.

As a sidenote, the script also injects a monetization tag into the html DOM. If you are a Coil Subscriber, you automatically support me through microtransactions.