unified-video-framework 1.4.431 → 1.4.433

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.
@@ -1,15 +1,4 @@
1
- export { DRMManager } from './DRMManager';
2
- export { BunnyNetProvider } from './providers/BunnyNetProvider';
3
- export { GenericProvider } from './providers/GenericProvider';
4
- export type { ExtendedDRMConfig, DRMCapabilities, LicenseRequest, LicenseResponse, DRMInitResult, DRMError, } from './types/DRMTypes';
5
- export { DRMErrorCode, KEY_SYSTEMS } from './types/DRMTypes';
6
- export type { BunnyNetConfig, BunnyNetEndpoints } from './types/BunnyNetTypes';
7
- export { BUNNY_NET_BASE_URL, BUNNY_NET_ENDPOINTS } from './types/BunnyNetTypes';
8
- export { BrowserDetector } from './utils/BrowserDetector';
9
- export { DRMErrorHandler } from './utils/DRMErrorHandler';
10
- export { CertificateManager } from './utils/CertificateManager';
11
- export { BaseDRM } from './systems/BaseDRM';
12
- export { WidevineDRM } from './systems/WidevineDRM';
13
- export { FairPlayDRM } from './systems/FairPlayDRM';
14
- export { PlayReadyDRM } from './systems/PlayReadyDRM';
1
+ export { DRMManager } from '../../dist/drm/DRMManager';
2
+ export { DRMErrorHandler } from '../../dist/drm/utils/DRMErrorHandler';
3
+ export type { DRMInitResult, DRMError } from '../../dist/drm/types/DRMTypes';
15
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/drm/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAG9D,YAAY,EACV,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,eAAe,EACf,aAAa,EACb,QAAQ,GACT,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE7D,YAAY,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/E,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAGhF,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAGhE,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/drm/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,YAAY,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC"}
@@ -1,13 +1,3 @@
1
- export { DRMManager } from "./DRMManager.js";
2
- export { BunnyNetProvider } from "./providers/BunnyNetProvider.js";
3
- export { GenericProvider } from "./providers/GenericProvider.js";
4
- export { DRMErrorCode, KEY_SYSTEMS } from "./types/DRMTypes.js";
5
- export { BUNNY_NET_BASE_URL, BUNNY_NET_ENDPOINTS } from "./types/BunnyNetTypes.js";
6
- export { BrowserDetector } from "./utils/BrowserDetector.js";
7
- export { DRMErrorHandler } from "./utils/DRMErrorHandler.js";
8
- export { CertificateManager } from "./utils/CertificateManager.js";
9
- export { BaseDRM } from "./systems/BaseDRM.js";
10
- export { WidevineDRM } from "./systems/WidevineDRM.js";
11
- export { FairPlayDRM } from "./systems/FairPlayDRM.js";
12
- export { PlayReadyDRM } from "./systems/PlayReadyDRM.js";
1
+ export { DRMManager } from "../../dist/drm/DRMManager.js";
2
+ export { DRMErrorHandler } from "../../dist/drm/utils/DRMErrorHandler.js";
13
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/drm/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAY9D,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAG7D,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAGhF,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAGhE,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/drm/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC"}
@@ -22,6 +22,8 @@ import {
22
22
  } from './chapters/types/ChapterTypes';
23
23
  import type { FlashNewsTickerConfig } from './react/types/FlashNewsTickerTypes';
24
24
  import YouTubeExtractor from './utils/YouTubeExtractor';
25
+ import { DRMManager, DRMErrorHandler } from './drm';
26
+ import type { DRMInitResult, DRMError } from './drm';
25
27
 
26
28
  // Dynamic imports for streaming libraries
27
29
  declare global {
@@ -142,6 +144,10 @@ export class WebPlayer extends BasePlayer {
142
144
  // Chapter management
143
145
  private chapterManager: ChapterManager | null = null;
144
146
 
147
+ // DRM management
148
+ private drmManager: DRMManager | null = null;
149
+ private isDRMProtected: boolean = false;
150
+
145
151
  // Start time tracking
146
152
  private hasAppliedStartTime: boolean = false;
147
153
  private coreChapterManager: CoreChapterManager | null = null;
@@ -700,6 +706,10 @@ export class WebPlayer extends BasePlayer {
700
706
  this.source = source as any;
701
707
  this.subtitles = (source.subtitles || []) as any;
702
708
 
709
+ // Check if this is DRM-protected content
710
+ this.isDRMProtected = !!(source.drm && source.drm.licenseUrl);
711
+ this.debugLog('DRM config provided:', source.drm);
712
+
703
713
  this.debugLog('Loading video source:', source.url);
704
714
  this.debugLog('Fallback sources provided:', source.fallbackSources);
705
715
  this.debugLog('Fallback poster provided:', source.fallbackPoster);
@@ -750,6 +760,16 @@ export class WebPlayer extends BasePlayer {
750
760
  * Load a video source (main or fallback)
751
761
  */
752
762
  private async loadVideoSource(url: string, sourceType: string, source: any): Promise<void> {
763
+ // Initialize DRM BEFORE loading the video if DRM config exists
764
+ if (this.isDRMProtected && source.drm) {
765
+ try {
766
+ await this.initializeDRM(source.drm);
767
+ } catch (drmError) {
768
+ this.handleDRMError(drmError);
769
+ throw drmError; // Prevent video loading
770
+ }
771
+ }
772
+
753
773
  switch (sourceType) {
754
774
  case 'hls':
755
775
  await this.loadHLS(url);
@@ -782,6 +802,75 @@ export class WebPlayer extends BasePlayer {
782
802
  }
783
803
  }
784
804
 
805
+ /**
806
+ * Initialize DRM system for protected content
807
+ */
808
+ private async initializeDRM(drmConfig: any): Promise<void> {
809
+ if (!this.video) {
810
+ throw new Error('Video element not initialized');
811
+ }
812
+
813
+ this.debugLog('Initializing DRM protection...');
814
+ this.debugLog('DRM Config:', {
815
+ type: drmConfig.type,
816
+ licenseUrl: drmConfig.licenseUrl,
817
+ certificateUrl: drmConfig.certificateUrl
818
+ });
819
+
820
+ try {
821
+ // Create DRMManager instance
822
+ this.drmManager = new DRMManager(
823
+ this.video,
824
+ drmConfig,
825
+ this.config.debug
826
+ );
827
+
828
+ // Initialize DRM system
829
+ const initResult: DRMInitResult = await this.drmManager.initialize();
830
+
831
+ if (!initResult.success) {
832
+ const error = initResult.error!;
833
+ this.debugError('DRM initialization failed:', error);
834
+ throw error;
835
+ }
836
+
837
+ this.debugLog('DRM initialized successfully:', {
838
+ drmType: initResult.drmType,
839
+ keySystem: initResult.keySystem
840
+ });
841
+
842
+ } catch (error) {
843
+ this.debugError('DRM initialization error:', error);
844
+ if (this.drmManager) {
845
+ await this.drmManager.destroy();
846
+ this.drmManager = null;
847
+ }
848
+ throw error;
849
+ }
850
+ }
851
+
852
+ /**
853
+ * Handle DRM-specific errors with user-friendly messages
854
+ */
855
+ private handleDRMError(error: any): void {
856
+ const userMessage = DRMErrorHandler.getUserFriendlyMessage(error);
857
+ const technicalMessage = DRMErrorHandler.getTechnicalMessage(error);
858
+
859
+ this.showNotification(userMessage);
860
+ this.debugError('DRM Error:', technicalMessage);
861
+
862
+ this.handleError({
863
+ code: error.code || 'DRM_ERROR',
864
+ message: userMessage,
865
+ type: 'drm',
866
+ fatal: true,
867
+ details: {
868
+ technical: technicalMessage,
869
+ original: error
870
+ }
871
+ });
872
+ }
873
+
785
874
  /**
786
875
  * Try loading the next fallback source
787
876
  */
@@ -1015,6 +1104,18 @@ export class WebPlayer extends BasePlayer {
1015
1104
  this.debugLog(`⏩ HLS startPosition set to: ${this.config.startTime}s (continue watching)`);
1016
1105
  }
1017
1106
 
1107
+ // Apply DRM configuration if available
1108
+ if (this.isDRMProtected && this.drmManager) {
1109
+ try {
1110
+ const drmHlsConfig = this.drmManager.getHLSConfig();
1111
+ Object.assign(hlsConfig, drmHlsConfig);
1112
+ this.debugLog('Applied DRM config to HLS.js');
1113
+ } catch (error) {
1114
+ this.debugError('Failed to get HLS DRM config:', error);
1115
+ throw error;
1116
+ }
1117
+ }
1118
+
1018
1119
  this.hls = new window.Hls(hlsConfig);
1019
1120
 
1020
1121
  this.hls.loadSource(url);
@@ -1106,6 +1207,18 @@ export class WebPlayer extends BasePlayer {
1106
1207
 
1107
1208
  this.dash.initialize(this.video, url, this.config.autoPlay);
1108
1209
 
1210
+ // Apply DRM protection data if available
1211
+ if (this.isDRMProtected && this.drmManager) {
1212
+ try {
1213
+ const protectionData = this.drmManager.getDashProtectionData();
1214
+ this.dash.setProtectionData(protectionData);
1215
+ this.debugLog('Applied DRM protection data to dash.js');
1216
+ } catch (error) {
1217
+ this.debugError('Failed to apply DASH DRM protection:', error);
1218
+ throw error;
1219
+ }
1220
+ }
1221
+
1109
1222
  // Configure DASH settings
1110
1223
  this.dash.updateSettings({
1111
1224
  streaming: {
@@ -11321,6 +11434,18 @@ export class WebPlayer extends BasePlayer {
11321
11434
  }
11322
11435
 
11323
11436
  private async cleanup(): Promise<void> {
11437
+ // Clean up DRM resources first
11438
+ if (this.drmManager) {
11439
+ try {
11440
+ await this.drmManager.destroy();
11441
+ this.debugLog('DRM manager destroyed');
11442
+ } catch (error) {
11443
+ this.debugError('Error destroying DRM manager:', error);
11444
+ }
11445
+ this.drmManager = null;
11446
+ }
11447
+ this.isDRMProtected = false;
11448
+
11324
11449
  if (this.hls) {
11325
11450
  this.hls.destroy();
11326
11451
  this.hls = null;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * DRM module - re-exports from compiled distribution
3
+ * The DRM implementation is pre-compiled and exists only in dist/drm
4
+ */
5
+
6
+ // Re-export types and classes from the compiled distribution
7
+ export { DRMManager } from '../../dist/drm/DRMManager';
8
+ export { DRMErrorHandler } from '../../dist/drm/utils/DRMErrorHandler';
9
+ export type { DRMInitResult, DRMError } from '../../dist/drm/types/DRMTypes';
@@ -0,0 +1 @@
1
+ /c/Users/Webnexs/Documents/OfficeBackup/AI/VideoPlayer FrameWork/unified-video-framework/packages/web/src/drm
@@ -0,0 +1 @@
1
+ /c/Users/Webnexs/Documents/OfficeBackup/AI/VideoPlayer FrameWork/unified-video-framework/packages/web/src/drm