Use navigator.mediaSession inside nightbot's song request dashboard page

Asked Aug 22, 2025·4 replies·Last activity 11 months ago·Open in Discord ↗
Archived from the original community forum
Things may have changed since it was written. Still stuck? Ask the community on Discord.

Hello, I am trying to provide a way for streamers to have a music overlay while using nighbot's sont requests.

However, it's near impossible to get reliable playback state and metadata from the website alone due to limited access to iframe data and optimizations when the page is not visible.

Would it be possible to implement the use of navigator.mediaSession ?

It would be great if the following data was exposed and updated even when the page is not visible:

  • Song title
  • Song author
  • Song artwork link
  • Song url
  • Duration
  • Elapsed time
  • playback state (paused ect)

Thanks in advance

4 replies

The mediaSession API only provides a limited set of information, but we've filled in the fields which are supported today.

Sorry I conflated mediaMetadata with another object. This leaves a problem though:
When the song request page is not visible in the browser, it will behave differently.
In particular the progress bar wont update wich I'm using to get the progress in the current song.

(It would be nice to also get an aria label on the pause button for the paused/playing state since right now the only way to do that is checking if the little box above the title is "Up next" or "Now playing" but that's dependant on language)

Warm Sheep said:
In particular the progress bar wont update wich I’m using to get the progress in the current song.

That's unfortunately not something we can fix. You'll need to leave the window open in some way so the UI updates propagate.

Warm Sheep said:
It would be nice to also get an aria label on the pause button for the paused/playing state since right now the only way to do that is checking if the little box above the title is “Up next” or “Now playing” but that’s dependant on language

Try checking navigator.mediaSession.playbackState