How to tell windows what song is playing?

  audio-player, html, javascript, windows

I’m building a music player for Windows and currently when I adjust system volume, the popup shows up saying "music.html" (the app has multiple features, each page inside it has it’s own html file). How can I tell windows what song is playing there and how would I add media key functionality (Pause, Skip, Back buttons)?

I’m playing the music using:

var song = new Audio(/*link to the first song on the playlist*/);

then loading the new audio file using javascript after that when the new song is clicked on the playlist. Skipping the song is done by emulating the next song being clicked. I have all the song information preloaded using:

var songName = $("#selection").children("option:selected").attr("song");
var artistName = $("#selection").children("option:selected").attr("artist");
var albumName = $("#selection").children("option:selected").attr("album");

and I get the album art later on, the var with the link to the album art photo is "res"

(Sorry for the bad explanations, I’m completely self taught and don’t know all the correct terminology)

tl;dr: How would I take information loaded inside my program, and feed that to windows so it shows it in the popup when I adjust system volume. And how would I make it so the media keys on my keyboard can control the music, I already have functions set up in the code for controlling the music, playSong(), pauseSong(), skipSong() and backSong().

Source: Windows Questions