Skip to content
This repository has been archived by the owner on Nov 16, 2022. It is now read-only.
/ vkaintegra Public archive

VK.com audio integration with MediaSession API

License

Notifications You must be signed in to change notification settings

Sasha-Sorokin/vkaintegra

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VK.com integration with MediaSession

🇷🇺 По-русски →

This userscript integrates VK.com Audio Player with new MediaSession API. It is highly useful if you already use desktop integration extension for your desktop desktop environment (for example, Plasma Browser Integration for KDE). This script can also send now playing notifications if enabled.

Without userscript Using userscript
Screenshot Screenshot
  • Cannot really control media, only seeking
  • No title or artist name neither
  • Dynamically changing controls
  • Cover1, artist, title and album/playlist name
  • Now playing notifications2
  • Spotify-like “previous track” button behavior3

1 Unfortunately, VK does not download data about album for tracks played not from albums, only small cover image is available, whereas you play tracks from albums, the the large cover is being loaded. There is no easy fix for this.

2 Notifications are only sent if you enabled them in settings and granted permission to vk.com to send them.

3 If player is playing song for more than 2 seconds, pressing “previous track” button will just seek to beginning of the current track instead of actually switching to previous track. This is also can be configured in settings.

How do I use it?

You have to install userscript with the preferred extension (Tampermonkey, Greasemonkey, Violentmonkey). Clicking on the following button with extension installed will open you an installation window.

Installation button

You still need system-wide integration which will use provided data:

  • On Windows, Chromium can initialize on-screen media controls and bind media keyboard keys, if you have enabled “Media Session Service” flag (chrome://flags/#enable-media-session-service)
  • On Linux, KDE provides Plasma Browser Integration extension for Firefox and Chromium, which uses data from MediaSession along with monitoring web page audio and video elements to provide you controls and display media info. Read more →
  • Chromium also has global UI controls. They can be enabled using flag “Global Media Controls” (chrome://flags/#global-media-controls). Learn more →

“Chromium” means all browsers based on it, including: Google Chrome, Opera, new Edge, Vivaldi, Brave. Although, they can not support some of the flags required above.

Reporting issues

The userscript relies on exposed VK.com site API without any documentation, therefore it may not work correctly in some situations. If you have any issues with this userscript, please report them in Issues section →