boss-web-player-sdk 1.1.20 → 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
@@ -287,7 +287,11 @@ declare class DRMModule {
287
287
  };
288
288
  }
289
289
 
290
- 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>;
291
295
 
292
296
  export declare type FeatureFlags = {
293
297
  m3u8_playback: boolean;
@@ -339,7 +343,7 @@ export declare interface FirebaseConfig {
339
343
  measurementId?: string;
340
344
  }
341
345
 
342
- export declare function initSdk(playerKey: string, apiBase?: string): Promise<SdkInitResponse>;
346
+ export declare function initSdk(playerKey: string, apiBase?: string, options?: SdkInitOptions): Promise<SdkInitResponse>;
343
347
 
344
348
  export declare type KeyMoment = Chapter;
345
349
 
@@ -435,15 +439,17 @@ export declare interface PlayerDelegate {
435
439
 
436
440
  /**
437
441
  * In-session telemetry payload for POST /api/player/sdk/events.
438
- * `eventType`, `sessionId` and `currentTime` are always required; `videoId` and any
439
- * event-specific extras (e.g. `from`/`to`, `speed`, `bufferingCount`) are sent at the
440
- * 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).
441
446
  */
442
447
  export declare interface PlayerEventPayload {
443
448
  eventType: string;
444
449
  sessionId: string;
445
450
  currentTime: number;
446
451
  videoId?: string;
452
+ videoTitle?: string;
447
453
  [key: string]: unknown;
448
454
  }
449
455
 
@@ -494,6 +500,8 @@ export declare type SdkInitData = {
494
500
  tenantId: string;
495
501
  features: SdkInitFeatures;
496
502
  planTier: string;
503
+ /** How often to call /session/heartbeat. Falls back to 30s when absent. */
504
+ heartbeatIntervalSeconds?: number;
497
505
  };
498
506
 
499
507
  export declare type SdkInitFeatures = {
@@ -503,6 +511,11 @@ export declare type SdkInitFeatures = {
503
511
  [key: string]: boolean;
504
512
  };
505
513
 
514
+ /** Optional context accepted by POST /init. `referrer` is intentionally not sent. */
515
+ export declare interface SdkInitOptions {
516
+ videoUrl?: string;
517
+ }
518
+
506
519
  export declare type SdkInitResponse = {
507
520
  result: {
508
521
  data: SdkInitData;
@@ -532,7 +545,26 @@ export declare interface SourceItem {
532
545
  url: string;
533
546
  }
534
547
 
535
- 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
+ }
536
568
 
537
569
  declare class SubtitlesModule {
538
570
  private tracks;
@@ -734,24 +766,11 @@ export declare class VideoPlayerSDK {
734
766
  private findFirstVariantUri;
735
767
  private resolveUrl;
736
768
  private static readonly AD_HOST_PATTERNS;
737
- private static readonly AD_PATH_PATTERNS;
769
+ private static readonly AD_STITCHER_PATH_PATTERNS;
770
+ private static readonly AD_PATH_HINT_PATTERNS;
738
771
  private parseSegmentUrl;
739
772
  private isKnownAdSegment;
740
- /**
741
- * Classifies discontinuity-delimited segment groups as ad or content.
742
- *
743
- * SSAI stitchers insert one #EXT-X-DISCONTINUITY *per ad*, not per ad break — a
744
- * three-ad pod becomes three consecutive ad groups separated by discontinuities.
745
- * That makes continuity-counter parity (the previous heuristic) correct only for
746
- * single-ad breaks: in a three-ad pod the second ad lands on an even counter and
747
- * plays back as ordinary content, with content controls and no ad UI.
748
- *
749
- * Classify by where each group's segments are actually served from instead, since
750
- * that is what separates stitched ads from origin content. Parity survives only as
751
- * the last resort, for stitchers that proxy ads and content through one host.
752
- *
753
- * Returns one flag per group, true for ad.
754
- */
773
+ private hasAdPathHint;
755
774
  private classifyAdGroups;
756
775
  private mergeAdjacentRanges;
757
776
  private parseAdBreaksFromFragments;