boss-web-player-sdk 1.1.19 → 1.1.21

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
@@ -63,7 +63,7 @@ declare class AnalyticsModule {
63
63
  private milestonesHit;
64
64
  private lastHeartbeatPosition;
65
65
  private lastHeartbeatAt;
66
- constructor(callback?: AnalyticsCallback, src?: string, seed?: AnalyticsSessionSnapshot);
66
+ constructor(callback?: AnalyticsCallback, src?: string, seed?: AnalyticsSessionSnapshot, videoId?: string);
67
67
  getSessionSnapshot(): AnalyticsSessionSnapshot;
68
68
  registerCallback(callback: AnalyticsCallback): void;
69
69
  setAdBreaks(adBreaks: Array<{
@@ -102,7 +102,7 @@ declare interface AnalyticsSessionSnapshot {
102
102
  milestonesHit: string[];
103
103
  }
104
104
 
105
- export declare function BossVideoPlayer({ playerKey, src, subtitles, licenseKey, themeColor, firebaseConfig, proxyDomains, apiBaseUrl, adTrackingUrl, overlayAdUrl, title, watermark, autoplay, muted, autoFullscreen, enableControls, enableSkipAd, skipAdAfterSeconds, chaptersDisplayMode, volumeControlType, subtitleStyle, drmConfig, onAnalyticsEvent, delegate, onKeyMomentsLoaded, initialTime, onTimeUpdate, }: BossVideoPlayerProps): JSX.Element;
105
+ 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, }: BossVideoPlayerProps): JSX.Element;
106
106
 
107
107
  export declare interface BossVideoPlayerProps {
108
108
  /** Player key from the GoBOSS dashboard — identifies your tenant. */
@@ -140,6 +140,7 @@ export declare interface BossVideoPlayerProps {
140
140
  adTrackingUrl?: string;
141
141
  /** AWS MediaTailor overlay ad tracking URL. */
142
142
  overlayAdUrl?: string;
143
+ videoId?: string;
143
144
  /** Video title shown in the player UI. */
144
145
  title?: string;
145
146
  /** Watermark text stamped on the video. */
@@ -286,7 +287,11 @@ declare class DRMModule {
286
287
  };
287
288
  }
288
289
 
289
- export declare function endSession(playerKey: string, sessionId: string, apiBase?: string): Promise<void>;
290
+ /**
291
+ * Ends the session and finalizes billed minutes. `currentTime` and `duration`
292
+ * are required by the API — pass the final playback position and content length.
293
+ */
294
+ export declare function endSession(playerKey: string, sessionId: string, currentTime?: number, duration?: number, apiBase?: string): Promise<void>;
290
295
 
291
296
  export declare type FeatureFlags = {
292
297
  m3u8_playback: boolean;
@@ -338,7 +343,7 @@ export declare interface FirebaseConfig {
338
343
  measurementId?: string;
339
344
  }
340
345
 
341
- export declare function initSdk(playerKey: string, apiBase?: string): Promise<SdkInitResponse>;
346
+ export declare function initSdk(playerKey: string, apiBase?: string, options?: SdkInitOptions): Promise<SdkInitResponse>;
342
347
 
343
348
  export declare type KeyMoment = Chapter;
344
349
 
@@ -434,15 +439,17 @@ export declare interface PlayerDelegate {
434
439
 
435
440
  /**
436
441
  * In-session telemetry payload for POST /api/player/sdk/events.
437
- * `eventType`, `sessionId` and `currentTime` are always required; `videoId` and any
438
- * event-specific extras (e.g. `from`/`to`, `speed`, `bufferingCount`) are sent at the
439
- * top level — never wrapped in a client `properties` object (the server nests them).
442
+ * `eventType`, `sessionId` and `currentTime` are always required; `videoId`,
443
+ * `videoTitle` and any event-specific extras (e.g. `from`/`to`, `speed`,
444
+ * `bufferingCount`) are sent at the top level — never wrapped in a client
445
+ * `properties` object (the server nests them).
440
446
  */
441
447
  export declare interface PlayerEventPayload {
442
448
  eventType: string;
443
449
  sessionId: string;
444
450
  currentTime: number;
445
451
  videoId?: string;
452
+ videoTitle?: string;
446
453
  [key: string]: unknown;
447
454
  }
448
455
 
@@ -468,6 +475,7 @@ export declare interface PlayerSDKOptions {
468
475
  thumbnails?: ThumbnailConfig;
469
476
  drm?: DRMConfig;
470
477
  analyticsCallback?: AnalyticsCallback;
478
+ videoId?: string;
471
479
  analyticsSessionSeed?: AnalyticsSessionSnapshot;
472
480
  watchProgressInterval?: number;
473
481
  themeColor?: string;
@@ -492,6 +500,8 @@ export declare type SdkInitData = {
492
500
  tenantId: string;
493
501
  features: SdkInitFeatures;
494
502
  planTier: string;
503
+ /** How often to call /session/heartbeat. Falls back to 30s when absent. */
504
+ heartbeatIntervalSeconds?: number;
495
505
  };
496
506
 
497
507
  export declare type SdkInitFeatures = {
@@ -501,6 +511,11 @@ export declare type SdkInitFeatures = {
501
511
  [key: string]: boolean;
502
512
  };
503
513
 
514
+ /** Optional context accepted by POST /init. `referrer` is intentionally not sent. */
515
+ export declare interface SdkInitOptions {
516
+ videoUrl?: string;
517
+ }
518
+
504
519
  export declare type SdkInitResponse = {
505
520
  result: {
506
521
  data: SdkInitData;
@@ -530,7 +545,26 @@ export declare interface SourceItem {
530
545
  url: string;
531
546
  }
532
547
 
533
- export declare function startSession(playerKey: string, sessionId: string, videoId: string, apiBase?: string): Promise<void>;
548
+ export declare function startSession(playerKey: string, options: StartSessionOptions, apiBase?: string): Promise<void>;
549
+
550
+ /**
551
+ * Body for POST /session/start. Only `sessionId` is required for HTTP acceptance,
552
+ * but `videoId`, `videoTitle` and `contentDurationSec` drive the video-level CMS
553
+ * analytics (Top Videos, retention, completion) — send them whenever they're known.
554
+ * `platform` and `referrer` are intentionally not sent by this SDK.
555
+ */
556
+ export declare interface StartSessionOptions {
557
+ /** Client-generated UUID identifying this play. */
558
+ sessionId: string;
559
+ /** Stable content ID — the grouping key for video-level analytics. */
560
+ videoId?: string;
561
+ /** Display title for CMS dashboards. */
562
+ videoTitle?: string;
563
+ /** Playback URL. */
564
+ videoUrl?: string;
565
+ /** Full content length in seconds, when known. */
566
+ contentDurationSec?: number;
567
+ }
534
568
 
535
569
  declare class SubtitlesModule {
536
570
  private tracks;
@@ -732,24 +766,11 @@ export declare class VideoPlayerSDK {
732
766
  private findFirstVariantUri;
733
767
  private resolveUrl;
734
768
  private static readonly AD_HOST_PATTERNS;
735
- private static readonly AD_PATH_PATTERNS;
769
+ private static readonly AD_STITCHER_PATH_PATTERNS;
770
+ private static readonly AD_PATH_HINT_PATTERNS;
736
771
  private parseSegmentUrl;
737
772
  private isKnownAdSegment;
738
- /**
739
- * Classifies discontinuity-delimited segment groups as ad or content.
740
- *
741
- * SSAI stitchers insert one #EXT-X-DISCONTINUITY *per ad*, not per ad break — a
742
- * three-ad pod becomes three consecutive ad groups separated by discontinuities.
743
- * That makes continuity-counter parity (the previous heuristic) correct only for
744
- * single-ad breaks: in a three-ad pod the second ad lands on an even counter and
745
- * plays back as ordinary content, with content controls and no ad UI.
746
- *
747
- * Classify by where each group's segments are actually served from instead, since
748
- * that is what separates stitched ads from origin content. Parity survives only as
749
- * the last resort, for stitchers that proxy ads and content through one host.
750
- *
751
- * Returns one flag per group, true for ad.
752
- */
773
+ private hasAdPathHint;
753
774
  private classifyAdGroups;
754
775
  private mergeAdjacentRanges;
755
776
  private parseAdBreaksFromFragments;
@@ -863,6 +884,7 @@ declare interface WebVideoPlayerProps {
863
884
  skipAdAfterSeconds?: number;
864
885
  overlayAdUrl?: string;
865
886
  adTrackingUrl?: string;
887
+ videoId?: string;
866
888
  sources?: SourceItem[];
867
889
  activeSourceIndex?: number;
868
890
  onSourceChange?: (index: number) => void;