@halibegic/react-video-player 0.0.0
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/LICENSE +21 -0
- package/README.md +55 -0
- package/dist/components/hooks/use-debounce.d.ts +2 -0
- package/dist/components/live-player.d.ts +6 -0
- package/dist/components/player/player-provider.d.ts +3 -0
- package/dist/components/player/player-tech.d.ts +7 -0
- package/dist/components/player/tech/player-dash-tech.d.ts +6 -0
- package/dist/components/player/tech/player-hls-tech.d.ts +6 -0
- package/dist/components/player/ui/player-fullscreen.d.ts +3 -0
- package/dist/components/player/ui/player-loading.d.ts +4 -0
- package/dist/components/ui/button.d.ts +12 -0
- package/dist/components/ui/slider.d.ts +4 -0
- package/dist/components/ui/spinner.d.ts +3 -0
- package/dist/components/vod-player.d.ts +6 -0
- package/dist/config/player.d.ts +5 -0
- package/dist/index-UZF7kuPZ.js +3642 -0
- package/dist/index-UZF7kuPZ.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/player-dash-tech-DDeyebd7.js +50 -0
- package/dist/player-dash-tech-DDeyebd7.js.map +1 -0
- package/dist/player-hls-tech-a87iikPB.js +29 -0
- package/dist/player-hls-tech-a87iikPB.js.map +1 -0
- package/dist/react-video-player.es.js +6 -0
- package/dist/react-video-player.es.js.map +1 -0
- package/dist/react-video-player.umd.js +58 -0
- package/dist/react-video-player.umd.js.map +1 -0
- package/dist/stores/player-store.d.ts +75 -0
- package/dist/utils/cn.d.ts +2 -0
- package/dist/utils/date-time.d.ts +2 -0
- package/dist/utils/device.d.ts +2 -0
- package/dist/utils/fullscreen.d.ts +19 -0
- package/dist/utils/player.d.ts +3 -0
- package/package.json +87 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { PropsWithChildren, RefObject } from 'react';
|
|
2
|
+
type PlaybackState = {
|
|
3
|
+
currentTime: number;
|
|
4
|
+
duration: number;
|
|
5
|
+
isEnded: boolean;
|
|
6
|
+
isLoading: boolean;
|
|
7
|
+
isLoop: boolean;
|
|
8
|
+
isMetaLoaded: boolean;
|
|
9
|
+
isPlaying: boolean;
|
|
10
|
+
isReady: boolean;
|
|
11
|
+
isStarted: boolean;
|
|
12
|
+
pauseTime: number;
|
|
13
|
+
seekTime: number;
|
|
14
|
+
startTime: number;
|
|
15
|
+
volume: number;
|
|
16
|
+
};
|
|
17
|
+
type PlaybackActions = {
|
|
18
|
+
destroy: () => void;
|
|
19
|
+
handleDurationChange: () => void;
|
|
20
|
+
handleEnd: () => void;
|
|
21
|
+
handleLoadedMetadata: () => void;
|
|
22
|
+
handleLoadStart: () => void;
|
|
23
|
+
handlePause: () => void;
|
|
24
|
+
handlePlay: () => void;
|
|
25
|
+
handlePlaying: () => void;
|
|
26
|
+
handleSeeked: () => void;
|
|
27
|
+
handleSeeking: () => void;
|
|
28
|
+
handleTimeUpdate: () => void;
|
|
29
|
+
handleWaiting: () => void;
|
|
30
|
+
pause: () => void;
|
|
31
|
+
pauseTimeDiff: () => number;
|
|
32
|
+
play: () => void;
|
|
33
|
+
seek: (time: number) => void;
|
|
34
|
+
setIsLoading: (isLoading: boolean) => void;
|
|
35
|
+
setIsLoop: (isLoop: boolean) => void;
|
|
36
|
+
setStartTime: (startTime: number) => void;
|
|
37
|
+
setVolume: (volume: number) => void;
|
|
38
|
+
stop: () => void;
|
|
39
|
+
};
|
|
40
|
+
type PlaybackSlice = PlaybackState & PlaybackActions;
|
|
41
|
+
type IdleLockState = {
|
|
42
|
+
idleLocks: Set<string>;
|
|
43
|
+
};
|
|
44
|
+
type IdleLockActions = {
|
|
45
|
+
addIdleLock: (lockId: string) => void;
|
|
46
|
+
removeIdleLock: (lockId: string) => void;
|
|
47
|
+
};
|
|
48
|
+
type IdleLockSlice = IdleLockState & IdleLockActions;
|
|
49
|
+
type FullscreenState = {
|
|
50
|
+
isFullscreen: boolean;
|
|
51
|
+
isFullscreenReady: boolean;
|
|
52
|
+
};
|
|
53
|
+
type FullscreenActions = {
|
|
54
|
+
exitFullscreen: () => void;
|
|
55
|
+
requestFullscreen: () => void;
|
|
56
|
+
setIsFullscreen: (isFullscreen: boolean) => void;
|
|
57
|
+
setIsFullscreenReady: (isFullscreenReady: boolean) => void;
|
|
58
|
+
};
|
|
59
|
+
type FullscreenSlice = FullscreenState & FullscreenActions;
|
|
60
|
+
type AssetState = {
|
|
61
|
+
url: string;
|
|
62
|
+
};
|
|
63
|
+
type AssetActions = {
|
|
64
|
+
setURL: (url: string) => void;
|
|
65
|
+
};
|
|
66
|
+
type AssetSlice = AssetState & AssetActions;
|
|
67
|
+
type RefState = {
|
|
68
|
+
techRef: RefObject<HTMLVideoElement | null>;
|
|
69
|
+
containerRef: RefObject<HTMLDivElement | null>;
|
|
70
|
+
};
|
|
71
|
+
type RefSlice = RefState;
|
|
72
|
+
type PlayerStore = PlaybackSlice & IdleLockSlice & FullscreenSlice & AssetSlice & RefSlice;
|
|
73
|
+
declare const PlayerStoreProvider: ({ children }: PropsWithChildren) => import("react/jsx-runtime").JSX.Element;
|
|
74
|
+
declare const usePlayerStore: <T>(selector: (state: PlayerStore) => T) => T;
|
|
75
|
+
export { PlayerStoreProvider, usePlayerStore };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
type DocumentWithFullscreen = Document & {
|
|
2
|
+
mozFullScreenElement?: Element;
|
|
3
|
+
msFullscreenElement?: Element;
|
|
4
|
+
webkitFullscreenElement?: Element;
|
|
5
|
+
msExitFullscreen?: () => void;
|
|
6
|
+
mozCancelFullScreen?: () => void;
|
|
7
|
+
webkitExitFullscreen?: () => void;
|
|
8
|
+
};
|
|
9
|
+
type DocumentElementWithFullscreen = HTMLElement & {
|
|
10
|
+
msRequestFullscreen?: () => void;
|
|
11
|
+
mozRequestFullScreen?: () => void;
|
|
12
|
+
webkitRequestFullScreen?: () => void;
|
|
13
|
+
webkitEnterFullScreen?: () => void;
|
|
14
|
+
};
|
|
15
|
+
declare function isActiveFullscreen(): boolean;
|
|
16
|
+
declare function requestFullscreen(element: DocumentElementWithFullscreen): void;
|
|
17
|
+
declare function exitFullscreen(doc: DocumentWithFullscreen): void;
|
|
18
|
+
declare function onFullscreenChange(element: HTMLElement, handleFullscreen: (event: Event) => unknown): () => void;
|
|
19
|
+
export { exitFullscreen, isActiveFullscreen, onFullscreenChange, requestFullscreen, };
|
package/package.json
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@halibegic/react-video-player",
|
|
3
|
+
"description": "A React video player library with HLS.js/Dash.js support for VOD and Live streaming",
|
|
4
|
+
"version": "0.0.0",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"react",
|
|
8
|
+
"video-player",
|
|
9
|
+
"hls",
|
|
10
|
+
"hls.js",
|
|
11
|
+
"dash",
|
|
12
|
+
"dash.js",
|
|
13
|
+
"video-player",
|
|
14
|
+
"streaming",
|
|
15
|
+
"vod",
|
|
16
|
+
"live",
|
|
17
|
+
"tailwindcss"
|
|
18
|
+
],
|
|
19
|
+
"homepage": "https://github.com/halibegic/react-video-player#readme",
|
|
20
|
+
"author": "halibegic",
|
|
21
|
+
"bugs": {
|
|
22
|
+
"url": "https://github.com/halibegic/react-video-player/issues"
|
|
23
|
+
},
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "git+https://github.com/halibegic/react-video-player.git"
|
|
27
|
+
},
|
|
28
|
+
"type": "module",
|
|
29
|
+
"main": "./dist/react-video-player.umd.js",
|
|
30
|
+
"module": "./dist/react-video-player.es.js",
|
|
31
|
+
"types": "./dist/index.d.ts",
|
|
32
|
+
"exports": {
|
|
33
|
+
".": {
|
|
34
|
+
"types": "./dist/index.d.ts",
|
|
35
|
+
"import": "./dist/react-video-player.es.js",
|
|
36
|
+
"require": "./dist/react-video-player.umd.js"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"files": [
|
|
40
|
+
"dist",
|
|
41
|
+
"README.md",
|
|
42
|
+
"LICENSE"
|
|
43
|
+
],
|
|
44
|
+
"scripts": {
|
|
45
|
+
"dev": "vite",
|
|
46
|
+
"build": "vite build --config vite.lib.config.ts",
|
|
47
|
+
"lint": "eslint .",
|
|
48
|
+
"preview": "vite preview",
|
|
49
|
+
"prepublishOnly": "npm run build"
|
|
50
|
+
},
|
|
51
|
+
"peerDependencies": {
|
|
52
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
53
|
+
"react-dom": "^18.0.0 || ^19.0.0"
|
|
54
|
+
},
|
|
55
|
+
"dependencies": {
|
|
56
|
+
"@radix-ui/react-slider": "^1.3.6",
|
|
57
|
+
"@radix-ui/react-slot": "^1.2.3",
|
|
58
|
+
"@tailwindcss/vite": "^4.1.12",
|
|
59
|
+
"class-variance-authority": "^0.7.1",
|
|
60
|
+
"clsx": "^2.1.1",
|
|
61
|
+
"dashjs": "^5.0.3",
|
|
62
|
+
"hls.js": "^1.6.11",
|
|
63
|
+
"lucide-react": "^0.542.0",
|
|
64
|
+
"tailwind-merge": "^3.3.1",
|
|
65
|
+
"tailwindcss": "^4.1.12",
|
|
66
|
+
"zustand": "^5.0.8"
|
|
67
|
+
},
|
|
68
|
+
"devDependencies": {
|
|
69
|
+
"@eslint/js": "^9.34.0",
|
|
70
|
+
"@types/node": "^24.3.0",
|
|
71
|
+
"@types/react": "^19.1.12",
|
|
72
|
+
"@types/react-dom": "^19.1.9",
|
|
73
|
+
"@vitejs/plugin-react": "^5.0.2",
|
|
74
|
+
"eslint": "^9.34.0",
|
|
75
|
+
"eslint-plugin-react-hooks": "^5.2.0",
|
|
76
|
+
"eslint-plugin-react-refresh": "^0.4.20",
|
|
77
|
+
"globals": "^16.3.0",
|
|
78
|
+
"tw-animate-css": "^1.3.7",
|
|
79
|
+
"typescript": "~5.9.2",
|
|
80
|
+
"typescript-eslint": "^8.42.0",
|
|
81
|
+
"vite": "^7.1.4",
|
|
82
|
+
"vite-plugin-dts": "^4.5.4"
|
|
83
|
+
},
|
|
84
|
+
"publishConfig": {
|
|
85
|
+
"access": "public"
|
|
86
|
+
}
|
|
87
|
+
}
|