For the browser (i.e. not dPWAs), MediaKeysListenerManagerImpl creates the singleton SMC object which is not stored inside the WebAppSystemMediaControlsManager
.
This singleton tracks whatever most recently active media is playing within the browser, it will not track media playing in PWAs.
For dPWAs, WebAppSystemMediaControlsManager
is the primary coordinator class who holds all the instanced system media controls. It knows if a dPWA already has an associated system media controls connection or whether it needs to be created.
This manager in turn holds a collection of objects for each dPWA which is used by that dPWA to communicate with the OS.
//components/system_media_controls
contains a lot of the platform specific code to implement this functionality.
code in //content/browser/media
is used to be notified of events happening in the renderer, some notable ones include:
active_media_session_controller.h
is used to control instances of playing media. System Media Controls uses this to either track specific dPWAs playing media or implement the browser singleton that follows the active media playing in the browser.
system_media_controls_notifier.h
receives messages from media playing and notifies the corresponding SystemMediaControls
object in order to update the OS.