@zezosoft/react-player 0.0.5 → 0.0.6

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,74 +1,2 @@
1
- import Hls from "hls.js";
2
- import { Dispatch, SetStateAction } from "react";
3
- interface VideoState {
4
- videoRef: HTMLVideoElement | null;
5
- setVideoRef: (ref: HTMLVideoElement) => void;
6
- playing: boolean | ((prevState: boolean) => boolean);
7
- setPlaying: Dispatch<SetStateAction<boolean>>;
8
- videoWrapperRef: HTMLDivElement | null;
9
- setVideoWrapperRef: (ref: HTMLDivElement) => void;
10
- isBuffering?: boolean;
11
- setIsBuffering: (isBuffering: boolean) => void;
12
- isPlaying: boolean;
13
- setIsPlaying: (isPlaying: boolean) => void;
14
- muted: boolean;
15
- setMuted: (muted: boolean) => void;
16
- volume: number;
17
- setVolume: (volume: number) => void;
18
- controls: boolean;
19
- setControls: (controls: boolean) => void;
20
- currentTime: number;
21
- setCurrentTime: (currentTime: number) => void;
22
- duration: number;
23
- setDuration: (duration: number) => void;
24
- isFullscreen: boolean;
25
- setIsFullscreen: (isFullscreen: boolean) => void;
26
- hlsInstance?: Hls;
27
- setHlsInstance: (hlsInstance: Hls) => void;
28
- qualityLevels?: Hls["levels"];
29
- setQualityLevels: (qualityLevels: Hls["levels"]) => void;
30
- activeQuality?: string;
31
- setActiveQuality: (activeQuality: string) => void;
32
- activeSubtitle?: {
33
- lang: string;
34
- label: string;
35
- url: string;
36
- } | null;
37
- setActiveSubtitle: (subtitle: {
38
- lang: string;
39
- label: string;
40
- url: string;
41
- } | null) => void;
42
- subtitles: {
43
- lang: string;
44
- label: string;
45
- url: string;
46
- }[];
47
- setSubtitles: (subtitles: {
48
- lang: string;
49
- label: string;
50
- url: string;
51
- }[]) => void;
52
- showIntroSkip: boolean;
53
- setShowIntroSkip: (show: boolean) => void;
54
- autoPlayNext: boolean;
55
- setAutoPlayNext: (value: boolean) => void;
56
- episodeList: {
57
- id: number;
58
- title: string;
59
- url: string;
60
- }[];
61
- setEpisodeList: (list: {
62
- id: number;
63
- title: string;
64
- url: string;
65
- }[]) => void;
66
- currentEpisodeIndex: number;
67
- setCurrentEpisodeIndex: (index: number) => void;
68
- showCountdown: boolean;
69
- setShowCountdown: (show: boolean) => void;
70
- countdownTime: number;
71
- setCountdownTime: (time: number) => void;
72
- }
1
+ import { VideoState } from "./types/StoreTypes";
73
2
  export declare const useVideoStore: import("zustand").UseBoundStore<import("zustand").StoreApi<VideoState>>;
74
- export {};
@@ -0,0 +1,3 @@
1
+ export { useVideoStore } from "./VideoState";
2
+ export type * from "./types/StoreTypes";
3
+ export * from "./slices";
@@ -0,0 +1,5 @@
1
+ import { StateCreator } from "zustand";
2
+ import { EpisodesState, VideoState } from "../types/StoreTypes";
3
+ export declare const createEpisodesSlice: StateCreator<VideoState, [
4
+ ], [
5
+ ], EpisodesState>;
@@ -0,0 +1,8 @@
1
+ export { createVideoRefsSlice } from "./videoRefsSlice";
2
+ export { createVideoPlaybackSlice } from "./videoPlaybackSlice";
3
+ export { createVideoTimingSlice } from "./videoTimingSlice";
4
+ export { createVideoControlsSlice } from "./videoControlsSlice";
5
+ export { createVideoQualitySlice } from "./videoQualitySlice";
6
+ export { createSubtitlesSlice } from "./subtitlesSlice";
7
+ export { createEpisodesSlice } from "./episodesSlice";
8
+ export { createIntroSlice } from "./introSlice";
@@ -0,0 +1,5 @@
1
+ import { StateCreator } from "zustand";
2
+ import { IntroState, VideoState } from "../types/StoreTypes";
3
+ export declare const createIntroSlice: StateCreator<VideoState, [
4
+ ], [
5
+ ], IntroState>;
@@ -0,0 +1,5 @@
1
+ import { StateCreator } from "zustand";
2
+ import { SubtitlesState, VideoState } from "../types/StoreTypes";
3
+ export declare const createSubtitlesSlice: StateCreator<VideoState, [
4
+ ], [
5
+ ], SubtitlesState>;
@@ -0,0 +1,5 @@
1
+ import { StateCreator } from "zustand";
2
+ import { VideoControlsState, VideoState } from "../types/StoreTypes";
3
+ export declare const createVideoControlsSlice: StateCreator<VideoState, [
4
+ ], [
5
+ ], VideoControlsState>;
@@ -0,0 +1,5 @@
1
+ import { StateCreator } from "zustand";
2
+ import { VideoPlaybackState, VideoState } from "../types/StoreTypes";
3
+ export declare const createVideoPlaybackSlice: StateCreator<VideoState, [
4
+ ], [
5
+ ], VideoPlaybackState>;
@@ -0,0 +1,5 @@
1
+ import { StateCreator } from "zustand";
2
+ import { VideoQualityState, VideoState } from "../types/StoreTypes";
3
+ export declare const createVideoQualitySlice: StateCreator<VideoState, [
4
+ ], [
5
+ ], VideoQualityState>;
@@ -0,0 +1,5 @@
1
+ import { StateCreator } from "zustand";
2
+ import { VideoRefsState, VideoState } from "../types/StoreTypes";
3
+ export declare const createVideoRefsSlice: StateCreator<VideoState, [
4
+ ], [
5
+ ], VideoRefsState>;
@@ -0,0 +1,5 @@
1
+ import { StateCreator } from "zustand";
2
+ import { VideoTimingState, VideoState } from "../types/StoreTypes";
3
+ export declare const createVideoTimingSlice: StateCreator<VideoState, [
4
+ ], [
5
+ ], VideoTimingState>;
@@ -0,0 +1,74 @@
1
+ import Hls from "hls.js";
2
+ import { Dispatch, SetStateAction } from "react";
3
+ export interface VideoRefsState {
4
+ videoRef: HTMLVideoElement | null;
5
+ setVideoRef: (ref: HTMLVideoElement) => void;
6
+ videoWrapperRef: HTMLDivElement | null;
7
+ setVideoWrapperRef: (ref: HTMLDivElement) => void;
8
+ }
9
+ export interface VideoPlaybackState {
10
+ playing: boolean | ((prevState: boolean) => boolean);
11
+ setPlaying: Dispatch<SetStateAction<boolean>>;
12
+ isBuffering: boolean;
13
+ setIsBuffering: (isBuffering: boolean) => void;
14
+ isPlaying: boolean;
15
+ setIsPlaying: (isPlaying: boolean) => void;
16
+ muted: boolean;
17
+ setMuted: (muted: boolean) => void;
18
+ volume: number;
19
+ setVolume: (volume: number) => void;
20
+ }
21
+ export interface VideoTimingState {
22
+ currentTime: number;
23
+ setCurrentTime: (currentTime: number) => void;
24
+ duration: number;
25
+ setDuration: (duration: number) => void;
26
+ }
27
+ export interface VideoControlsState {
28
+ controls: boolean;
29
+ setControls: (controls: boolean) => void;
30
+ isFullscreen: boolean;
31
+ setIsFullscreen: (isFullscreen: boolean) => void;
32
+ }
33
+ export interface VideoQualityState {
34
+ hlsInstance?: Hls;
35
+ setHlsInstance: (hlsInstance: Hls) => void;
36
+ qualityLevels?: Hls["levels"];
37
+ setQualityLevels: (qualityLevels: Hls["levels"]) => void;
38
+ activeQuality: string;
39
+ setActiveQuality: (activeQuality: string) => void;
40
+ }
41
+ export interface SubtitleTrack {
42
+ lang: string;
43
+ label: string;
44
+ url: string;
45
+ }
46
+ export interface SubtitlesState {
47
+ activeSubtitle: SubtitleTrack | null;
48
+ setActiveSubtitle: (subtitle: SubtitleTrack | null) => void;
49
+ subtitles: SubtitleTrack[];
50
+ setSubtitles: (subtitles: SubtitleTrack[]) => void;
51
+ }
52
+ export interface Episode {
53
+ id: number;
54
+ title: string;
55
+ url: string;
56
+ }
57
+ export interface EpisodesState {
58
+ episodeList: Episode[];
59
+ setEpisodeList: (list: Episode[]) => void;
60
+ currentEpisodeIndex: number;
61
+ setCurrentEpisodeIndex: (index: number) => void;
62
+ showCountdown: boolean;
63
+ setShowCountdown: (show: boolean) => void;
64
+ countdownTime: number;
65
+ setCountdownTime: (time: number) => void;
66
+ autoPlayNext: boolean;
67
+ setAutoPlayNext: (value: boolean) => void;
68
+ }
69
+ export interface IntroState {
70
+ showIntroSkip: boolean;
71
+ setShowIntroSkip: (show: boolean) => void;
72
+ }
73
+ export interface VideoState extends VideoRefsState, VideoPlaybackState, VideoTimingState, VideoControlsState, VideoQualityState, SubtitlesState, EpisodesState, IntroState {
74
+ }
package/package.json CHANGED
@@ -1,9 +1,14 @@
1
1
  {
2
2
  "name": "@zezosoft/react-player",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
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
  ],
@@ -53,9 +58,5 @@
53
58
  },
54
59
  "dependencies": {
55
60
  "react-icons": "^5.5.0"
56
- },
57
- "scripts": {
58
- "build": "npx rollup -c",
59
- "dev": "npx rollup -c -w"
60
61
  }
61
- }
62
+ }