Media Session plugin
0.6 KB gzipConnects the player to the Media Session API: title and artwork on the lock screen and in system media controls, plus hardware media keys for play, pause and seek.
Play, then check your system media controls or lock screen.
Install
npm i @tomato-player/plugin-media-session
Usage
player.ts — tsimport { createPlayer } from '@tomato-player/core';import { minimal } from '@tomato-player/skin-minimal';import { mediaSession } from '@tomato-player/plugin-media-session';createPlayer('#player', {src: 'movie.mp4',skin: minimal(),plugins: [mediaSession({ artist: 'Blender Foundation', artwork: [{ src: '/art.png', sizes: '512x512' }] })],});
Options
| Option | Type | Description |
|---|---|---|
| artist | string | Artist shown in system controls. |
| album | string | Album shown in system controls. |
| artwork | MediaImage[] | Artwork images. |
| seekStep | number | Seconds for seek forward and backward actions. |