unified-video-framework 1.3.2 → 1.3.4

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/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Unified Video Player Framework
1
+ # Unified Video Player Framework ( ⚠🚧 Don't use this Package this is Under Developement 🏗 )
2
2
 
3
3
  A comprehensive cross-platform video player framework that provides a unified API for building video applications across all major platforms.
4
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unified-video-framework",
3
- "version": "1.3.2",
3
+ "version": "1.3.4",
4
4
  "description": "Cross-platform video player framework supporting iOS, Android, Web, Smart TVs (Samsung/LG), Roku, and more",
5
5
  "main": "packages/core/dist/index.js",
6
6
  "types": "packages/core/dist/index.d.ts",
@@ -24,14 +24,26 @@
24
24
  "require": "./packages/react-native/dist/index.js",
25
25
  "import": "./packages/react-native/dist/index.js",
26
26
  "types": "./packages/react-native/dist/index.d.ts"
27
+ },
28
+ "./packages/web/dist": {
29
+ "require": "./packages/web/dist/index.js",
30
+ "import": "./packages/web/dist/index.js",
31
+ "types": "./packages/web/dist/index.d.ts"
32
+ },
33
+ "./packages/core/dist": {
34
+ "require": "./packages/core/dist/index.js",
35
+ "import": "./packages/core/dist/index.js",
36
+ "types": "./packages/core/dist/index.d.ts"
27
37
  }
28
38
  },
29
39
  "files": [
30
40
  "index.js",
31
41
  "index.d.ts",
42
+ "unified-video-framework.d.ts",
32
43
  "packages/*/dist/**/*",
33
44
  "packages/*/src/**/*",
34
45
  "packages/*/package.json",
46
+ "scripts/fix-imports.js",
35
47
  "README.md",
36
48
  "LICENSE",
37
49
  "INSTALLATION.md"
@@ -44,7 +56,7 @@
44
56
  ],
45
57
  "scripts": {
46
58
  "bootstrap": "lerna bootstrap --legacy-peer-deps",
47
- "build": "npm run build:core && npm run build:web && npm run build:rental-api",
59
+ "build": "npm run build:core && npm run build:web && npm run build:react-native && npm run fix-imports",
48
60
  "build:core": "cd packages/core && npm run build",
49
61
  "build:web": "cd packages/web && npm run build",
50
62
  "build:rental-api": "cd apps/rental-api && npm run build",
@@ -52,17 +64,19 @@
52
64
  "dev:rental-api": "cd apps/rental-api && npm run dev",
53
65
  "build:react-native": "cd packages/react-native && npm run build",
54
66
  "build:enact": "cd packages/enact && npm run build",
55
- "build:all": "lerna run build --stream",
67
+ "build:all": "lerna run build --stream && npm run fix-imports",
56
68
  "clean": "lerna clean",
57
69
  "test": "jest",
58
70
  "test:coverage": "jest --coverage",
59
71
  "test:watch": "jest --watch",
60
72
  "lint": "eslint . --ext .ts,.tsx,.js,.jsx",
61
73
  "type-check": "tsc --noEmit",
62
- "prepublishOnly": "npm run build",
74
+ "prepublishOnly": "npm run build:publish",
63
75
  "dev": "lerna run dev --parallel",
64
76
  "serve:demo": "node server.js",
65
- "docs": "typedoc --out docs packages/core/src"
77
+ "docs": "typedoc --out docs packages/core/src",
78
+ "fix-imports": "node scripts/fix-imports.js",
79
+ "build:publish": "npm run build:core && npm run build:web && npm run fix-imports"
66
80
  },
67
81
  "devDependencies": {
68
82
  "@types/node": "^18.0.0",
@@ -1 +1 @@
1
- {"version":3,"file":"VideoPlayerFactory.d.ts","sourceRoot":"","sources":["../src/VideoPlayerFactory.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEvE,MAAM,MAAM,QAAQ,GAChB,KAAK,GACL,KAAK,GACL,SAAS,GACT,OAAO,GACP,OAAO,GACP,MAAM,GACN,WAAW,GACX,SAAS,GACT,SAAS,CAAC;AAEd,qBAAa,kBAAkB;WAIhB,MAAM,CACjB,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,WAAW,GAAG,MAAM,GAAG,GAAG,EACrC,MAAM,CAAC,EAAE,YAAY,GACpB,OAAO,CAAC,YAAY,CAAC;IAqExB,MAAM,CAAC,cAAc,IAAI,QAAQ;WA2CpB,wBAAwB,CACnC,SAAS,EAAE,WAAW,GAAG,MAAM,GAAG,GAAG,EACrC,MAAM,CAAC,EAAE,YAAY,GACpB,OAAO,CAAC,YAAY,CAAC;CAIzB"}
1
+ {"version":3,"file":"VideoPlayerFactory.d.ts","sourceRoot":"","sources":["../src/VideoPlayerFactory.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEvE,MAAM,MAAM,QAAQ,GAChB,KAAK,GACL,KAAK,GACL,SAAS,GACT,OAAO,GACP,OAAO,GACP,MAAM,GACN,WAAW,GACX,SAAS,GACT,SAAS,CAAC;AAEd,qBAAa,kBAAkB;WAIhB,MAAM,CACjB,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,WAAW,GAAG,MAAM,GAAG,GAAG,EACrC,MAAM,CAAC,EAAE,YAAY,GACpB,OAAO,CAAC,YAAY,CAAC;IAqExB,MAAM,CAAC,cAAc,IAAI,QAAQ;WA+CpB,wBAAwB,CACnC,SAAS,EAAE,WAAW,GAAG,MAAM,GAAG,GAAG,EACrC,MAAM,CAAC,EAAE,YAAY,GACpB,OAAO,CAAC,YAAY,CAAC;CAIzB"}
@@ -59,8 +59,12 @@ class VideoPlayerFactory {
59
59
  }
60
60
  static detectPlatform() {
61
61
  if (typeof global !== 'undefined' && global.nativeCallSyncHook) {
62
- const { Platform } = require('react-native');
63
- return Platform.OS;
62
+ try {
63
+ const { Platform } = require('react-native');
64
+ return Platform.OS;
65
+ }
66
+ catch (e) {
67
+ }
64
68
  }
65
69
  if (typeof window !== 'undefined') {
66
70
  const userAgent = window.navigator.userAgent.toLowerCase();
@@ -1 +1 @@
1
- {"version":3,"file":"VideoPlayerFactory.js","sourceRoot":"","sources":["../src/VideoPlayerFactory.ts"],"names":[],"mappings":";;;AAiBA,MAAa,kBAAkB;IAI7B,MAAM,CAAC,KAAK,CAAC,MAAM,CACjB,QAAkB,EAClB,SAAqC,EACrC,MAAqB;QAKrB,QAAQ,QAAQ,EAAE;YAChB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AAC;gBAAE,OAAO,OAAO,CAAC;YAChD,IAAI,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC;gBAAE,OAAO,MAAM,CAAC;YAG9C,IAAI,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;gBAC7D,OAAO,WAAW,CAAC;aACpB;YAGD,IAAI,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC;gBAAE,OAAO,SAAS,CAAC;YAGpD,IAAI,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC;gBAAE,OAAO,SAAS,CAAC;YAGpD,OAAO,KAAK,CAAC;SACd;QAGD,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE;YAC/E,OAAO,KAAK,CAAC;SACd;QAED,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;IAC/C,CAAC;IAKD,MAAM,CAAC,KAAK,CAAC,wBAAwB,CACnC,SAAqC,EACrC,MAAqB;QAErB,MAAM,QAAQ,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;QACvC,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;IAClD,CAAC;CACF;AAnID,gDAmIC"}
@@ -96,8 +96,12 @@ export class VideoPlayerFactory {
96
96
  // Check if running in React Native
97
97
  if (typeof global !== 'undefined' && (global as any).nativeCallSyncHook) {
98
98
  // React Native environment
99
- const { Platform } = require('react-native');
100
- return Platform.OS as Platform;
99
+ try {
100
+ const { Platform } = require('react-native');
101
+ return Platform.OS as Platform;
102
+ } catch (e) {
103
+ // React Native not available, fall through to other checks
104
+ }
101
105
  }
102
106
 
103
107
  // Check if running in browser
@@ -1,16 +1,7 @@
1
- import React from 'react';
2
- import { ViewStyle } from 'react-native';
3
1
  import Video from 'react-native-video';
4
- import { IVideoPlayer, PlayerConfig, PlayerError } from '@unified-video/core';
5
- interface ReactNativePlayerProps {
6
- style?: ViewStyle;
7
- config?: PlayerConfig;
8
- onReady?: () => void;
9
- onError?: (error: PlayerError) => void;
10
- }
2
+ import { IVideoPlayer } from '@unified-video/core';
11
3
  export interface ReactNativePlayerRef extends IVideoPlayer {
12
4
  getVideoRef: () => Video | null;
13
5
  }
14
- export declare const ReactNativePlayer: React.ForwardRefExoticComponent<ReactNativePlayerProps & React.RefAttributes<ReactNativePlayerRef>>;
15
- export {};
6
+ export declare const ReactNativePlayer: any;
16
7
  //# sourceMappingURL=ReactNativePlayer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ReactNativePlayer.d.ts","sourceRoot":"","sources":["../src/ReactNativePlayer.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAoF,MAAM,OAAO,CAAC;AACzG,OAAO,EAA8B,SAAS,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,KAUN,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,YAAY,EAEZ,YAAY,EAIZ,WAAW,EAEZ,MAAM,qBAAqB,CAAC;AAG7B,UAAU,sBAAsB;IAC9B,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;CACxC;AAED,MAAM,WAAW,oBAAqB,SAAQ,YAAY;IACxD,WAAW,EAAE,MAAM,KAAK,GAAG,IAAI,CAAC;CACjC;AAED,eAAO,MAAM,iBAAiB,qGAgX7B,CAAC"}
1
+ {"version":3,"file":"ReactNativePlayer.d.ts","sourceRoot":"","sources":["../src/ReactNativePlayer.tsx"],"names":[],"mappings":"AAMA,OAAO,KAUN,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,YAAY,EAQb,MAAM,qBAAqB,CAAC;AAU7B,MAAM,WAAW,oBAAqB,SAAQ,YAAY;IACxD,WAAW,EAAE,MAAM,KAAK,GAAG,IAAI,CAAC;CACjC;AAED,eAAO,MAAM,iBAAiB,KAgX7B,CAAC"}
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.WebPlayer = void 0;
27
- const core_1 = require("@unified-video/core");
27
+ const core_1 = require("../../core/dist");
28
28
  class WebPlayer extends core_1.BasePlayer {
29
29
  constructor() {
30
30
  super(...arguments);
@@ -1,5 +1,6 @@
1
1
  export * from '@unified-video/core';
2
2
  export { WebPlayer } from './WebPlayer';
3
3
  export { WebPlayerView } from './react/WebPlayerView';
4
+ export { SecureVideoPlayer } from './SecureVideoPlayer';
4
5
  export declare const VERSION = "1.0.0";
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,cAAc,qBAAqB,CAAC;AAGpC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAGtD,eAAO,MAAM,OAAO,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,cAAc,qBAAqB,CAAC;AAGpC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAGxD,eAAO,MAAM,OAAO,UAAU,CAAC"}
@@ -14,11 +14,13 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.VERSION = exports.WebPlayerView = exports.WebPlayer = void 0;
18
- __exportStar(require("@unified-video/core"), exports);
17
+ exports.VERSION = exports.SecureVideoPlayer = exports.WebPlayerView = exports.WebPlayer = void 0;
18
+ __exportStar(require("../../core/dist"), exports);
19
19
  var WebPlayer_1 = require("./WebPlayer");
20
20
  Object.defineProperty(exports, "WebPlayer", { enumerable: true, get: function () { return WebPlayer_1.WebPlayer; } });
21
21
  var WebPlayerView_1 = require("./react/WebPlayerView");
22
22
  Object.defineProperty(exports, "WebPlayerView", { enumerable: true, get: function () { return WebPlayerView_1.WebPlayerView; } });
23
+ var SecureVideoPlayer_1 = require("./SecureVideoPlayer");
24
+ Object.defineProperty(exports, "SecureVideoPlayer", { enumerable: true, get: function () { return SecureVideoPlayer_1.SecureVideoPlayer; } });
23
25
  exports.VERSION = '1.0.0';
24
26
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAMA,sDAAoC;AAGpC,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAClB,uDAAsD;AAA7C,8GAAA,aAAa,OAAA;AAGT,QAAA,OAAO,GAAG,OAAO,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAMA,sDAAoC;AAGpC,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAClB,uDAAsD;AAA7C,8GAAA,aAAa,OAAA;AACtB,yDAAwD;AAA/C,sHAAA,iBAAiB,OAAA;AAGb,QAAA,OAAO,GAAG,OAAO,CAAC"}
@@ -16,7 +16,7 @@
16
16
  "lint": "eslint src --ext .ts,.tsx,.js"
17
17
  },
18
18
  "dependencies": {
19
- "@unified-video/core": "^1.0.0"
19
+ "@unified-video/core": "file:../core"
20
20
  },
21
21
  "peerDependencies": {
22
22
  "dashjs": "^4.0.0",
@@ -9,6 +9,7 @@ export * from '@unified-video/core';
9
9
  // Export web player implementation
10
10
  export { WebPlayer } from './WebPlayer';
11
11
  export { WebPlayerView } from './react/WebPlayerView';
12
+ export { SecureVideoPlayer } from './SecureVideoPlayer';
12
13
 
13
14
  // Version
14
15
  export const VERSION = '1.0.0';
@@ -0,0 +1,59 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+
6
+ /**
7
+ * This script fixes the import statements in the compiled JavaScript files
8
+ * to use relative paths instead of package names for internal dependencies.
9
+ */
10
+
11
+ function fixImports(filePath) {
12
+ let content = fs.readFileSync(filePath, 'utf8');
13
+
14
+ // Replace @unified-video/core imports with relative paths
15
+ if (filePath.includes(path.join('packages', 'web', 'dist'))) {
16
+ content = content.replace(
17
+ /require\(["']@unified-video\/core["']\)/g,
18
+ 'require("../../core/dist")'
19
+ );
20
+ } else if (filePath.includes(path.join('packages', 'react-native', 'dist'))) {
21
+ content = content.replace(
22
+ /require\(["']@unified-video\/core["']\)/g,
23
+ 'require("../../core/dist")'
24
+ );
25
+ }
26
+
27
+ fs.writeFileSync(filePath, content, 'utf8');
28
+ }
29
+
30
+ function processDirectory(dir) {
31
+ const files = fs.readdirSync(dir);
32
+
33
+ files.forEach(file => {
34
+ const filePath = path.join(dir, file);
35
+ const stat = fs.statSync(filePath);
36
+
37
+ if (stat.isDirectory()) {
38
+ processDirectory(filePath);
39
+ } else if (file.endsWith('.js')) {
40
+ console.log(`Fixing imports in: ${filePath}`);
41
+ fixImports(filePath);
42
+ }
43
+ });
44
+ }
45
+
46
+ // Fix imports in web and react-native packages
47
+ const packagesDir = path.join(__dirname, '..', 'packages');
48
+
49
+ console.log('Fixing import statements in compiled files...');
50
+
51
+ if (fs.existsSync(path.join(packagesDir, 'web', 'dist'))) {
52
+ processDirectory(path.join(packagesDir, 'web', 'dist'));
53
+ }
54
+
55
+ if (fs.existsSync(path.join(packagesDir, 'react-native', 'dist'))) {
56
+ processDirectory(path.join(packagesDir, 'react-native', 'dist'));
57
+ }
58
+
59
+ console.log('Import fixes complete!');
@@ -0,0 +1,17 @@
1
+ // Type definitions for unified-video-framework
2
+
3
+ declare module 'unified-video-framework' {
4
+ export * from './packages/core/dist';
5
+ }
6
+
7
+ declare module 'unified-video-framework/web' {
8
+ export * from './packages/web/dist';
9
+ }
10
+
11
+ declare module 'unified-video-framework/core' {
12
+ export * from './packages/core/dist';
13
+ }
14
+
15
+ declare module 'unified-video-framework/react-native' {
16
+ export * from './packages/react-native/dist';
17
+ }
@@ -1,84 +0,0 @@
1
- # UnifiedVideoPlayer (iOS SDK)
2
-
3
- A unified iOS video player SDK with:
4
- - HLS playback (AVPlayer)
5
- - FairPlay DRM (SPC/CKC)
6
- - Subtitles/audio track selection (AVMediaSelection)
7
- - Picture-in-Picture (AVPictureInPictureController)
8
- - AirPlay (AVRoutePickerView)
9
- - Remote Command Center + Now Playing (lock screen controls)
10
- - Background audio (AVAudioSession)
11
-
12
- ## Installation
13
-
14
- ### CocoaPods
15
- 1) Ensure this SDK is in a public Git repository. Update the podspec `s.source` to point at that repo and tag.
16
- 2) In your Podfile:
17
- ```ruby
18
- platform :ios, '13.0'
19
- use_frameworks!
20
-
21
- target 'YourApp' do
22
- pod 'UnifiedVideoPlayer', :git => 'https://github.com/yourcompany/unified-video-ios.git', :tag => '1.0.0'
23
- end
24
- ```
25
- 3) Run:
26
- ```bash
27
- pod install
28
- ```
29
-
30
- ### Swift Package Manager
31
- Add the package at the repository URL or use Add Local Package pointing to `packages/ios`.
32
-
33
- ## Quick Start
34
- ```swift
35
- import UnifiedVideoPlayer
36
-
37
- let containerView = UIView(frame: .zero)
38
- let player = UnifiedVideoPlayer()
39
- let config = PlayerConfiguration()
40
- config.autoPlay = true
41
-
42
- player.initialize(container: containerView, configuration: config)
43
-
44
- let source = MediaSource(url: "https://example.com/stream.m3u8")
45
- source.metadata = ["title": "Demo Stream"]
46
- player.onReady = { print("ready") }
47
- player.onQualityChange = { br in print("bitrate: \(br)") }
48
-
49
- player.load(source: source)
50
- ```
51
-
52
- ### FairPlay DRM
53
- ```swift
54
- let drm = DRMConfiguration(type: "fairplay", licenseUrl: "https://license.example.com/fps")
55
- drm.certificateUrl = "https://license.example.com/cert"
56
- drm.headers = ["X-Tenant-ID": "default"]
57
-
58
- let source = MediaSource(url: "https://cdn.example.com/protected/playlist.m3u8")
59
- source.drm = drm
60
- player.load(source: source)
61
- ```
62
-
63
- ### Tracks
64
- ```swift
65
- let audios = player.audioTracks() // [String]
66
- let subs = player.subtitleTracks() // [String]
67
- player.selectAudioTrack(index: 0)
68
- player.selectSubtitleTrack(index: -1) // off
69
- ```
70
-
71
- ### PiP & AirPlay
72
- ```swift
73
- player.startPictureInPicture()
74
- player.stopPictureInPicture()
75
- let airPlay = player.makeAirPlayPickerView()
76
- ```
77
-
78
- ## Capabilities
79
- - Enable Background Modes > Audio
80
- - For DRM endpoints, configure ATS exceptions if necessary.
81
-
82
- ## License
83
- MIT
84
-
@@ -1,63 +0,0 @@
1
- import { VideoPlayer } from '@video-framework/core/src/VideoPlayer';
2
- import { VideoSource, Quality, SubtitleTrack, AudioTrack, DRMConfig, VideoPlayerConfig, TimeRanges } from '@video-framework/core/src/interfaces';
3
- export declare class HTML5Player extends VideoPlayer {
4
- private videoElement;
5
- private container;
6
- private hls?;
7
- private dash?;
8
- private qualities;
9
- private currentQuality;
10
- private subtitleTracks;
11
- private audioTracks;
12
- private isInitialized;
13
- constructor(container: HTMLElement, config?: VideoPlayerConfig);
14
- private createVideoElement;
15
- private setupEventListeners;
16
- load(source: VideoSource): Promise<void>;
17
- private isHLS;
18
- private isDASH;
19
- private loadHLS;
20
- private loadDASH;
21
- private loadSubtitles;
22
- play(): Promise<void>;
23
- pause(): void;
24
- stop(): void;
25
- seek(position: number): void;
26
- setVolume(volume: number): void;
27
- setPlaybackRate(rate: number): void;
28
- getCurrentTime(): number;
29
- getDuration(): number;
30
- getVolume(): number;
31
- getPlaybackRate(): number;
32
- isMuted(): boolean;
33
- setMuted(muted: boolean): void;
34
- getAvailableQualities(): Quality[];
35
- getCurrentQuality(): Quality | null;
36
- setQuality(quality: Quality): void;
37
- enableAutoQuality(enabled: boolean): void;
38
- getSubtitleTracks(): SubtitleTrack[];
39
- getCurrentSubtitleTrack(): SubtitleTrack | null;
40
- setSubtitleTrack(track: SubtitleTrack | null): void;
41
- getAudioTracks(): AudioTrack[];
42
- getCurrentAudioTrack(): AudioTrack | null;
43
- setAudioTrack(track: AudioTrack): void;
44
- enterFullscreen(): void;
45
- exitFullscreen(): void;
46
- isFullscreen(): boolean;
47
- enterPictureInPicture(): void;
48
- exitPictureInPicture(): void;
49
- isPictureInPicture(): boolean;
50
- getBufferedRanges(): TimeRanges;
51
- getSeekableRanges(): TimeRanges;
52
- getBandwidth(): number;
53
- getNetworkState(): number;
54
- getVideoWidth(): number;
55
- getVideoHeight(): number;
56
- getDroppedFrames(): number;
57
- getDecodedFrames(): number;
58
- protected applyConfig(): void;
59
- protected configureDRM(drmConfig: DRMConfig): Promise<void>;
60
- private cleanupStreamingLibraries;
61
- destroy(): void;
62
- }
63
- //# sourceMappingURL=HTML5Player.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"HTML5Player.d.ts","sourceRoot":"","sources":["../src/HTML5Player.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AACpE,OAAO,EACL,WAAW,EAEX,OAAO,EACP,aAAa,EACb,UAAU,EACV,SAAS,EACT,iBAAiB,EACjB,UAAU,EACX,MAAM,sCAAsC,CAAC;AAI9C,qBAAa,WAAY,SAAQ,WAAW;IAC1C,OAAO,CAAC,YAAY,CAAmB;IACvC,OAAO,CAAC,SAAS,CAAc;IAC/B,OAAO,CAAC,GAAG,CAAC,CAAM;IAClB,OAAO,CAAC,IAAI,CAAC,CAA0B;IACvC,OAAO,CAAC,SAAS,CAAiB;IAClC,OAAO,CAAC,cAAc,CAAwB;IAC9C,OAAO,CAAC,cAAc,CAAuB;I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IAAI;IAMtB,YAAY,IAAI,OAAO;IAKvB,qBAAqB,IAAI,IAAI;IAM7B,oBAAoB,IAAI,IAAI;IAM5B,kBAAkB,IAAI,OAAO;IAK7B,iBAAiB,IAAI,UAAU;IAI/B,iBAAiB,IAAI,UAAU;IAK/B,YAAY,IAAI,MAAM;IAStB,eAAe,IAAI,MAAM;IAKzB,aAAa,IAAI,MAAM;IAIvB,cAAc,IAAI,MAAM;IAIxB,gBAAgB,IAAI,MAAM;IAK1B,gBAAgB,IAAI,MAAM;IAK1B,SAAS,CAAC,WAAW,IAAI,IAAI;cAeb,YAAY,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAMjE,OAAO,CAAC,yBAAyB;IAWjC,OAAO,IAAI,IAAI;CAUhB"}
@@ -1,447 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.HTML5Player = void 0;
7
- const VideoPlayer_1 = require("@video-framework/core/src/VideoPlayer");
8
- const interfaces_1 = require("@video-framework/core/src/interfaces");
9
- const hls_js_1 = __importDefault(require("hls.js"));
10
- const dashjs_1 = __importDefault(require("dashjs"));
11
- class HTML5Player extends VideoPlayer_1.VideoPlayer {
12
- constructor(container, config = {}) {
13
- super(config);
14
- this.qualities = [];
15
- this.currentQuality = null;
16
- this.subtitleTracks = [];
17
- this.audioTracks = [];
18
- this.isInitialized = false;
19
- this.container = container;
20
- this.videoElement = this.createVideoElement();
21
- this.setupEventListeners();
22
- this.applyConfig();
23
- }
24
- createVideoElement() {
25
- const video = document.createElement('video');
26
- video.style.width = '100%';
27
- video.style.height = '100%';
28
- video.style.backgroundColor = '#000';
29
- if (this.config.controls)
30
- video.controls = true;
31
- if (this.config.muted)
32
- video.muted = true;
33
- if (this.config.loop)
34
- video.loop = true;
35
- if (this.config.playsInline)
36
- video.playsInline = true;
37
- if (this.config.crossOrigin)
38
- video.crossOrigin = this.config.crossOrigin;
39
- this.container.appendChild(video);
40
- return video;
41
- }
42
- setupEventListeners() {
43
- this.videoElement.addEventListener('loadstart', () => {
44
- this.setState(interfaces_1.PlayerState.LOADING);
45
- this.emit('loadstart');
46
- });
47
- this.videoElement.addEventListener('loadedmetadata', () => {
48
- this.setState(interfaces_1.PlayerState.READY);
49
- this.emit('loadedmetadata');
50
- });
51
- this.videoElement.addEventListener('play', () => {
52
- this.setState(interfaces_1.PlayerState.PLAYING);
53
- this.emit('play');
54
- });
55
- this.videoElement.addEventListener('pause', () => {
56
- this.setState(interfaces_1.PlayerState.PAUSED);
57
- this.emit('pause');
58
- });
59
- this.videoElement.addEventListener('ended', () => {
60
- this.setState(interfaces_1.PlayerState.ENDED);
61
- this.emit('ended');
62
- });
63
- this.videoElement.addEventListener('error', (e) => {
64
- const error = {
65
- code: this.videoElement.error?.code.toString() || 'UNKNOWN',
66
- message: this.videoElement.error?.message || 'Unknown error',
67
- timestamp: Date.now(),
68
- fatal: true
69
- };
70
- this.handleError(error);
71
- });
72
- this.videoElement.addEventListener('timeupdate', () => {
73
- this.emit('timeupdate', {
74
- currentTime: this.videoElement.currentTime,
75
- duration: this.videoElement.duration
76
- });
77
- });
78
- this.videoElement.addEventListener('progress', () => {
79
- this.emit('progress', {
80
- buffered: this.getBufferedRanges(),
81
- currentTime: this.videoElement.currentTime
82
- });
83
- });
84
- this.videoElement.addEventListener('waiting', () => {
85
- this.setState(interfaces_1.PlayerState.BUFFERING);
86
- this.emit('waiting');
87
- });
88
- this.videoElement.addEventListener('canplay', () => {
89
- if (this.state === interfaces_1.PlayerState.BUFFERING) {
90
- this.setState(interfaces_1.PlayerState.PLAYING);
91
- }
92
- this.emit('canplay');
93
- });
94
- this.videoElement.addEventListener('volumechange', () => {
95
- this.emit('volumechange', {
96
- volume: this.videoElement.volume,
97
- muted: this.videoElement.muted
98
- });
99
- });
100
- }
101
- async load(source) {
102
- this.currentSource = source;
103
- this.cleanupStreamingLibraries();
104
- try {
105
- if (source.drm) {
106
- await this.configureDRM(source.drm);
107
- }
108
- if (this.isHLS(source)) {
109
- await this.loadHLS(source);
110
- }
111
- else if (this.isDASH(source)) {
112
- await this.loadDASH(source);
113
- }
114
- else {
115
- this.videoElement.src = source.url;
116
- this.videoElement.load();
117
- }
118
- if (source.subtitles) {
119
- this.loadSubtitles(source.subtitles);
120
- }
121
- this.isInitialized = true;
122
- if (this.config.autoPlay) {
123
- await this.play();
124
- }
125
- }
126
- catch (error) {
127
- console.error('Failed to load video:', error);
128
- throw error;
129
- }
130
- }
131
- isHLS(source) {
132
- return source.type === 'application/x-mpegURL' ||
133
- source.url.includes('.m3u8');
134
- }
135
- isDASH(source) {
136
- return source.type === 'application/dash+xml' ||
137
- source.url.includes('.mpd');
138
- }
139
- async loadHLS(source) {
140
- if (hls_js_1.default.isSupported()) {
141
- this.hls = new hls_js_1.default({
142
- startLevel: this.config.adaptiveBitrate?.startLevel || -1,
143
- autoStartLoad: true,
144
- debug: false
145
- });
146
- this.hls.loadSource(source.url);
147
- this.hls.attachMedia(this.videoElement);
148
- this.hls.on(hls_js_1.default.Events.MANIFEST_PARSED, (event, data) => {
149
- this.qualities = data.levels.map((level, index) => ({
150
- id: `level_${index}`,
151
- label: `${level.height}p`,
152
- height: level.height,
153
- width: level.width,
154
- bitrate: level.bitrate,
155
- frameRate: level.frameRate,
156
- codec: level.codecSet
157
- }));
158
- this.emit('ready');
159
- });
160
- this.hls.on(hls_js_1.default.Events.LEVEL_SWITCHED, (event, data) => {
161
- this.currentQuality = this.qualities[data.level];
162
- this.emit('qualitychange', this.currentQuality);
163
- });
164
- this.hls.on(hls_js_1.default.Events.ERROR, (event, data) => {
165
- if (data.fatal) {
166
- const error = {
167
- code: data.type,
168
- message: data.details,
169
- timestamp: Date.now(),
170
- fatal: true,
171
- data: data
172
- };
173
- this.handleError(error);
174
- }
175
- });
176
- }
177
- else if (this.videoElement.canPlayType('application/vnd.apple.mpegurl')) {
178
- this.videoElement.src = source.url;
179
- this.videoElement.load();
180
- }
181
- }
182
- async loadDASH(source) {
183
- this.dash = dashjs_1.default.MediaPlayer().create();
184
- this.dash.initialize(this.videoElement, source.url, this.config.autoPlay || false);
185
- this.dash.updateSettings({
186
- streaming: {
187
- abr: {
188
- autoSwitchBitrate: {
189
- video: this.config.adaptiveBitrate?.autoLevelEnabled !== false
190
- }
191
- }
192
- }
193
- });
194
- this.dash.on(dashjs_1.default.MediaPlayer.events.STREAM_INITIALIZED, () => {
195
- const bitrateInfoList = this.dash.getBitrateInfoListFor('video');
196
- this.qualities = bitrateInfoList.map((info, index) => ({
197
- id: `bitrate_${index}`,
198
- label: `${info.height}p`,
199
- height: info.height,
200
- width: info.width,
201
- bitrate: info.bitrate,
202
- frameRate: 0,
203
- codec: ''
204
- }));
205
- this.emit('ready');
206
- });
207
- this.dash.on(dashjs_1.default.MediaPlayer.events.QUALITY_CHANGE_RENDERED, (e) => {
208
- if (e.mediaType === 'video') {
209
- this.currentQuality = this.qualities[e.newQuality];
210
- this.emit('qualitychange', this.currentQuality);
211
- }
212
- });
213
- this.dash.on(dashjs_1.default.MediaPlayer.events.ERROR, (e) => {
214
- const error = {
215
- code: e.error.code,
216
- message: e.error.message,
217
- timestamp: Date.now(),
218
- fatal: true,
219
- data: e
220
- };
221
- this.handleError(error);
222
- });
223
- }
224
- loadSubtitles(subtitles) {
225
- const existingTracks = this.videoElement.querySelectorAll('track');
226
- existingTracks.forEach(track => track.remove());
227
- subtitles.forEach((subtitle, index) => {
228
- const track = document.createElement('track');
229
- track.kind = subtitle.kind || 'subtitles';
230
- track.label = subtitle.label;
231
- track.srclang = subtitle.language;
232
- if (subtitle.url) {
233
- track.src = subtitle.url;
234
- }
235
- if (subtitle.default || index === 0) {
236
- track.default = true;
237
- }
238
- this.videoElement.appendChild(track);
239
- });
240
- this.subtitleTracks = subtitles;
241
- }
242
- async play() {
243
- try {
244
- await this.videoElement.play();
245
- }
246
- catch (error) {
247
- console.error('Play failed:', error);
248
- throw error;
249
- }
250
- }
251
- pause() {
252
- this.videoElement.pause();
253
- }
254
- stop() {
255
- this.pause();
256
- this.videoElement.currentTime = 0;
257
- }
258
- seek(position) {
259
- this.videoElement.currentTime = position;
260
- }
261
- setVolume(volume) {
262
- this.videoElement.volume = Math.max(0, Math.min(1, volume));
263
- }
264
- setPlaybackRate(rate) {
265
- this.videoElement.playbackRate = rate;
266
- }
267
- getCurrentTime() {
268
- return this.videoElement.currentTime;
269
- }
270
- getDuration() {
271
- return this.videoElement.duration || 0;
272
- }
273
- getVolume() {
274
- return this.videoElement.volume;
275
- }
276
- getPlaybackRate() {
277
- return this.videoElement.playbackRate;
278
- }
279
- isMuted() {
280
- return this.videoElement.muted;
281
- }
282
- setMuted(muted) {
283
- this.videoElement.muted = muted;
284
- }
285
- getAvailableQualities() {
286
- return this.qualities;
287
- }
288
- getCurrentQuality() {
289
- return this.currentQuality;
290
- }
291
- setQuality(quality) {
292
- const index = this.qualities.findIndex(q => q.id === quality.id);
293
- if (index >= 0) {
294
- if (this.hls) {
295
- this.hls.currentLevel = index;
296
- }
297
- else if (this.dash) {
298
- this.dash.setQualityFor('video', index);
299
- }
300
- }
301
- }
302
- enableAutoQuality(enabled) {
303
- if (this.hls) {
304
- this.hls.currentLevel = enabled ? -1 : this.hls.currentLevel;
305
- }
306
- else if (this.dash) {
307
- this.dash.updateSettings({
308
- streaming: {
309
- abr: {
310
- autoSwitchBitrate: {
311
- video: enabled
312
- }
313
- }
314
- }
315
- });
316
- }
317
- }
318
- getSubtitleTracks() {
319
- return this.subtitleTracks;
320
- }
321
- getCurrentSubtitleTrack() {
322
- const textTracks = this.videoElement.textTracks;
323
- for (let i = 0; i < textTracks.length; i++) {
324
- if (textTracks[i].mode === 'showing') {
325
- return this.subtitleTracks[i] || null;
326
- }
327
- }
328
- return null;
329
- }
330
- setSubtitleTrack(track) {
331
- const textTracks = this.videoElement.textTracks;
332
- for (let i = 0; i < textTracks.length; i++) {
333
- textTracks[i].mode = 'disabled';
334
- }
335
- if (track) {
336
- const index = this.subtitleTracks.findIndex(t => t.id === track.id);
337
- if (index >= 0 && textTracks[index]) {
338
- textTracks[index].mode = 'showing';
339
- }
340
- }
341
- }
342
- getAudioTracks() {
343
- return this.audioTracks;
344
- }
345
- getCurrentAudioTrack() {
346
- return this.audioTracks[0] || null;
347
- }
348
- setAudioTrack(track) {
349
- }
350
- enterFullscreen() {
351
- if (this.container.requestFullscreen) {
352
- this.container.requestFullscreen();
353
- }
354
- }
355
- exitFullscreen() {
356
- if (document.exitFullscreen) {
357
- document.exitFullscreen();
358
- }
359
- }
360
- isFullscreen() {
361
- return document.fullscreenElement === this.container;
362
- }
363
- enterPictureInPicture() {
364
- if (this.videoElement.requestPictureInPicture) {
365
- this.videoElement.requestPictureInPicture();
366
- }
367
- }
368
- exitPictureInPicture() {
369
- if (document.exitPictureInPicture) {
370
- document.exitPictureInPicture();
371
- }
372
- }
373
- isPictureInPicture() {
374
- return document.pictureInPictureElement === this.videoElement;
375
- }
376
- getBufferedRanges() {
377
- return this.videoElement.buffered;
378
- }
379
- getSeekableRanges() {
380
- return this.videoElement.seekable;
381
- }
382
- getBandwidth() {
383
- if (this.hls) {
384
- return this.hls.bandwidthEstimate || 0;
385
- }
386
- else if (this.dash) {
387
- return this.dash.getAverageThroughput('video') || 0;
388
- }
389
- return 0;
390
- }
391
- getNetworkState() {
392
- return this.videoElement.networkState;
393
- }
394
- getVideoWidth() {
395
- return this.videoElement.videoWidth;
396
- }
397
- getVideoHeight() {
398
- return this.videoElement.videoHeight;
399
- }
400
- getDroppedFrames() {
401
- const quality = this.videoElement.getVideoPlaybackQuality?.();
402
- return quality?.droppedVideoFrames || 0;
403
- }
404
- getDecodedFrames() {
405
- const quality = this.videoElement.getVideoPlaybackQuality?.();
406
- return quality?.totalVideoFrames || 0;
407
- }
408
- applyConfig() {
409
- if (this.config.controls !== undefined) {
410
- this.videoElement.controls = this.config.controls;
411
- }
412
- if (this.config.muted !== undefined) {
413
- this.videoElement.muted = this.config.muted;
414
- }
415
- if (this.config.loop !== undefined) {
416
- this.videoElement.loop = this.config.loop;
417
- }
418
- if (this.config.preload) {
419
- this.videoElement.preload = this.config.preload;
420
- }
421
- }
422
- async configureDRM(drmConfig) {
423
- console.log('DRM configuration:', drmConfig);
424
- }
425
- cleanupStreamingLibraries() {
426
- if (this.hls) {
427
- this.hls.destroy();
428
- this.hls = undefined;
429
- }
430
- if (this.dash) {
431
- this.dash.reset();
432
- this.dash = undefined;
433
- }
434
- }
435
- destroy() {
436
- this.cleanupStreamingLibraries();
437
- this.cleanup();
438
- if (this.videoElement) {
439
- this.videoElement.pause();
440
- this.videoElement.removeAttribute('src');
441
- this.videoElement.load();
442
- this.container.removeChild(this.videoElement);
443
- }
444
- }
445
- }
446
- exports.HTML5Player = HTML5Player;
447
- //# sourceMappingURL=HTML5Player.js.map
@@ -1,24 +0,0 @@
1
- import { PaywallConfig } from '@unified-video/core';
2
- export type PaywallControllerOptions = {
3
- getOverlayContainer: () => HTMLElement | null;
4
- onResume: () => void;
5
- onShow?: () => void;
6
- onClose?: () => void;
7
- };
8
- export declare class PaywallController {
9
- private config;
10
- private opts;
11
- private overlayEl;
12
- private gatewayStepEl;
13
- private popup;
14
- constructor(config: PaywallConfig | null, opts: PaywallControllerOptions);
15
- updateConfig(config: PaywallConfig | null): void;
16
- openOverlay(): void;
17
- closeOverlay(): void;
18
- private ensureOverlay;
19
- private showGateways;
20
- private openGateway;
21
- private startPolling;
22
- private onMessage;
23
- }
24
- //# sourceMappingURL=PaywallController.d.ts.map