itube-modern-player 0.4.1 → 0.4.2

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.
package/dist/player.d.ts CHANGED
@@ -53,6 +53,10 @@ export declare class Player {
53
53
  private upNext;
54
54
  /** Runtime autoplay-next toggle (gear switch); seeds from playlist.autoAdvance. */
55
55
  private autoAdvanceEnabled;
56
+ /** localStorage key for persisted prefs, or null when persistence is off. */
57
+ private persistKey;
58
+ private persistVolume;
59
+ private persistAutoAdvance;
56
60
  private playlistPanel;
57
61
  private scenesPanel;
58
62
  private spinner;
@@ -86,6 +90,10 @@ export declare class Player {
86
90
  setVolume(volume: number): void;
87
91
  setMuted(muted: boolean): void;
88
92
  toggleMute(): void;
93
+ /** Read persisted prefs (safe against private mode / SSR / bad JSON). */
94
+ private readPersisted;
95
+ /** Write the enabled prefs to localStorage. No-op when persistence is off. */
96
+ private persistState;
89
97
  get playbackRate(): number;
90
98
  setPlaybackRate(rate: number): void;
91
99
  get qualityLevels(): Level[];
package/dist/types.d.ts CHANGED
@@ -396,6 +396,19 @@ export interface PlayerLabels {
396
396
  }
397
397
  /** SVG icon overrides — raw `<svg>` markup keyed by icon name. */
398
398
  export type IconName = 'play' | 'pause' | 'replay' | 'bigPlay' | 'volumeHigh' | 'volumeLow' | 'volumeMute' | 'fullscreen' | 'fullscreenExit' | 'pip' | 'settings' | 'speed' | 'subtitles' | 'list' | 'scenes' | 'next' | 'previous' | 'seekForward' | 'seekBack' | 'shuffle' | 'repeat' | 'like' | 'dislike' | 'addTo' | 'share' | 'report' | 'more' | 'close' | 'user' | 'channel';
399
+ /**
400
+ * Remember selected user preferences in `localStorage` and restore them on the
401
+ * next load. Restored values take precedence over the matching options
402
+ * (`volume` / `muted` / `playlist.autoAdvance`).
403
+ */
404
+ export interface PersistOptions {
405
+ /** `localStorage` key. Default `"itube-player"`. */
406
+ key?: string;
407
+ /** Remember volume + mute. Default `true`. */
408
+ volume?: boolean;
409
+ /** Remember the autoplay-next toggle. Default `true`. */
410
+ autoAdvance?: boolean;
411
+ }
399
412
  export interface PlayerOptions {
400
413
  /** Single source or an array (an array enables playlist mode). */
401
414
  source?: VideoSource | VideoSource[];
@@ -444,6 +457,12 @@ export interface PlayerOptions {
444
457
  crossOrigin?: '' | 'anonymous' | 'use-credentials';
445
458
  /** Inline playback on iOS. Default true. */
446
459
  playsInline?: boolean;
460
+ /**
461
+ * Persist user preferences (volume/mute, autoplay-next) to `localStorage`
462
+ * and restore them on the next load. `true` enables all with defaults; pass
463
+ * an object for granular control / a custom key. Off by default.
464
+ */
465
+ persist?: boolean | PersistOptions;
447
466
  }
448
467
  /** A single popularity sample: how often users sought/replayed near `time`. */
449
468
  export interface HeatmapPoint {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "itube-modern-player",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "description": "Lightweight, framework-agnostic HTML5 video player: HLS streams, playlists, chapters, VTT subtitles, sprite previews, VAST ads. Ships with a Vue 3 wrapper.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",