boss-web-player-sdk 1.1.39 → 1.1.41

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/index.d.ts CHANGED
@@ -40,111 +40,32 @@ export declare interface AnalyticsEvent {
40
40
  isAutoSwitch?: boolean;
41
41
  }
42
42
 
43
- declare class AnalyticsModule {
44
- private callback?;
45
- private heartbeatInterval?;
46
- private watchProgressTimer?;
47
- private isBuffering;
48
- private sessionId;
49
- private videoId;
50
- private deviceType;
51
- private networkType;
52
- private adBreaks;
53
- private isFirstPlay;
54
- private watchStartTime;
55
- private totalWatchTime;
56
- private streamingWindowStart;
57
- private streamingTime;
58
- private isInAdBreak;
59
- private adWatchWindowStart;
60
- private adWatchTime;
61
- private bufferingCount;
62
- private totalBufferingTime;
63
- private bufferingStartTime;
64
- private milestonesHit;
65
- private lastHeartbeatPosition;
66
- private lastHeartbeatAt;
67
- constructor(callback?: AnalyticsCallback, src?: string, seed?: AnalyticsSessionSnapshot, videoId?: string);
68
- getSessionSnapshot(): AnalyticsSessionSnapshot;
69
- registerCallback(callback: AnalyticsCallback): void;
70
- setAdBreaks(adBreaks: Array<{
71
- startTime: number;
72
- endTime: number;
73
- }>): void;
74
- private getTotalAdDuration;
75
- private getElapsedAdTime;
76
- track(eventType: AnalyticsEvent['eventType'], videoEl: HTMLVideoElement, extra?: Partial<AnalyticsEvent>): void;
77
- startHeartbeat(videoEl: HTMLVideoElement, getExtra: () => Partial<AnalyticsEvent>, watchProgressInterval?: number): void;
78
- stopHeartbeat(): void;
79
- setBuffering(isBuffering: boolean, videoEl: HTMLVideoElement, getExtra: () => Partial<AnalyticsEvent>): void;
80
- setAdBreak(inAdBreak: boolean, videoEl: HTMLVideoElement): void;
81
- private checkMilestones;
82
- private checkStall;
83
- private getTotalWatchTime;
84
- private getStreamingTime;
85
- private getAdWatchTime;
86
- private dispatchRaw;
87
- private generateSessionId;
88
- private extractVideoId;
89
- private getDeviceType;
90
- private getNetworkType;
91
- }
92
-
93
43
  declare interface AnalyticsSessionSnapshot {
94
44
  sessionId: string;
95
- /** True once session_start has fired — a seeded module must not fire it again. */
96
45
  sessionStartFired: boolean;
97
46
  totalWatchTime: number;
98
47
  streamingTime: number;
99
48
  adWatchTime: number;
100
49
  bufferingCount: number;
101
50
  totalBufferingTime: number;
102
- /** Quartile milestones already dispatched ('first_quartile' | 'midpoint' | 'third_quartile'). */
103
51
  milestonesHit: string[];
104
52
  }
105
53
 
106
54
  export declare function BossVideoPlayer({ playerKey, src, subtitles, licenseKey, themeColor, firebaseConfig, proxyDomains, apiBaseUrl, adTrackingUrl, overlayAdUrl, videoId: videoIdProp, title, watermark, autoplay, muted, autoFullscreen, enableControls, enableSkipAd, skipAdAfterSeconds, chaptersDisplayMode, volumeControlType, subtitleStyle, drmConfig, onAnalyticsEvent, delegate, onKeyMomentsLoaded, initialTime, onTimeUpdate, introStartTime, introEndTime, hasNextEpisode, outroStartTime, nextEpisodeLabel, onNextEpisode, nextEpisodeAutoAdvanceSeconds, nextEpisodeThumbnailUrl, }: BossVideoPlayerProps): JSX.Element;
107
55
 
108
56
  export declare interface BossVideoPlayerProps {
109
- /** Player key from the GoBOSS dashboard — identifies your tenant. */
110
57
  playerKey: string;
111
- /**
112
- * Stream source(s) to play.
113
- * - Pass a single URL string for standard single-stream playback.
114
- * - Pass an array of `{ label, url }` objects to let the user switch between
115
- * multiple streams at runtime (e.g. 4K, Dolby, Stereo). The first item plays by default.
116
- */
117
58
  src: string | SourceItem[];
118
- /**
119
- * External subtitle tracks (WebVTT/SRT) to load alongside any tracks
120
- * auto-detected from the M3U8 manifest. Merged into a single subtitle menu.
121
- */
122
59
  subtitles?: SubtitleTrack[];
123
- /** License key for playback authorization. */
124
60
  licenseKey?: string;
125
- /** Accent color for the player UI (hex). Defaults to '#6366f1'. */
126
61
  themeColor?: string;
127
- /** Firebase config for analytics. */
128
62
  firebaseConfig?: FirebaseConfig;
129
- /**
130
- * CDN proxy domain mappings as a comma-separated string.
131
- * Format: "cdn.example.com=/my-proxy,other.cdn.com=/other-proxy"
132
- * Any request URL matching a domain is rewritten to the proxy path.
133
- */
134
63
  proxyDomains?: string;
135
- /**
136
- * Base URL for the GoBOSS API. Defaults to 'https://dev-api.go-boss.com'.
137
- * Override this if you need to route through a reverse proxy.
138
- */
139
64
  apiBaseUrl?: string;
140
- /** AWS MediaTailor ad tracking URL for skip-ad flow. */
141
65
  adTrackingUrl?: string;
142
- /** AWS MediaTailor overlay ad tracking URL. */
143
66
  overlayAdUrl?: string;
144
67
  videoId?: string;
145
- /** Video title shown in the player UI. */
146
68
  title?: string;
147
- /** Watermark text stamped on the video. */
148
69
  watermark?: string;
149
70
  autoplay?: boolean;
150
71
  muted?: boolean;
@@ -156,124 +77,21 @@ export declare interface BossVideoPlayerProps {
156
77
  volumeControlType?: 'slider' | 'button';
157
78
  subtitleStyle?: SubtitleStyle;
158
79
  drmConfig?: DRMConfig;
159
- /** Called for every analytics event — lets consumers add custom tracking. */
160
80
  onAnalyticsEvent?: (event: AnalyticsEvent) => void;
161
- /**
162
- * Typed per-event callbacks (playerDidStartPlaying, playerDidPause, …) that
163
- * receive only the arguments relevant to each event. Prefer this over
164
- * `onAnalyticsEvent` for analytics, logging, and business logic; implement
165
- * only the methods you need.
166
- */
167
81
  delegate?: PlayerDelegate;
168
- /** Called when chapter/key-moment data is parsed from the stream. */
169
82
  onKeyMomentsLoaded?: (keyMoments: Chapter[]) => void;
170
- /** Seek to this position (in seconds) when the video is ready. Use for resume-playback. */
171
83
  initialTime?: number;
172
- /** Called on every timeupdate with the current playback position in seconds. Use to persist watch progress. */
173
84
  onTimeUpdate?: (currentTime: number) => void;
174
- /** Content-relative start of a skippable intro, in seconds (e.g. episode recap/theme song). */
175
85
  introStartTime?: number;
176
- /** Content-relative end of the intro, in seconds. Skip Intro seeks here. */
177
86
  introEndTime?: number;
178
- /** Whether another episode is available to auto-advance into when the outro is reached. */
179
87
  hasNextEpisode?: boolean;
180
- /** Content-relative time the outro/credits begin, in seconds. Reveals the Next Episode chip. */
181
88
  outroStartTime?: number;
182
- /** Label shown on the Next Episode chip. Defaults to "Next Episode". */
183
89
  nextEpisodeLabel?: string;
184
- /** Called when the viewer clicks the Next Episode chip, or its countdown fill completes. */
185
90
  onNextEpisode?: () => void;
186
- /** Seconds before the Next Episode chip auto-advances once shown. Default 5. */
187
91
  nextEpisodeAutoAdvanceSeconds?: number;
188
- /** Thumbnail image for the upcoming episode, shown above the Next Episode chip. */
189
92
  nextEpisodeThumbnailUrl?: string;
190
93
  }
191
94
 
192
- declare class CastingModule {
193
- private isCasting;
194
- private castDeviceName;
195
- private onCastStateChangeCallback?;
196
- private onRemoteStateChangeCallback?;
197
- private castContext;
198
- private remotePlayer;
199
- private remotePlayerController;
200
- /** Listeners this module attached, so destroy() can detach exactly those. */
201
- private attachedListeners;
202
- private destroyed;
203
- /** The global API-ready hook installed by this module, if any. */
204
- private apiReadyHook?;
205
- /** Last connection state handed to the consumer, so a replay can't double-fire. */
206
- private announcedCasting?;
207
- /** Stream URL this module last pushed to the receiver; null when nothing of ours is loaded. */
208
- private loadedSrc;
209
- /** Stream URL of an in-flight loadMedia, so concurrent callers don't load twice. */
210
- private pendingSrc;
211
- constructor();
212
- private initCastApi;
213
- private addListener;
214
- /**
215
- * Notifies the consumer of the current connection state, but only when it actually
216
- * changed since the last notification. The state can be seeded before a callback is
217
- * registered (session adopted at construction), so registration replays it — this
218
- * guard keeps that replay from double-firing against a real IS_CONNECTED_CHANGED.
219
- */
220
- private announceCastState;
221
- getCastingState(): {
222
- isCasting: boolean;
223
- deviceName: string;
224
- };
225
- getRemoteState(): RemoteCastState | null;
226
- /**
227
- * Derives the Cast MediaInfo content type from the stream URL so HLS/DASH manifests
228
- * aren't sent to the receiver mislabeled as video/mp4, which causes load failures.
229
- */
230
- private getContentType;
231
- /** Whether a cast session is currently connected (including one joined from a previous page). */
232
- isSessionActive(): boolean;
233
- /** Content URL the receiver currently has loaded, whoever put it there. Null if nothing is loaded. */
234
- getReceiverContentId(): string | null;
235
- /**
236
- * Loads media onto the session that is already connected. Returns true once the receiver
237
- * has accepted the load.
238
- *
239
- * Separate from requestSession() because a session outlives the player that started it:
240
- * after navigating to another title the new player must replace what is on the receiver
241
- * without prompting the device picker again.
242
- */
243
- loadMedia(src: string, currentTime: number, title?: string): Promise<boolean>;
244
- /**
245
- * Ensures the receiver is playing `src` rather than whatever a previous player left on it.
246
- * No-ops when the receiver already holds this stream, so re-entering a page that is
247
- * already casting doesn't restart playback on the TV.
248
- */
249
- syncMedia(src: string, currentTime: number, title?: string): Promise<boolean>;
250
- /**
251
- * Prompts the native Google Cast device picker overlay, then loads media on the remote device.
252
- * The caller is responsible for pausing local playback before/after this resolves.
253
- */
254
- requestSession(currentSrc: string, currentTime: number, title?: string): Promise<void>;
255
- /**
256
- * Disconnects the current cast session.
257
- */
258
- stopCasting(): void;
259
- /**
260
- * Detaches this module from the Cast framework. The CastContext is a page-wide singleton
261
- * and the session deliberately survives, but the RemotePlayer listeners must go: otherwise
262
- * every player that has ever mounted keeps pushing remote state into its own (unmounted)
263
- * consumer, and a torn-down player can still react to the live session.
264
- */
265
- destroy(): void;
266
- remotePlayPause(): void;
267
- remoteSeek(time: number): void;
268
- remoteSetVolume(volume: number): void;
269
- remoteSetMute(muted: boolean): void;
270
- onCastStateChange(callback: (isCasting: boolean, deviceName: string) => void): void;
271
- onRemoteStateChange(callback: (state: RemoteCastState) => void): void;
272
- requestAirPlaySession(videoElement: HTMLVideoElement): void;
273
- stopAirPlay(videoElement: HTMLVideoElement): void;
274
- isAirPlayAvailable(): boolean;
275
- }
276
-
277
95
  export declare interface Chapter {
278
96
  title: string;
279
97
  startTime: number;
@@ -282,31 +100,6 @@ export declare interface Chapter {
282
100
  description?: string;
283
101
  }
284
102
 
285
- declare class ChaptersModule extends KeyMomentsModule {
286
- }
287
-
288
- /**
289
- * Mounts the full video player into any DOM element.
290
- * Identical to <BossVideoPlayer> — handles player key validation, feature gating,
291
- * session tracking, and heartbeat automatically.
292
- *
293
- * Use this in Vue, Angular, Vanilla JS, or any environment where JSX is unavailable.
294
- *
295
- * @example Vanilla JS
296
- * const player = createPlayer(document.getElementById('player'), {
297
- * playerKey: 'bsp_abc123',
298
- * src: 'https://my-cdn.com/video.m3u8',
299
- * });
300
- * player.destroy(); // cleanup
301
- *
302
- * @example Vue 3
303
- * const player = createPlayer(containerRef.value, { playerKey: 'bsp_abc123', src: props.src });
304
- * onUnmounted(() => player.destroy());
305
- *
306
- * @example Angular
307
- * const player = createPlayer(this.containerRef.nativeElement, { playerKey: 'bsp_abc123', src: this.src });
308
- * ngOnDestroy() { this.player.destroy(); }
309
- */
310
103
  export declare function createPlayer(container: HTMLElement, props: PlayerProps): PlayerInstance;
311
104
 
312
105
  export declare interface DRMConfig {
@@ -319,46 +112,11 @@ export declare interface DRMConfig {
319
112
  watermarkText?: string;
320
113
  }
321
114
 
322
- declare class DRMModule {
323
- private config?;
324
- private watermarkElement?;
325
- private floatInterval?;
326
- constructor(config?: DRMConfig);
327
- /**
328
- * Validates if the active origin domain is permitted to load this stream asset.
329
- */
330
- validateDomain(currentDomain: string): boolean;
331
- getAuthToken(): string | undefined;
332
- getAuthHeader(): string | undefined;
333
- getRequestHeaders(): Record<string, string>;
334
- /**
335
- * Injects an animated floating watermark on top of the media container to obstruct piracy or recording.
336
- */
337
- setupWatermark(container: HTMLElement): void;
338
- /**
339
- * Cleans up active watermarks.
340
- */
341
- removeWatermark(): void;
342
- isDRMProtected(): boolean;
343
- getDRMDetails(): {
344
- widevine: string | null;
345
- playready: string | null;
346
- fairplay: string | null;
347
- authTokenPresent: boolean;
348
- allowedDomains: string[];
349
- };
350
- }
351
-
352
- /**
353
- * Ends the session and finalizes billed minutes. `currentTime` and `duration`
354
- * are required by the API — pass the final playback position and content length.
355
- */
356
115
  export declare function endSession(playerKey: string, sessionId: string, currentTime?: number, duration?: number, apiBase?: string): Promise<void>;
357
116
 
358
117
  export declare function ErrorScreen({ offline, title, subtitle, onRetry, icon, }: ErrorScreenProps): JSX.Element;
359
118
 
360
119
  declare interface ErrorScreenProps {
361
- /** Renders the network-error variant: CloudOff icon + "No Internet Connection" copy. */
362
120
  offline?: boolean;
363
121
  title?: string;
364
122
  subtitle?: string;
@@ -382,16 +140,6 @@ export declare type FeatureFlags = {
382
140
  ad_support: boolean;
383
141
  };
384
142
 
385
- /**
386
- * Sends all player analytics events to Firebase Analytics (GA4).
387
- *
388
- * Events appear in:
389
- * Firebase Console → Analytics → Events (24-48 hr aggregated view)
390
- * Firebase Console → Analytics → DebugView (real-time while testing)
391
- * Google Analytics 4 → Reports → Realtime (within a few minutes)
392
- *
393
- * No Firestore / database setup required — Firebase Analytics handles all storage.
394
- */
395
143
  export declare class FirebaseAnalyticsProvider {
396
144
  private analytics;
397
145
  private logEventFn;
@@ -416,34 +164,72 @@ export declare interface FirebaseConfig {
416
164
  measurementId?: string;
417
165
  }
418
166
 
419
- export declare function initSdk(playerKey: string, apiBase?: string, options?: SdkInitOptions): Promise<SdkInitResponse>;
167
+ declare interface IAnalyticsModule {
168
+ getSessionSnapshot(): AnalyticsSessionSnapshot;
169
+ registerCallback(callback: AnalyticsCallback): void;
170
+ setAdBreaks(adBreaks: Array<{
171
+ startTime: number;
172
+ endTime: number;
173
+ }>): void;
174
+ track(eventType: AnalyticsEvent['eventType'], videoEl: HTMLVideoElement, extra?: Partial<AnalyticsEvent>): void;
175
+ startHeartbeat(videoEl: HTMLVideoElement, getExtra: () => Partial<AnalyticsEvent>, watchProgressInterval?: number): void;
176
+ stopHeartbeat(): void;
177
+ setBuffering(isBuffering: boolean, videoEl: HTMLVideoElement, getExtra: () => Partial<AnalyticsEvent>): void;
178
+ setAdBreak(inAdBreak: boolean, videoEl: HTMLVideoElement): void;
179
+ }
420
180
 
421
- export declare type KeyMoment = Chapter;
181
+ declare interface ICastingModule {
182
+ getCastingState(): {
183
+ isCasting: boolean;
184
+ deviceName: string;
185
+ };
186
+ getRemoteState(): RemoteCastState | null;
187
+ isSessionActive(): boolean;
188
+ getReceiverContentId(): string | null;
189
+ loadMedia(src: string, currentTime: number, title?: string): Promise<boolean>;
190
+ syncMedia(src: string, currentTime: number, title?: string): Promise<boolean>;
191
+ requestSession(currentSrc: string, currentTime: number, title?: string): Promise<void>;
192
+ stopCasting(): void;
193
+ destroy(): void;
194
+ remotePlayPause(): void;
195
+ remoteSeek(time: number): void;
196
+ remoteSetVolume(volume: number): void;
197
+ remoteSetMute(muted: boolean): void;
198
+ onCastStateChange(callback: (isCasting: boolean, deviceName: string) => void): void;
199
+ onRemoteStateChange(callback: (state: RemoteCastState) => void): void;
200
+ requestAirPlaySession(videoElement: HTMLVideoElement): void;
201
+ stopAirPlay(videoElement: HTMLVideoElement): void;
202
+ isAirPlayAvailable(): boolean;
203
+ }
204
+
205
+ declare interface IChaptersModule extends IKeyMomentsModule {
206
+ }
422
207
 
423
- declare class KeyMomentsModule {
424
- private keyMoments;
425
- private currentMomentIndex;
426
- private onMomentChangeCallback?;
427
- constructor(keyMoments?: KeyMoment[]);
428
- /**
429
- * Sorts and stores the key moments.
430
- */
208
+ declare interface IDRMModule {
209
+ validateDomain(currentDomain: string): boolean;
210
+ getAuthToken(): string | undefined;
211
+ getAuthHeader(): string | undefined;
212
+ getRequestHeaders(): Record<string, string>;
213
+ setupWatermark(container: HTMLElement): void;
214
+ removeWatermark(): void;
215
+ isDRMProtected(): boolean;
216
+ getDRMDetails(): {
217
+ widevine: string | null;
218
+ playready: string | null;
219
+ fairplay: string | null;
220
+ authTokenPresent: boolean;
221
+ allowedDomains: string[];
222
+ };
223
+ }
224
+
225
+ declare interface IKeyMomentsModule {
431
226
  setKeyMoments(keyMoments: KeyMoment[]): void;
432
227
  getKeyMoments(): KeyMoment[];
433
- /**
434
- * Locates the key moment corresponding to the active playback timestamp.
435
- */
436
228
  getCurrentMoment(currentTime: number): {
437
229
  keyMoment: KeyMoment | null;
438
230
  index: number;
439
231
  };
440
- /**
441
- * Evaluates if playback has crossed a key moment boundary.
442
- */
443
232
  updateTime(currentTime: number): void;
444
- /**
445
- * Subscribes a callback to change events.
446
- */
447
233
  onMomentChange(callback: (keyMoment: KeyMoment | null, index: number) => void): void;
448
234
  setChapters(chapters: KeyMoment[]): void;
449
235
  getChapters(): KeyMoment[];
@@ -454,69 +240,58 @@ declare class KeyMomentsModule {
454
240
  onChapterChange(callback: (chapter: KeyMoment | null, index: number) => void): void;
455
241
  }
456
242
 
457
- /**
458
- * Typed per-event callbacks for tenant applications.
459
- *
460
- * Unlike `AnalyticsCallback` (which receives the full analytics event for every
461
- * event type), each delegate method receives only the arguments relevant to that
462
- * event — clean signatures for logging, custom UI, and business logic.
463
- *
464
- * All methods are optional; implement only the ones you need.
465
- *
466
- * Conventions:
467
- * - Arguments named `*Time` / `*At` are playback positions in seconds.
468
- * - `watchDuration` and `seekDuration` are wall-clock seconds.
469
- * - `from*` arguments are `undefined` when there was no previous value
470
- * (e.g. the first quality selection after load).
471
- */
243
+ export declare function initSdk(playerKey: string, apiBase?: string, options?: SdkInitOptions): Promise<SdkInitResponse>;
244
+
245
+ declare interface ISubtitlesModule {
246
+ getTracks(): SubtitleTrack[];
247
+ getActiveTrackId(): string;
248
+ setHlsTracks(hlsTracks: SubtitleTrack[]): void;
249
+ addTrack(track: SubtitleTrack): void;
250
+ onTrackSwitch(callback: (track: SubtitleTrack | null) => void): void;
251
+ setCustomSubtitleText(text: string): void;
252
+ setActiveTrack(trackId: string): Promise<void>;
253
+ updateTime(currentTime: number): void;
254
+ onSubtitleChange(callback: (text: string) => void): void;
255
+ }
256
+
257
+ declare interface IThumbnailsModule {
258
+ getThumbnail(time: number): {
259
+ url: string;
260
+ x: number;
261
+ y: number;
262
+ width: number;
263
+ height: number;
264
+ } | null;
265
+ hasThumbnails(): boolean;
266
+ }
267
+
268
+ export declare type KeyMoment = Chapter;
269
+
472
270
  export declare interface PlayerDelegate {
473
- /** Playback started for the first time (or restarted after finishing). */
474
271
  playerDidStartPlaying?(startTime: number, autoplay: boolean): void;
475
- /** Playback resumed after a pause. */
476
272
  playerDidResumePlaying?(resumedAt: number): void;
477
- /** Playback paused by the user (not fired for the implicit pause at end of stream). */
478
273
  playerDidPause?(pausedAt: number): void;
479
- /** Playback reached the end of the stream. */
480
274
  playerDidFinishPlaying?(finishedAt: number, watchDuration: number): void;
481
- /** The player was torn down (unmount / tab close) before playback finished. Fired at most once. */
482
275
  playerDidDismiss?(dismissedAt: number, watchDuration: number): void;
483
- /** A seek started (scrubber, ±10s skip). Fired once per seek gesture. */
484
276
  playerDidStartSeeking?(fromTime: number): void;
485
- /** The seek landed. `fromTime` is where the gesture began, `seekDuration` is wall-clock seconds it took. */
486
277
  playerDidFinishSeeking?(fromTime: number, toTime: number, seekDuration: number): void;
487
- /** Playback position update — fires on every native `timeupdate` (roughly 4×/second). */
488
278
  playerDidUpdateCurrentTime?(currentTime: number, duration: number): void;
489
279
  playerDidStartBuffering?(startedAt: number): void;
490
280
  playerDidFinishBuffering?(endedAt: number): void;
491
- /** Rendition changed. `isAutoSwitch` is true when ABR picked the level, false for a manual selection. */
492
281
  playerDidChangeQuality?(fromQuality: string | undefined, toQuality: string, isAutoSwitch: boolean): void;
493
- /** Subtitle track changed (languages, e.g. 'en' → 'fr'). */
494
282
  playerDidChangeSubtitle?(fromSubtitle: string | undefined, toSubtitle: string): void;
495
- /** Subtitles were turned off. `disabledSubtitle` is the language that was active. */
496
283
  playerDidDisableSubtitle?(disabledSubtitle: string | undefined): void;
497
- /** Audio track changed (track labels). */
498
284
  playerDidChangeAudioTrack?(fromAudioTrack: string | undefined, toAudioTrack: string): void;
499
285
  playerDidChangePlaybackSpeed?(fromSpeed: number, toSpeed: number): void;
500
- /** `orientation` is the current `screen.orientation.type` (e.g. 'landscape-primary') when available. */
501
286
  playerDidEnterFullscreen?(orientation?: string): void;
502
287
  playerDidExitFullscreen?(orientation?: string): void;
503
- /** A key moment was selected. `fromTime`/`toTime` are the chapter's start/end. */
504
288
  playerDidSelectKeyMoment?(chapterId: string | undefined, chapterTitle: string, fromTime: number, toTime: number): void;
505
289
  playerDidEnterPictureInPicture?(enteredAt?: number): void;
506
290
  playerDidExitPictureInPicture?(exitedAt?: number): void;
507
- /** A media/playback error. `isRecoverable` is true when the player will attempt recovery itself. */
508
291
  playerDidEncounterPlaybackError?(errorCode: string, message: string, isRecoverable: boolean): void;
509
- /** A network/CDN error. `statusCode` is the HTTP status when known, 0 otherwise. */
510
292
  playerDidEncounterNetworkError?(statusCode: number, message: string, isRecoverable: boolean): void;
511
293
  }
512
294
 
513
- /**
514
- * In-session telemetry payload for POST /api/player/sdk/events.
515
- * `eventType`, `sessionId` and `currentTime` are always required; `videoId`,
516
- * `videoTitle` and any event-specific extras (e.g. `from`/`to`, `speed`,
517
- * `bufferingCount`) are sent at the top level — never wrapped in a client
518
- * `properties` object (the server nests them).
519
- */
520
295
  export declare interface PlayerEventPayload {
521
296
  eventType: string;
522
297
  sessionId: string;
@@ -527,9 +302,7 @@ export declare interface PlayerEventPayload {
527
302
  }
528
303
 
529
304
  export declare interface PlayerInstance {
530
- /** Re-render the player with updated props (src change, theme, etc.) */
531
305
  update(props: Partial<PlayerProps>): void;
532
- /** Unmounts the player and releases all resources */
533
306
  destroy(): void;
534
307
  }
535
308
 
@@ -553,11 +326,6 @@ export declare interface PlayerSDKOptions {
553
326
  watchProgressInterval?: number;
554
327
  themeColor?: string;
555
328
  watermark?: string;
556
- /**
557
- * Optional URL transformer applied to every HLS segment/manifest request.
558
- * Use this to route requests through a CORS proxy without hardcoding domains.
559
- * Example: (url) => url.replace('https://cdn.example.com', '/my-proxy')
560
- */
561
329
  urlTransformer?: (url: string) => string;
562
330
  }
563
331
 
@@ -573,7 +341,6 @@ export declare type SdkInitData = {
573
341
  tenantId: string;
574
342
  features: SdkInitFeatures;
575
343
  planTier: string;
576
- /** How often to call /session/heartbeat. Falls back to 30s when absent. */
577
344
  heartbeatIntervalSeconds?: number;
578
345
  };
579
346
 
@@ -584,7 +351,6 @@ export declare type SdkInitFeatures = {
584
351
  [key: string]: boolean;
585
352
  };
586
353
 
587
- /** Optional context accepted by POST /init. `referrer` is intentionally not sent. */
588
354
  export declare interface SdkInitOptions {
589
355
  videoUrl?: string;
590
356
  }
@@ -605,10 +371,6 @@ export declare type SdkPackage = {
605
371
  };
606
372
  };
607
373
 
608
- /**
609
- * Records a single in-session analytics event. One event per request.
610
- * The endpoint returns 204 No Content on success, so there is no body to parse.
611
- */
612
374
  export declare function sendEvent(playerKey: string, payload: PlayerEventPayload, apiBase?: string): Promise<void>;
613
375
 
614
376
  export declare function sendHeartbeat(playerKey: string, sessionId: string, currentTime: number, duration: number, apiBase?: string): Promise<void>;
@@ -620,58 +382,14 @@ export declare interface SourceItem {
620
382
 
621
383
  export declare function startSession(playerKey: string, options: StartSessionOptions, apiBase?: string): Promise<void>;
622
384
 
623
- /**
624
- * Body for POST /session/start. Only `sessionId` is required for HTTP acceptance,
625
- * but `videoId`, `videoTitle` and `contentDurationSec` drive the video-level CMS
626
- * analytics (Top Videos, retention, completion) — send them whenever they're known.
627
- * `platform` and `referrer` are intentionally not sent by this SDK.
628
- */
629
385
  export declare interface StartSessionOptions {
630
- /** Client-generated UUID identifying this play. */
631
386
  sessionId: string;
632
- /** Stable content ID — the grouping key for video-level analytics. */
633
387
  videoId?: string;
634
- /** Display title for CMS dashboards. */
635
388
  videoTitle?: string;
636
- /** Playback URL. */
637
389
  videoUrl?: string;
638
- /** Full content length in seconds, when known. */
639
390
  contentDurationSec?: number;
640
391
  }
641
392
 
642
- declare class SubtitlesModule {
643
- private tracks;
644
- private activeTrackId;
645
- private currentCues;
646
- private activeText;
647
- private onSubtitleChangeCallback?;
648
- private onTrackSwitchCallback?;
649
- constructor(tracks?: SubtitleTrack[]);
650
- getTracks(): SubtitleTrack[];
651
- getActiveTrackId(): string;
652
- setHlsTracks(hlsTracks: SubtitleTrack[]): void;
653
- addTrack(track: SubtitleTrack): void;
654
- onTrackSwitch(callback: (track: SubtitleTrack | null) => void): void;
655
- setCustomSubtitleText(text: string): void;
656
- /**
657
- * Switches the active track. Fetches external tracks if they need loading.
658
- */
659
- setActiveTrack(trackId: string): Promise<void>;
660
- /**
661
- * Scans the subtitle cues for the current playback position.
662
- */
663
- updateTime(currentTime: number): void;
664
- /**
665
- * Triggers the text update callback if a change in caption is detected.
666
- */
667
- private updateActiveText;
668
- onSubtitleChange(callback: (text: string) => void): void;
669
- /**
670
- * Robust parser supporting WebVTT and SRT formats.
671
- */
672
- private parseVttOrSrt;
673
- }
674
-
675
393
  export declare interface SubtitleStyle {
676
394
  size?: 'small' | 'medium' | 'large';
677
395
  background?: 'none' | 'dim' | 'solid';
@@ -711,22 +429,6 @@ export declare interface ThumbnailConfig {
711
429
  totalCount: number;
712
430
  }
713
431
 
714
- declare class ThumbnailsModule {
715
- private config?;
716
- constructor(config?: ThumbnailConfig);
717
- /**
718
- * Calculates the position offset inside the sprite sheet for a given seek hover time.
719
- */
720
- getThumbnail(time: number): {
721
- url: string;
722
- x: number;
723
- y: number;
724
- width: number;
725
- height: number;
726
- } | null;
727
- hasThumbnails(): boolean;
728
- }
729
-
730
432
  export declare class VideoPlayerSDK {
731
433
  private options;
732
434
  private videoElement;
@@ -734,13 +436,13 @@ export declare class VideoPlayerSDK {
734
436
  private dashInstance;
735
437
  private activeQuality;
736
438
  private qualityLevels;
737
- analytics: AnalyticsModule;
738
- keyMoments: KeyMomentsModule;
739
- chapters: ChaptersModule;
740
- subtitles: SubtitlesModule;
741
- drm: DRMModule;
742
- casting: CastingModule;
743
- thumbnails: ThumbnailsModule;
439
+ analytics: IAnalyticsModule;
440
+ keyMoments: IKeyMomentsModule;
441
+ chapters: IChaptersModule;
442
+ subtitles: ISubtitlesModule;
443
+ drm: IDRMModule;
444
+ casting: ICastingModule;
445
+ thumbnails: IThumbnailsModule;
744
446
  private hlsSubtitleCues;
745
447
  private hlsActiveSubtitleKey;
746
448
  private audioTrackList;
@@ -764,47 +466,20 @@ export declare class VideoPlayerSDK {
764
466
  private pendingSeekAttribution;
765
467
  private eventListeners;
766
468
  constructor(options: PlayerSDKOptions);
767
- /**
768
- * Builds the video DOM hierarchy, binds events, validates domain restrictions, and mounts DRM watermarks.
769
- */
770
469
  private initializePlayer;
771
- /**
772
- * Binds direct event listeners to the native HTML5 Video tag, routing them to our sub-packages.
773
- */
774
470
  private bindMediaEvents;
775
471
  private rewriteToProxy;
776
- /**
777
- * Initializes HLS adaptive streaming through Hls.js or falls back to native browser playback.
778
- */
779
472
  private loadSource;
780
- /**
781
- * Sets up global lock-screen metadata and media control keys (Media Session API).
782
- */
783
473
  private setupBackgroundControls;
784
474
  play(): void;
785
475
  pause(): void;
786
476
  seek(seconds: number): void;
787
- /**
788
- * Attributes the NEXT seek to a specific user gesture so telemetry reports it as
789
- * `fast_forward` / `fast_backward` / `key_moments` instead of a generic `seek`.
790
- * Call immediately before triggering the seek. The attribution expires after a
791
- * short window so it can never leak onto an unrelated later seek.
792
- */
793
477
  attributeNextSeek(eventType: 'fast_forward' | 'fast_backward' | 'key_moments', extras?: Partial<AnalyticsEvent>): void;
794
478
  setVolume(volume: number): void;
795
479
  setMute(muted: boolean): void;
796
480
  setPlaybackRate(rate: number): void;
797
- /**
798
- * Sets manual video quality rendition or switches back to auto bitrate scaling.
799
- */
800
481
  setQuality(qualityId: number): void;
801
- /**
802
- * Activates native Picture-in-Picture floating viewport.
803
- */
804
482
  togglePictureInPicture(): Promise<boolean>;
805
- /**
806
- * Requests element-level fullscreen.
807
- */
808
483
  toggleFullscreen(): void;
809
484
  getVideoElement(): HTMLVideoElement;
810
485
  getCurrentTime(): number;
@@ -819,17 +494,6 @@ export declare class VideoPlayerSDK {
819
494
  start: number;
820
495
  end: number;
821
496
  }>;
822
- /**
823
- * Returns true if the browser can decode at least one of the manifest's renditions.
824
- *
825
- * Deliberately conservative to avoid ever blocking a valid stream:
826
- * - A codec that isn't declared is treated as playable (we never assume unsupported).
827
- * - Any failure to verify (no MediaSource, isTypeSupported throws) returns true.
828
- * - The stream is "playable" if even one rendition's declared codecs are all supported,
829
- * matching how HLS.js itself selects a level.
830
- * Returns false only when the browser explicitly reports every declared codec as
831
- * undecodable (e.g. Dolby EC-3/AC-3 in Chrome).
832
- */
833
497
  private hasPlayableLevel;
834
498
  private getAnalyticsPayload;
835
499
  on(event: string, callback: (...args: any[]) => void): void;
@@ -838,12 +502,6 @@ export declare class VideoPlayerSDK {
838
502
  private extractSubtitlesFromManifest;
839
503
  private extractKeyMomentsFromManifest;
840
504
  private extractAdBreaksFromManifest;
841
- /**
842
- * Whether manifest ad-break discovery has finished for the current source. A listener
843
- * attached after the fact would never see the event, so a consumer that gates on it has
844
- * to be able to ask directly — the two fetches above can resolve before the UI's own
845
- * effects have run.
846
- */
847
505
  hasAdBreakDiscoverySettled(): boolean;
848
506
  private buildManifestUrl;
849
507
  private findFirstVariantUri;
@@ -860,21 +518,7 @@ export declare class VideoPlayerSDK {
860
518
  private parseAdBreaksFromPlaylist;
861
519
  private sameAdBreaks;
862
520
  private isTimeInAdBreak;
863
- /**
864
- * Syncs isAdBreak/playbackRate/ad-mode UI state against `time` and emits
865
- * adbreakchange on transitions. Called from timeupdate, but also called
866
- * eagerly as soon as ad breaks or metadata become known — timeupdate alone
867
- * doesn't fire until playback actually starts, which left a preroll ad's
868
- * first frame briefly showing content controls (rewind/forward, etc.)
869
- * while autoplay was blocked or the source was still buffering.
870
- */
871
521
  private refreshAdBreakState;
872
- /**
873
- * Converts raw (stitched) video time to content-only time by subtracting the
874
- * ad time elapsed before `time`. During an ad break the result is frozen at
875
- * the content timestamp where the break started. Identity when no ad breaks
876
- * are known. Mirrors the seekbar mapping in the UI layer.
877
- */
878
522
  private videoTimeToContentTime;
879
523
  getAdBreaks(): Array<{
880
524
  startTime: number;
@@ -884,14 +528,6 @@ export declare class VideoPlayerSDK {
884
528
  startTime: number;
885
529
  endTime: number;
886
530
  }>): void;
887
- /**
888
- * Marks breaks (by startTime) as already watched, so playback treats their range as
889
- * ordinary content. The UI owns this list — it is the only layer that knows what the
890
- * viewer has actually sat through — and re-pushes it after any re-init.
891
- *
892
- * The ad media itself is still stitched into the manifest, so the UI must still seek
893
- * over the range; what this removes is every *other* transition at the boundary.
894
- */
895
531
  setRetiredAdBreaks(starts: number[]): void;
896
532
  isInAdBreak(): boolean;
897
533
  getAudioTracks(): Array<{
@@ -900,20 +536,8 @@ export declare class VideoPlayerSDK {
900
536
  lang: string;
901
537
  }>;
902
538
  setAudioTrack(id: number): void;
903
- /**
904
- * Arms a one-shot timer while buffering. If the timer fires and no data has
905
- * arrived since it was armed (progressTick unchanged) and we're still
906
- * buffering, the stream is considered dead. If data did arrive but we're still
907
- * buffering (slow connection), it re-arms for another window rather than
908
- * failing — so slow internet never trips it.
909
- */
910
539
  private armStallWatchdog;
911
540
  private clearStallWatchdog;
912
- /**
913
- * Terminal error path: emit 'error' (which drives the error screen) and tear
914
- * down the player. Guarded so it runs at most once, no matter how many error
915
- * events fire during teardown.
916
- */
917
541
  private fail;
918
542
  destroy(): void;
919
543
  }
@@ -953,11 +577,6 @@ declare interface WebVideoPlayerProps {
953
577
  autoFullscreen?: boolean;
954
578
  watchProgressInterval?: number;
955
579
  subtitleStyle?: SubtitleStyle_2;
956
- /**
957
- * Pre-resolved entitlement package from BossVideoPlayer.
958
- * When provided, features are determined exclusively by this package (API mode).
959
- * When absent, features fall back to explicit props with true defaults (standalone mode).
960
- */
961
580
  resolvedEntitlement?: {
962
581
  package: string;
963
582
  is_active: boolean;
@@ -980,25 +599,15 @@ declare interface WebVideoPlayerProps {
980
599
  sources?: SourceItem[];
981
600
  activeSourceIndex?: number;
982
601
  onSourceChange?: (index: number) => void;
983
- /** Seek to this position (in seconds) as soon as the video is ready. Use for resume-playback. */
984
602
  initialTime?: number;
985
- /** Called on every timeupdate with the current playback position in seconds. Use to persist watch progress. */
986
603
  onTimeUpdate?: (currentTime: number) => void;
987
- /** Content-relative start of a skippable intro, in seconds (e.g. episode recap/theme song). */
988
604
  introStartTime?: number;
989
- /** Content-relative end of the intro, in seconds. Skip Intro seeks here. */
990
605
  introEndTime?: number;
991
- /** Whether another episode is available to auto-advance into when the outro is reached. */
992
606
  hasNextEpisode?: boolean;
993
- /** Content-relative time the outro/credits begin, in seconds. Reveals the Next Episode chip. */
994
607
  outroStartTime?: number;
995
- /** Label shown on the Next Episode chip. Defaults to "Next Episode". */
996
608
  nextEpisodeLabel?: string;
997
- /** Called when the viewer clicks the Next Episode chip, or its countdown fill completes. */
998
609
  onNextEpisode?: () => void;
999
- /** Seconds before the Next Episode chip auto-advances once shown. Default 5. */
1000
610
  nextEpisodeAutoAdvanceSeconds?: number;
1001
- /** Thumbnail image for the upcoming episode, shown above the Next Episode chip. */
1002
611
  nextEpisodeThumbnailUrl?: string;
1003
612
  }
1004
613