@kodezen/player 1.0.2 → 1.0.4

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.
@@ -23,8 +23,25 @@ interface ControlsConfig {
23
23
  volume: boolean;
24
24
  time: boolean;
25
25
  speed: boolean;
26
+ /** Captions (CC) button — only rendered when `tracks` are given. */
27
+ captions: boolean;
26
28
  fullscreen: boolean;
27
29
  }
30
+ /**
31
+ * A WebVTT subtitle/caption file. The player fetches and renders it itself
32
+ * (not via a native `<track>`), so the same file works for every provider —
33
+ * YouTube/Vimeo iframes can't load an external caption file.
34
+ */
35
+ interface CaptionTrack {
36
+ /** URL of the `.vtt` file. Must be same-origin or served with CORS. */
37
+ src: string;
38
+ /** Name shown in the captions menu when there's more than one track. */
39
+ label?: string;
40
+ /** BCP 47 language tag, e.g. `en`. */
41
+ srclang?: string;
42
+ /** Show this track as soon as it loads (otherwise captions start off). */
43
+ default?: boolean;
44
+ }
28
45
  interface PlayerOptions {
29
46
  source: Source;
30
47
  /** Seconds to resume from on ready. Ignored if within 2s of the end. */
@@ -40,6 +57,8 @@ interface PlayerOptions {
40
57
  speeds?: number[];
41
58
  /** Toggle individual controls off. Everything defaults to on. */
42
59
  controls?: Partial<ControlsConfig>;
60
+ /** WebVTT subtitle/caption files, shown over the video for any provider. */
61
+ tracks?: CaptionTrack[];
43
62
  /** Extra class added to the player root for host styling. */
44
63
  className?: string;
45
64
  }
@@ -125,4 +144,4 @@ interface KodezenPlayerInstance {
125
144
  destroy(): void;
126
145
  }
127
146
 
128
- export type { ControlsConfig as C, KodezenPlayerInstance as K, PlayerOptions as P, ReadyPayload as R, Source as S, TimeUpdatePayload as T, PlayerState as a, PlayerEvents as b, Provider as c, ProviderCapabilities as d, ProviderEvents as e, SourceType as f };
147
+ export type { CaptionTrack as C, KodezenPlayerInstance as K, PlayerOptions as P, ReadyPayload as R, Source as S, TimeUpdatePayload as T, PlayerState as a, PlayerEvents as b, ControlsConfig as c, Provider as d, ProviderCapabilities as e, ProviderEvents as f, SourceType as g };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kodezen/player",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "Framework-agnostic, tracking-free HTML5 / YouTube / Vimeo media player core with a custom control bar. Emits progress events and accepts a resume position; the host owns all tracking and completion logic.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",