setActionHandler

The setActionHandler() method of the MediaSession interface sets a handler for a media session action.

MDN Reference