unified-video-framework 1.3.3 → 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 +1 -1
- package/package.json +12 -1
- package/packages/core/dist/VideoPlayerFactory.d.ts.map +1 -1
- package/packages/core/dist/VideoPlayerFactory.js +6 -2
- package/packages/core/dist/VideoPlayerFactory.js.map +1 -1
- package/packages/core/src/VideoPlayerFactory.ts +6 -2
- package/packages/web/dist/index.d.ts +1 -0
- package/packages/web/dist/index.d.ts.map +1 -1
- package/packages/web/dist/index.js +3 -1
- package/packages/web/dist/index.js.map +1 -1
- package/packages/web/src/index.ts +1 -0
- package/unified-video-framework.d.ts +17 -0
- package/packages/web/dist/HTML5Player.d.ts +0 -63
- package/packages/web/dist/HTML5Player.d.ts.map +0 -1
- package/packages/web/dist/HTML5Player.js +0 -447
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.
|
|
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,11 +24,22 @@
|
|
|
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",
|
|
@@ -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;
|
|
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
|
-
|
|
63
|
-
|
|
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,KAAK,KAAK;gBAER,IAAI;oBACF,MAAM,SAAS,GAAG,MAAO,IAAI,CAAC,8BAA8B,CAAkB,CAAC;oBAC/E,IAAI,SAAS,EAAE,SAAS,EAAE;wBACxB,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC,SAAS,EAAE,CAAC;wBACzC,MAAM,MAAM,CAAC,UAAU,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;wBAC3C,OAAO,MAAM,CAAC;qBACf;iBAC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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
|
-
|
|
100
|
-
|
|
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,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;
|
|
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;
|
|
17
|
+
exports.VERSION = exports.SecureVideoPlayer = exports.WebPlayerView = exports.WebPlayer = void 0;
|
|
18
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;
|
|
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"}
|
|
@@ -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,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,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;IAC7C,OAAO,CAAC,WAAW,CAAoB;IACvC,OAAO,CAAC,aAAa,C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I;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
|