@zezosoft/react-player 0.0.8 → 0.0.10

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.
Files changed (45) hide show
  1. package/README.md +536 -146
  2. package/dist/VideoPlayer/VideoPlayer.d.ts +1 -0
  3. package/dist/VideoPlayer/components/AdOverlay.d.ts +10 -0
  4. package/dist/VideoPlayer/components/ErrorOverlay.d.ts +8 -0
  5. package/dist/VideoPlayer/components/Overlay.d.ts +4 -0
  6. package/dist/VideoPlayer/components/SubtitleOverlay.d.ts +7 -0
  7. package/dist/VideoPlayer/components/controls/BottomControls.d.ts +5 -0
  8. package/dist/VideoPlayer/components/controls/ControlsHeader.d.ts +5 -0
  9. package/dist/VideoPlayer/components/controls/MiddleControls.d.ts +3 -0
  10. package/dist/VideoPlayer/components/controls/VideoPlayerControls.d.ts +4 -0
  11. package/dist/VideoPlayer/components/controls/index.d.ts +4 -0
  12. package/dist/VideoPlayer/components/time-line/TimeLine.d.ts +21 -0
  13. package/dist/VideoPlayer/components/time-line/components/HoverTimeWithPreview.d.ts +16 -0
  14. package/dist/VideoPlayer/components/time-line/components/Thumb.d.ts +9 -0
  15. package/dist/VideoPlayer/components/time-line/components/TimeCodeItem.d.ts +21 -0
  16. package/dist/VideoPlayer/components/time-line/components/TimeCodes.d.ts +15 -0
  17. package/dist/VideoPlayer/components/time-line/utils/getEndTimeByIndex.d.ts +2 -0
  18. package/dist/VideoPlayer/components/time-line/utils/getHoverTimePosition.d.ts +3 -0
  19. package/dist/VideoPlayer/components/time-line/utils/getPositionPercent.d.ts +1 -0
  20. package/dist/VideoPlayer/components/time-line/utils/getTimeScale.d.ts +1 -0
  21. package/dist/VideoPlayer/components/time-line/utils/isInRange.d.ts +1 -0
  22. package/dist/VideoPlayer/components/time-line/utils/positionToMs.d.ts +1 -0
  23. package/dist/VideoPlayer/components/time-line/utils/secondsToTime.d.ts +6 -0
  24. package/dist/VideoPlayer/components/time-line/utils/timeToTimeString.d.ts +1 -0
  25. package/dist/VideoPlayer/constants.d.ts +3 -0
  26. package/dist/VideoPlayer/hooks/index.d.ts +4 -0
  27. package/dist/VideoPlayer/hooks/useAdManager.d.ts +8 -0
  28. package/dist/VideoPlayer/hooks/useNetworkSpeed.d.ts +7 -0
  29. package/dist/VideoPlayer/hooks/usePrimaryVideoLifecycle.d.ts +17 -0
  30. package/dist/VideoPlayer/hooks/useVideoError.d.ts +7 -0
  31. package/dist/VideoPlayer/hooks/useVideoSource.d.ts +1 -14
  32. package/dist/VideoPlayer/hooks/useVideoTracking.d.ts +2 -2
  33. package/dist/VideoPlayer/types/AdTypes.d.ts +33 -0
  34. package/dist/VideoPlayer/types/VideoPlayerTypes.d.ts +34 -10
  35. package/dist/VideoPlayer/utils/index.d.ts +1 -1
  36. package/dist/VideoPlayer/utils/qualityManager.d.ts +6 -32
  37. package/dist/components/ui/FullScreenToggle.d.ts +1 -1
  38. package/dist/components/ui/PiPictureInPictureToggle.d.ts +1 -1
  39. package/dist/index.d.ts +1 -1
  40. package/dist/index.js +2487 -493
  41. package/dist/store/slices/adsSlice.d.ts +24 -0
  42. package/dist/store/slices/errorSlice.d.ts +5 -0
  43. package/dist/store/slices/index.d.ts +2 -0
  44. package/dist/store/types/StoreTypes.d.ts +41 -9
  45. package/package.json +12 -11
@@ -0,0 +1,24 @@
1
+ import { StateCreator } from "zustand";
2
+ import { AdBreak, AdType } from "../../VideoPlayer/types/AdTypes";
3
+ import { VideoState } from "../types/StoreTypes";
4
+ export interface AdsState {
5
+ isAdPlaying: boolean;
6
+ setIsAdPlaying: (isAdPlaying: boolean) => void;
7
+ currentAd: AdBreak | null;
8
+ setCurrentAd: (ad: AdBreak | null) => void;
9
+ adType: AdType | null;
10
+ setAdType: (type: AdType | null) => void;
11
+ adCurrentTime: number;
12
+ setAdCurrentTime: (time: number) => void;
13
+ canSkipAd: boolean;
14
+ setCanSkipAd: (canSkip: boolean) => void;
15
+ skipCountdown: number;
16
+ setSkipCountdown: (countdown: number) => void;
17
+ playedAdBreaks: string[];
18
+ addPlayedAdBreak: (id: string) => void;
19
+ midRollQueue: AdBreak[];
20
+ setMidRollQueue: (queue: AdBreak[]) => void;
21
+ adVideoRef: HTMLVideoElement | null;
22
+ setAdVideoRef: (ref: HTMLVideoElement | null) => void;
23
+ }
24
+ export declare const createAdsSlice: StateCreator<VideoState, [], [], AdsState>;
@@ -0,0 +1,5 @@
1
+ import { StateCreator } from "zustand";
2
+ import { VideoErrorState, VideoState } from "../types/StoreTypes";
3
+ export declare const createErrorSlice: StateCreator<VideoState, [
4
+ ], [
5
+ ], VideoErrorState>;
@@ -6,4 +6,6 @@ export { createVideoQualitySlice } from "./videoQualitySlice";
6
6
  export { createSubtitlesSlice } from "./subtitlesSlice";
7
7
  export { createEpisodesSlice } from "./episodesSlice";
8
8
  export { createIntroSlice } from "./introSlice";
9
+ export { createAdsSlice } from "./adsSlice";
10
+ export { createErrorSlice } from "./errorSlice";
9
11
  export { createResetSlice } from "./resetSlice";
@@ -1,5 +1,7 @@
1
1
  import Hls from "hls.js";
2
2
  import * as dashjs from "dashjs";
3
+ import { AdBreak, AdType } from "../../VideoPlayer/types/AdTypes";
4
+ export type StreamType = "hls" | "dash" | "mp4" | "other";
3
5
  export interface VideoRefsState {
4
6
  videoRef: HTMLVideoElement | null;
5
7
  setVideoRef: (ref: HTMLVideoElement) => void;
@@ -31,15 +33,13 @@ export interface VideoControlsState {
31
33
  setControls: (controls: boolean) => void;
32
34
  isFullscreen: boolean;
33
35
  setIsFullscreen: (isFullscreen: boolean) => void;
34
- controlsVisible: boolean;
35
- setControlsVisible: (visible: boolean) => void;
36
36
  }
37
37
  export interface VideoQualityState {
38
- hlsInstance?: Hls | null;
38
+ hlsInstance: Hls | null;
39
39
  setHlsInstance: (hlsInstance: Hls | null) => void;
40
- dashInstance?: dashjs.MediaPlayerClass;
41
- setDashInstance: (dashInstance: dashjs.MediaPlayerClass) => void;
42
- qualityLevels?: Array<{
40
+ dashInstance: dashjs.MediaPlayerClass | null;
41
+ setDashInstance: (dashInstance: dashjs.MediaPlayerClass | null) => void;
42
+ qualityLevels: Array<{
43
43
  height: number;
44
44
  bitrate?: number;
45
45
  originalIndex: number;
@@ -53,8 +53,10 @@ export interface VideoQualityState {
53
53
  }>) => void;
54
54
  activeQuality: string;
55
55
  setActiveQuality: (activeQuality: string) => void;
56
- streamType: "hls" | "dash" | "mp4" | "other";
57
- setStreamType: (streamType: "hls" | "dash" | "mp4" | "other") => void;
56
+ currentQuality: string;
57
+ setCurrentQuality: (currentQuality: string) => void;
58
+ streamType: StreamType;
59
+ setStreamType: (streamType: StreamType) => void;
58
60
  }
59
61
  export interface SubtitleTrack {
60
62
  lang: string;
@@ -91,5 +93,35 @@ export interface IntroState {
91
93
  export interface StoreResetState {
92
94
  resetStore: () => void;
93
95
  }
94
- export interface VideoState extends VideoRefsState, VideoPlaybackState, VideoTimingState, VideoControlsState, VideoQualityState, SubtitlesState, EpisodesState, IntroState, StoreResetState {
96
+ export interface VideoError {
97
+ code: number;
98
+ message: string;
99
+ type: "network" | "decode" | "src" | "unknown";
100
+ }
101
+ export interface VideoErrorState {
102
+ error: VideoError | null;
103
+ setError: (error: VideoError | null) => void;
104
+ clearError: () => void;
105
+ }
106
+ export interface AdsState {
107
+ isAdPlaying: boolean;
108
+ setIsAdPlaying: (isAdPlaying: boolean) => void;
109
+ currentAd: AdBreak | null;
110
+ setCurrentAd: (ad: AdBreak | null) => void;
111
+ adType: AdType | null;
112
+ setAdType: (type: AdType | null) => void;
113
+ adCurrentTime: number;
114
+ setAdCurrentTime: (time: number) => void;
115
+ canSkipAd: boolean;
116
+ setCanSkipAd: (canSkip: boolean) => void;
117
+ skipCountdown: number;
118
+ setSkipCountdown: (countdown: number) => void;
119
+ playedAdBreaks: string[];
120
+ addPlayedAdBreak: (id: string) => void;
121
+ midRollQueue: AdBreak[];
122
+ setMidRollQueue: (queue: AdBreak[]) => void;
123
+ adVideoRef: HTMLVideoElement | null;
124
+ setAdVideoRef: (ref: HTMLVideoElement | null) => void;
125
+ }
126
+ export interface VideoState extends VideoRefsState, VideoPlaybackState, VideoTimingState, VideoControlsState, VideoQualityState, SubtitlesState, EpisodesState, IntroState, AdsState, VideoErrorState, StoreResetState {
95
127
  }
package/package.json CHANGED
@@ -1,9 +1,14 @@
1
1
  {
2
2
  "name": "@zezosoft/react-player",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "main": "dist/index.js",
5
5
  "type": "module",
6
6
  "types": "dist/index.d.ts",
7
+ "scripts": {
8
+ "build": "npx rollup -c",
9
+ "dev": "npx rollup -c -w",
10
+ "prepare": "npm run build"
11
+ },
7
12
  "files": [
8
13
  "dist"
9
14
  ],
@@ -32,12 +37,12 @@
32
37
  "@rollup/plugin-typescript": "^12.1.2",
33
38
  "@tailwindcss/postcss": "^4.0.14",
34
39
  "@types/node": "^24.4.0",
35
- "@types/react": "^19.0.10",
40
+ "@types/react": "^19.2.7",
36
41
  "hls.js": "^1.5.20",
37
42
  "lucide-react": "^0.481.0",
38
43
  "postcss": "^8.5.3",
39
- "react": "^19.0.0",
40
- "react-dom": "^19.0.0",
44
+ "react": "^19.2.3",
45
+ "react-dom": "^19.2.3",
41
46
  "rollup": "^4.35.0",
42
47
  "rollup-plugin-postcss": "^4.0.2",
43
48
  "tailwindcss": "^4.0.14",
@@ -47,17 +52,13 @@
47
52
  "peerDependencies": {
48
53
  "hls.js": "^1.5.20",
49
54
  "lucide-react": "^0.481.0",
50
- "react": "^19.0.0",
51
- "react-dom": "^19.0.0",
55
+ "react": "^19.2.3",
56
+ "react-dom": "^19.2.3",
52
57
  "zustand": "^5.0.3"
53
58
  },
54
59
  "dependencies": {
55
60
  "dashjs": "^5.0.3",
56
61
  "react-icons": "^5.5.0",
57
62
  "screenfull": "^6.0.2"
58
- },
59
- "scripts": {
60
- "build": "npx rollup -c",
61
- "dev": "npx rollup -c -w"
62
63
  }
63
- }
64
+ }