boss-web-player-sdk 1.1.39 → 1.1.40

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/core.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./src-DKLGLFLQ.cjs");var t=class{player;install(e){this.player=e,this.onInstall()}destroy(){this.onDestroy()}onDestroy(){}};exports.AnalyticsModule=e.l,exports.BasePlayerPlugin=t,exports.CastingModule=e.r,exports.ChaptersModule=e.o,exports.DRMModule=e.i,exports.FirebaseAnalyticsProvider=e.c,exports.KeyMomentsModule=e.s,exports.SubtitlesModule=e.a,exports.ThumbnailsModule=e.n,exports.VideoPlayerSDK=e.t;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./src-CifLE2C5.cjs");exports.AnalyticsModule=e.AnalyticsModule,exports.BasePlayerPlugin=class{player;install(e){this.player=e,this.onInstall()}destroy(){this.onDestroy()}onDestroy(){}},exports.CastingModule=e.CastingModule,exports.ChaptersModule=e.ChaptersModule,exports.DRMModule=e.DRMModule,exports.FirebaseAnalyticsProvider=e.FirebaseAnalyticsProvider,exports.KeyMomentsModule=e.KeyMomentsModule,exports.SubtitlesModule=e.SubtitlesModule,exports.ThumbnailsModule=e.ThumbnailsModule,exports.VideoPlayerSDK=e.VideoPlayerSDK;
package/dist/core.d.ts CHANGED
@@ -88,14 +88,12 @@ export declare class AnalyticsModule {
88
88
 
89
89
  declare interface AnalyticsSessionSnapshot {
90
90
  sessionId: string;
91
- /** True once session_start has fired — a seeded module must not fire it again. */
92
91
  sessionStartFired: boolean;
93
92
  totalWatchTime: number;
94
93
  streamingTime: number;
95
94
  adWatchTime: number;
96
95
  bufferingCount: number;
97
96
  totalBufferingTime: number;
98
- /** Quartile milestones already dispatched ('first_quartile' | 'midpoint' | 'third_quartile'). */
99
97
  milestonesHit: string[];
100
98
  }
101
99
 
@@ -117,71 +115,28 @@ export declare class CastingModule {
117
115
  private castContext;
118
116
  private remotePlayer;
119
117
  private remotePlayerController;
120
- /** Listeners this module attached, so destroy() can detach exactly those. */
121
118
  private attachedListeners;
122
119
  private destroyed;
123
- /** The global API-ready hook installed by this module, if any. */
124
120
  private apiReadyHook?;
125
- /** Last connection state handed to the consumer, so a replay can't double-fire. */
126
121
  private announcedCasting?;
127
- /** Stream URL this module last pushed to the receiver; null when nothing of ours is loaded. */
128
122
  private loadedSrc;
129
- /** Stream URL of an in-flight loadMedia, so concurrent callers don't load twice. */
130
123
  private pendingSrc;
131
124
  constructor();
132
125
  private initCastApi;
133
126
  private addListener;
134
- /**
135
- * Notifies the consumer of the current connection state, but only when it actually
136
- * changed since the last notification. The state can be seeded before a callback is
137
- * registered (session adopted at construction), so registration replays it — this
138
- * guard keeps that replay from double-firing against a real IS_CONNECTED_CHANGED.
139
- */
140
127
  private announceCastState;
141
128
  getCastingState(): {
142
129
  isCasting: boolean;
143
130
  deviceName: string;
144
131
  };
145
132
  getRemoteState(): RemoteCastState | null;
146
- /**
147
- * Derives the Cast MediaInfo content type from the stream URL so HLS/DASH manifests
148
- * aren't sent to the receiver mislabeled as video/mp4, which causes load failures.
149
- */
150
133
  private getContentType;
151
- /** Whether a cast session is currently connected (including one joined from a previous page). */
152
134
  isSessionActive(): boolean;
153
- /** Content URL the receiver currently has loaded, whoever put it there. Null if nothing is loaded. */
154
135
  getReceiverContentId(): string | null;
155
- /**
156
- * Loads media onto the session that is already connected. Returns true once the receiver
157
- * has accepted the load.
158
- *
159
- * Separate from requestSession() because a session outlives the player that started it:
160
- * after navigating to another title the new player must replace what is on the receiver
161
- * without prompting the device picker again.
162
- */
163
136
  loadMedia(src: string, currentTime: number, title?: string): Promise<boolean>;
164
- /**
165
- * Ensures the receiver is playing `src` rather than whatever a previous player left on it.
166
- * No-ops when the receiver already holds this stream, so re-entering a page that is
167
- * already casting doesn't restart playback on the TV.
168
- */
169
137
  syncMedia(src: string, currentTime: number, title?: string): Promise<boolean>;
170
- /**
171
- * Prompts the native Google Cast device picker overlay, then loads media on the remote device.
172
- * The caller is responsible for pausing local playback before/after this resolves.
173
- */
174
138
  requestSession(currentSrc: string, currentTime: number, title?: string): Promise<void>;
175
- /**
176
- * Disconnects the current cast session.
177
- */
178
139
  stopCasting(): void;
179
- /**
180
- * Detaches this module from the Cast framework. The CastContext is a page-wide singleton
181
- * and the session deliberately survives, but the RemotePlayer listeners must go: otherwise
182
- * every player that has ever mounted keeps pushing remote state into its own (unmounted)
183
- * consumer, and a torn-down player can still react to the live session.
184
- */
185
140
  destroy(): void;
186
141
  remotePlayPause(): void;
187
142
  remoteSeek(time: number): void;
@@ -220,20 +175,11 @@ export declare class DRMModule {
220
175
  private watermarkElement?;
221
176
  private floatInterval?;
222
177
  constructor(config?: DRMConfig);
223
- /**
224
- * Validates if the active origin domain is permitted to load this stream asset.
225
- */
226
178
  validateDomain(currentDomain: string): boolean;
227
179
  getAuthToken(): string | undefined;
228
180
  getAuthHeader(): string | undefined;
229
181
  getRequestHeaders(): Record<string, string>;
230
- /**
231
- * Injects an animated floating watermark on top of the media container to obstruct piracy or recording.
232
- */
233
182
  setupWatermark(container: HTMLElement): void;
234
- /**
235
- * Cleans up active watermarks.
236
- */
237
183
  removeWatermark(): void;
238
184
  isDRMProtected(): boolean;
239
185
  getDRMDetails(): {
@@ -245,16 +191,6 @@ export declare class DRMModule {
245
191
  };
246
192
  }
247
193
 
248
- /**
249
- * Sends all player analytics events to Firebase Analytics (GA4).
250
- *
251
- * Events appear in:
252
- * Firebase Console → Analytics → Events (24-48 hr aggregated view)
253
- * Firebase Console → Analytics → DebugView (real-time while testing)
254
- * Google Analytics 4 → Reports → Realtime (within a few minutes)
255
- *
256
- * No Firestore / database setup required — Firebase Analytics handles all storage.
257
- */
258
194
  export declare class FirebaseAnalyticsProvider {
259
195
  private analytics;
260
196
  private logEventFn;
@@ -286,25 +222,13 @@ export declare class KeyMomentsModule {
286
222
  private currentMomentIndex;
287
223
  private onMomentChangeCallback?;
288
224
  constructor(keyMoments?: KeyMoment[]);
289
- /**
290
- * Sorts and stores the key moments.
291
- */
292
225
  setKeyMoments(keyMoments: KeyMoment[]): void;
293
226
  getKeyMoments(): KeyMoment[];
294
- /**
295
- * Locates the key moment corresponding to the active playback timestamp.
296
- */
297
227
  getCurrentMoment(currentTime: number): {
298
228
  keyMoment: KeyMoment | null;
299
229
  index: number;
300
230
  };
301
- /**
302
- * Evaluates if playback has crossed a key moment boundary.
303
- */
304
231
  updateTime(currentTime: number): void;
305
- /**
306
- * Subscribes a callback to change events.
307
- */
308
232
  onMomentChange(callback: (keyMoment: KeyMoment | null, index: number) => void): void;
309
233
  setChapters(chapters: KeyMoment[]): void;
310
234
  getChapters(): KeyMoment[];
@@ -339,11 +263,6 @@ export declare interface PlayerSDKOptions {
339
263
  watchProgressInterval?: number;
340
264
  themeColor?: string;
341
265
  watermark?: string;
342
- /**
343
- * Optional URL transformer applied to every HLS segment/manifest request.
344
- * Use this to route requests through a CORS proxy without hardcoding domains.
345
- * Example: (url) => url.replace('https://cdn.example.com', '/my-proxy')
346
- */
347
266
  urlTransformer?: (url: string) => string;
348
267
  }
349
268
 
@@ -369,22 +288,10 @@ export declare class SubtitlesModule {
369
288
  addTrack(track: SubtitleTrack): void;
370
289
  onTrackSwitch(callback: (track: SubtitleTrack | null) => void): void;
371
290
  setCustomSubtitleText(text: string): void;
372
- /**
373
- * Switches the active track. Fetches external tracks if they need loading.
374
- */
375
291
  setActiveTrack(trackId: string): Promise<void>;
376
- /**
377
- * Scans the subtitle cues for the current playback position.
378
- */
379
292
  updateTime(currentTime: number): void;
380
- /**
381
- * Triggers the text update callback if a change in caption is detected.
382
- */
383
293
  private updateActiveText;
384
294
  onSubtitleChange(callback: (text: string) => void): void;
385
- /**
386
- * Robust parser supporting WebVTT and SRT formats.
387
- */
388
295
  private parseVttOrSrt;
389
296
  }
390
297
 
@@ -418,9 +325,6 @@ export declare interface ThumbnailConfig {
418
325
  export declare class ThumbnailsModule {
419
326
  private config?;
420
327
  constructor(config?: ThumbnailConfig);
421
- /**
422
- * Calculates the position offset inside the sprite sheet for a given seek hover time.
423
- */
424
328
  getThumbnail(time: number): {
425
329
  url: string;
426
330
  x: number;
@@ -468,47 +372,20 @@ export declare class VideoPlayerSDK {
468
372
  private pendingSeekAttribution;
469
373
  private eventListeners;
470
374
  constructor(options: PlayerSDKOptions);
471
- /**
472
- * Builds the video DOM hierarchy, binds events, validates domain restrictions, and mounts DRM watermarks.
473
- */
474
375
  private initializePlayer;
475
- /**
476
- * Binds direct event listeners to the native HTML5 Video tag, routing them to our sub-packages.
477
- */
478
376
  private bindMediaEvents;
479
377
  private rewriteToProxy;
480
- /**
481
- * Initializes HLS adaptive streaming through Hls.js or falls back to native browser playback.
482
- */
483
378
  private loadSource;
484
- /**
485
- * Sets up global lock-screen metadata and media control keys (Media Session API).
486
- */
487
379
  private setupBackgroundControls;
488
380
  play(): void;
489
381
  pause(): void;
490
382
  seek(seconds: number): void;
491
- /**
492
- * Attributes the NEXT seek to a specific user gesture so telemetry reports it as
493
- * `fast_forward` / `fast_backward` / `key_moments` instead of a generic `seek`.
494
- * Call immediately before triggering the seek. The attribution expires after a
495
- * short window so it can never leak onto an unrelated later seek.
496
- */
497
383
  attributeNextSeek(eventType: 'fast_forward' | 'fast_backward' | 'key_moments', extras?: Partial<AnalyticsEvent>): void;
498
384
  setVolume(volume: number): void;
499
385
  setMute(muted: boolean): void;
500
386
  setPlaybackRate(rate: number): void;
501
- /**
502
- * Sets manual video quality rendition or switches back to auto bitrate scaling.
503
- */
504
387
  setQuality(qualityId: number): void;
505
- /**
506
- * Activates native Picture-in-Picture floating viewport.
507
- */
508
388
  togglePictureInPicture(): Promise<boolean>;
509
- /**
510
- * Requests element-level fullscreen.
511
- */
512
389
  toggleFullscreen(): void;
513
390
  getVideoElement(): HTMLVideoElement;
514
391
  getCurrentTime(): number;
@@ -523,17 +400,6 @@ export declare class VideoPlayerSDK {
523
400
  start: number;
524
401
  end: number;
525
402
  }>;
526
- /**
527
- * Returns true if the browser can decode at least one of the manifest's renditions.
528
- *
529
- * Deliberately conservative to avoid ever blocking a valid stream:
530
- * - A codec that isn't declared is treated as playable (we never assume unsupported).
531
- * - Any failure to verify (no MediaSource, isTypeSupported throws) returns true.
532
- * - The stream is "playable" if even one rendition's declared codecs are all supported,
533
- * matching how HLS.js itself selects a level.
534
- * Returns false only when the browser explicitly reports every declared codec as
535
- * undecodable (e.g. Dolby EC-3/AC-3 in Chrome).
536
- */
537
403
  private hasPlayableLevel;
538
404
  private getAnalyticsPayload;
539
405
  on(event: string, callback: (...args: any[]) => void): void;
@@ -542,12 +408,6 @@ export declare class VideoPlayerSDK {
542
408
  private extractSubtitlesFromManifest;
543
409
  private extractKeyMomentsFromManifest;
544
410
  private extractAdBreaksFromManifest;
545
- /**
546
- * Whether manifest ad-break discovery has finished for the current source. A listener
547
- * attached after the fact would never see the event, so a consumer that gates on it has
548
- * to be able to ask directly — the two fetches above can resolve before the UI's own
549
- * effects have run.
550
- */
551
411
  hasAdBreakDiscoverySettled(): boolean;
552
412
  private buildManifestUrl;
553
413
  private findFirstVariantUri;
@@ -564,21 +424,7 @@ export declare class VideoPlayerSDK {
564
424
  private parseAdBreaksFromPlaylist;
565
425
  private sameAdBreaks;
566
426
  private isTimeInAdBreak;
567
- /**
568
- * Syncs isAdBreak/playbackRate/ad-mode UI state against `time` and emits
569
- * adbreakchange on transitions. Called from timeupdate, but also called
570
- * eagerly as soon as ad breaks or metadata become known — timeupdate alone
571
- * doesn't fire until playback actually starts, which left a preroll ad's
572
- * first frame briefly showing content controls (rewind/forward, etc.)
573
- * while autoplay was blocked or the source was still buffering.
574
- */
575
427
  private refreshAdBreakState;
576
- /**
577
- * Converts raw (stitched) video time to content-only time by subtracting the
578
- * ad time elapsed before `time`. During an ad break the result is frozen at
579
- * the content timestamp where the break started. Identity when no ad breaks
580
- * are known. Mirrors the seekbar mapping in the UI layer.
581
- */
582
428
  private videoTimeToContentTime;
583
429
  getAdBreaks(): Array<{
584
430
  startTime: number;
@@ -588,14 +434,6 @@ export declare class VideoPlayerSDK {
588
434
  startTime: number;
589
435
  endTime: number;
590
436
  }>): void;
591
- /**
592
- * Marks breaks (by startTime) as already watched, so playback treats their range as
593
- * ordinary content. The UI owns this list — it is the only layer that knows what the
594
- * viewer has actually sat through — and re-pushes it after any re-init.
595
- *
596
- * The ad media itself is still stitched into the manifest, so the UI must still seek
597
- * over the range; what this removes is every *other* transition at the boundary.
598
- */
599
437
  setRetiredAdBreaks(starts: number[]): void;
600
438
  isInAdBreak(): boolean;
601
439
  getAudioTracks(): Array<{
@@ -604,20 +442,8 @@ export declare class VideoPlayerSDK {
604
442
  lang: string;
605
443
  }>;
606
444
  setAudioTrack(id: number): void;
607
- /**
608
- * Arms a one-shot timer while buffering. If the timer fires and no data has
609
- * arrived since it was armed (progressTick unchanged) and we're still
610
- * buffering, the stream is considered dead. If data did arrive but we're still
611
- * buffering (slow connection), it re-arms for another window rather than
612
- * failing — so slow internet never trips it.
613
- */
614
445
  private armStallWatchdog;
615
446
  private clearStallWatchdog;
616
- /**
617
- * Terminal error path: emit 'error' (which drives the error screen) and tear
618
- * down the player. Guarded so it runs at most once, no matter how many error
619
- * events fire during teardown.
620
- */
621
447
  private fail;
622
448
  destroy(): void;
623
449
  }
package/dist/core.js CHANGED
@@ -1,14 +1 @@
1
- import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c } from "./src-C453Jlyd.js";
2
- //#region ../plugins/src/plugins.ts
3
- var l = class {
4
- player;
5
- install(e) {
6
- this.player = e, this.onInstall();
7
- }
8
- destroy() {
9
- this.onDestroy();
10
- }
11
- onDestroy() {}
12
- };
13
- //#endregion
14
- export { r as AnalyticsModule, l as BasePlayerPlugin, o as CastingModule, a as ChaptersModule, n as DRMModule, t as FirebaseAnalyticsProvider, s as KeyMomentsModule, e as SubtitlesModule, i as ThumbnailsModule, c as VideoPlayerSDK };
1
+ import{a as s,c as a,i as r,l as t,n as o,o as l,r as e,s as i,t as n}from"./src-ChMUr4mo.js";var y=class{player;install(s){this.player=s,this.onInstall()}destroy(){this.onDestroy()}onDestroy(){}};export{t as AnalyticsModule,y as BasePlayerPlugin,e as CastingModule,l as ChaptersModule,r as DRMModule,a as FirebaseAnalyticsProvider,i as KeyMomentsModule,s as SubtitlesModule,o as ThumbnailsModule,n as VideoPlayerSDK};