@vplayer/core 0.2.2 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,20 @@
1
+ /**
2
+ * media-session — Media Session API integration.
3
+ *
4
+ * Browsers project this to OS media controls (MPRIS on Linux desktops),
5
+ * which drive system notifications, lock-screen controls, and media keys.
6
+ * Metadata alone is not enough: without `playbackState` and action
7
+ * handlers the OS entry goes stale and its buttons are dead.
8
+ */
9
+ import type { MediaRemote } from './types';
10
+ type SessionPlaybackState = 'playing' | 'paused';
11
+ export interface MediaSessionController {
12
+ setup(remote: MediaRemote): void;
13
+ syncMetadata(title: string | undefined, poster: string | undefined): void;
14
+ setPlaybackState(state: SessionPlaybackState): void;
15
+ syncPosition(duration: number, currentTime: number, playbackRate: number, force?: boolean): void;
16
+ readonly hasMetadata: boolean;
17
+ teardown(): void;
18
+ }
19
+ export declare function createMediaSessionController(): MediaSessionController;
20
+ export {};
@@ -11,10 +11,15 @@ export interface PlaybackProgressStore {
11
11
  export interface PlaybackProgressOptions {
12
12
  id?: string;
13
13
  store?: PlaybackProgressStore;
14
+ /** Normalize the media URL used as the progress key. Defaults to true. */
15
+ normalizeUrl?: boolean;
16
+ /** Milliseconds before the resume prompt dismisses itself. Use 0 to keep it visible. Defaults to 5000. */
17
+ resumePromptTimeout?: number;
14
18
  }
15
19
  export declare class LocalPlaybackProgressStore implements PlaybackProgressStore {
16
20
  private readonly storage;
17
- constructor(storage?: Storage);
21
+ private readonly maxEntries;
22
+ constructor(storage?: Storage, maxEntries?: number);
18
23
  load(mediaId: string): Promise<PlaybackProgress | null>;
19
24
  save(mediaId: string, progress: PlaybackProgress): Promise<void>;
20
25
  clear(mediaId: string): Promise<void>;
@@ -10,6 +10,7 @@ export interface RemoteRef {
10
10
  seek: (time: number) => void;
11
11
  resumeFromSavedProgress: () => void;
12
12
  startPlaybackOver: () => void;
13
+ dismissSavedProgress: () => void;
13
14
  skip: (seconds: number) => void;
14
15
  setVolume: (v: number) => void;
15
16
  toggleMute: () => void;
package/dist/types.d.ts CHANGED
@@ -19,6 +19,12 @@ export interface PlayerOptions {
19
19
  /** Title exposed to browser and operating-system media controls. */
20
20
  title?: string;
21
21
  poster?: string;
22
+ /**
23
+ * Artwork URL for OS media controls (Media Session → MPRIS).
24
+ * Falls back to `poster` when omitted — useful for serving a scaled-down
25
+ * image when full-size posters are too big.
26
+ */
27
+ mediaSessionArtwork?: string;
22
28
  subtitles?: SubtitleTrack[];
23
29
  subtitleProviders?: SubtitleProvider[];
24
30
  qualities?: string[];
@@ -80,6 +86,7 @@ export interface MediaRemote {
80
86
  togglePlay: () => void;
81
87
  resumeFromSavedProgress: () => void;
82
88
  startPlaybackOver: () => void;
89
+ dismissSavedProgress: () => void;
83
90
  seek: (time: number) => void;
84
91
  skip: (seconds: number) => void;
85
92
  setVolume: (v: number) => void;
@@ -95,6 +102,7 @@ export interface MediaRemote {
95
102
  clearSubtitleSearch: () => void;
96
103
  setCaptionSettings: (patch: Partial<CaptionSettings>) => void;
97
104
  resetCaptionSettings: () => void;
105
+ saveCaptionSettings: () => void;
98
106
  setActiveQuality: (q: string) => void;
99
107
  takeScreenshot: () => void;
100
108
  setFlip: (flip: FlipState) => void;
@@ -151,6 +159,8 @@ export interface PlayerLabels {
151
159
  captionDelay: string;
152
160
  captionPreview: string;
153
161
  captionReset: string;
162
+ captionSave: string;
163
+ captionSaved: string;
154
164
  subtitleLoadError: string;
155
165
  endedTitle: string;
156
166
  screenshot: string;
@@ -168,6 +178,7 @@ export interface PlayerLabels {
168
178
  continue: string;
169
179
  continuePlay: string;
170
180
  continueStartOver: string;
181
+ dismiss: string;
171
182
  error: string;
172
183
  retry: string;
173
184
  contextMenuPlay: string;
@@ -191,7 +202,7 @@ export interface PlayerInstance {
191
202
  hotkeys: HotkeyRegistry;
192
203
  /** The active media engine. Null before mount and after unmount. */
193
204
  engine: MediaEngine | null;
194
- updateOptions(opts: Partial<Pick<PlayerOptions, 'src' | 'type' | 'title' | 'poster' | 'autoPlay' | 'subtitles' | 'subtitleProviders' | 'qualities' | 'thumbnails' | 'transformThumbnailVTT' | 'playbackProgress'>>): void;
205
+ updateOptions(opts: Partial<Pick<PlayerOptions, 'src' | 'type' | 'title' | 'poster' | 'mediaSessionArtwork' | 'autoPlay' | 'subtitles' | 'subtitleProviders' | 'qualities' | 'thumbnails' | 'transformThumbnailVTT' | 'playbackProgress'>>): void;
195
206
  setThumbnails(url?: string): void;
196
207
  initPlugins(plugins: PlayerPlugin[]): () => void;
197
208
  mount(videoEl: HTMLVideoElement, containerEl: HTMLDivElement): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vplayer/core",
3
- "version": "0.2.2",
3
+ "version": "0.3.0",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",