I came across an interesting addon for Firefox – media-keys. It allows you to control various players in the browser with the help of media keys on the keyboard, for example, music vkontakte, yandex music, youtube, etc. At what this addon works not only when the window you need to manage is not active, but even if the browser is minimized. Very comfortably. It can be dounloaded here.
In order for this addon to work correctly in Ubuntu, developers recommend to put the library libglib2.0-0
sudo apt-get install libglib2.0-0
Video on the topic: