how does a browser know when a video / audio is playing and post the “playing” notice in the title bar?

enter image description here

When a media source is playing via an iframe from remote locations like Youtube, Vimeo, CNN etc, the browser’s title bar shows the play state and allows click to mute at the title bar. What is the coding method that executes the notice?

I looked at a few methods including the following but cannot determine what listener process should exist to get the state, being that the sources are remotely inserted

  • window.navigator.mediaSession
  • mediaStream()

What I want to do is set a condition such as this concept

const browserNoticePlaying = document.addEventListener("browserNoticeEvent", function(e) {
  if( e.playState === "playing" ) {
    return true;
  }else{
    return false;
  }
});

if( browserNoticePlaying ) {
  $("#container").html("<h3>This is the thing to see</h3>");
}