@zezosoft/react-player 0.0.9 → 1.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/README.md +536 -146
- package/dist/VideoPlayer/components/ErrorOverlay.d.ts +8 -0
- package/dist/VideoPlayer/hooks/index.d.ts +1 -0
- package/dist/VideoPlayer/hooks/useNetworkSpeed.d.ts +7 -0
- package/dist/VideoPlayer/hooks/useSubtitleStyling.d.ts +3 -0
- package/dist/VideoPlayer/hooks/useVideoError.d.ts +7 -0
- package/dist/VideoPlayer/hooks/useVideoTracking.d.ts +2 -2
- package/dist/VideoPlayer/types/AdTypes.d.ts +0 -3
- package/dist/VideoPlayer/types/VideoPlayerTypes.d.ts +35 -9
- package/dist/VideoPlayer/utils/index.d.ts +0 -11
- package/dist/components/ui/Settings.d.ts +2 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +976 -425
- package/dist/store/slices/errorSlice.d.ts +5 -0
- package/dist/store/slices/index.d.ts +1 -0
- package/dist/store/types/StoreTypes.d.ts +11 -1
- package/package.json +6 -6
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
/** Returns true if value is a Tailwind background class (e.g. bg-red, bg-black, bg-transparent) ya CSS "transparent" */
|
|
2
|
+
export declare const isTailwindBackground: (value: unknown) => value is string;
|
|
1
3
|
export interface SubtitleStyleConfig {
|
|
2
4
|
fontSize?: string;
|
|
5
|
+
/** CSS value (rgba, hex, gradient) ya Tailwind class: bg-red, bg-black, bg-transparent, bg-amber-500/80, etc. */
|
|
3
6
|
backgroundColor?: string;
|
|
4
7
|
textColor?: string;
|
|
5
8
|
position?: "top" | "center" | "bottom";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const useVideoTracking: (tracking?:
|
|
1
|
+
import { FeatureProps } from "../types/VideoPlayerTypes";
|
|
2
|
+
export declare const useVideoTracking: (tracking?: FeatureProps["tracking"], episodeList?: FeatureProps["episodeList"], currentEpisodeIndex?: number, onClose?: () => void) => void;
|
|
@@ -2,20 +2,41 @@ import { TimeCode } from "../components/time-line/TimeLine";
|
|
|
2
2
|
import { IOnWatchTimeUpdated } from "../../types";
|
|
3
3
|
import { SubtitleStyleConfig } from "../hooks/useSubtitleStyling";
|
|
4
4
|
import { AdConfig } from "./AdTypes";
|
|
5
|
-
export interface
|
|
6
|
-
|
|
5
|
+
export interface WatchHistoryData {
|
|
6
|
+
currentTime: number;
|
|
7
|
+
duration: number;
|
|
8
|
+
progress: number;
|
|
9
|
+
isCompleted: boolean;
|
|
10
|
+
watchedAt: number;
|
|
11
|
+
}
|
|
12
|
+
export interface VideoProps {
|
|
13
|
+
src: string;
|
|
14
|
+
title?: string;
|
|
15
|
+
poster?: string;
|
|
16
|
+
type?: "hls" | "dash" | "mp4" | "other" | "youtube" | undefined;
|
|
17
|
+
isTrailer?: boolean;
|
|
7
18
|
showControls?: boolean;
|
|
8
19
|
isMute?: boolean;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
20
|
+
startFrom?: number;
|
|
21
|
+
}
|
|
22
|
+
export interface VideoQualityConfig {
|
|
23
|
+
defaultQuality?: "auto" | string;
|
|
24
|
+
showInSettings?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface StyleProps {
|
|
14
27
|
className?: string;
|
|
15
|
-
type?: "hls" | "dash" | "mp4" | "other" | "youtube" | undefined;
|
|
16
28
|
width?: string;
|
|
17
29
|
height?: string;
|
|
30
|
+
subtitleStyle?: SubtitleStyleConfig;
|
|
31
|
+
qualityConfig?: VideoQualityConfig;
|
|
32
|
+
}
|
|
33
|
+
export interface EventProps {
|
|
34
|
+
onEnded?: (e: React.SyntheticEvent<HTMLVideoElement>) => void;
|
|
35
|
+
onError?: (e?: React.SyntheticEvent<HTMLVideoElement, Event>) => void;
|
|
18
36
|
onClose?: () => void;
|
|
37
|
+
onWatchHistoryUpdate?: (data: WatchHistoryData) => void;
|
|
38
|
+
}
|
|
39
|
+
export interface FeatureProps {
|
|
19
40
|
timeCodes?: TimeCode[];
|
|
20
41
|
getPreviewScreenUrl?: (hoverTimeValue: number) => string;
|
|
21
42
|
tracking?: {
|
|
@@ -41,9 +62,14 @@ export interface VideoPlayerProps {
|
|
|
41
62
|
showAtTime?: number;
|
|
42
63
|
showAtEnd?: boolean;
|
|
43
64
|
};
|
|
44
|
-
subtitleStyle?: SubtitleStyleConfig;
|
|
45
65
|
ads?: AdConfig;
|
|
46
66
|
}
|
|
67
|
+
export interface VideoPlayerProps {
|
|
68
|
+
video: VideoProps;
|
|
69
|
+
style?: StyleProps;
|
|
70
|
+
events?: EventProps;
|
|
71
|
+
features?: FeatureProps;
|
|
72
|
+
}
|
|
47
73
|
export type { SubtitleTrack, Episode } from "../../store/types/StoreTypes";
|
|
48
74
|
export interface IntroConfig {
|
|
49
75
|
start: number;
|
|
@@ -4,23 +4,12 @@
|
|
|
4
4
|
* @returns
|
|
5
5
|
*/
|
|
6
6
|
export declare const timeFormat: (seconds: number) => string;
|
|
7
|
-
/**
|
|
8
|
-
* @description
|
|
9
|
-
* @param seconds
|
|
10
|
-
*/
|
|
11
|
-
export declare const timeFormatForContent: (seconds: number) => string;
|
|
12
7
|
/**
|
|
13
8
|
* @description
|
|
14
9
|
* @param seconds
|
|
15
10
|
* @returns
|
|
16
11
|
*/
|
|
17
12
|
export declare const secondsToMilliseconds: (seconds: number) => number;
|
|
18
|
-
/**
|
|
19
|
-
* @description
|
|
20
|
-
* @param milliseconds
|
|
21
|
-
* @returns
|
|
22
|
-
*/
|
|
23
|
-
export declare const millisecondsToSeconds: (milliseconds: number) => number;
|
|
24
13
|
/**
|
|
25
14
|
* @description
|
|
26
15
|
* @param url
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import type { VideoQualityConfig } from "../../VideoPlayer/types/VideoPlayerTypes";
|
|
2
3
|
interface SettingsProps {
|
|
3
4
|
iconClassName: string;
|
|
5
|
+
qualityConfig?: VideoQualityConfig;
|
|
4
6
|
}
|
|
5
7
|
declare const Settings: React.FC<SettingsProps>;
|
|
6
8
|
export default Settings;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import "./index.css";
|
|
2
2
|
export { default as VideoPlayer } from "./VideoPlayer/VideoPlayer";
|
|
3
3
|
export { useVideoStore } from "./store/VideoState";
|
|
4
|
-
export type { VideoPlayerProps, Episode, SubtitleTrack, IntroConfig, NextEpisodeConfig, } from "./VideoPlayer/types/VideoPlayerTypes";
|
|
4
|
+
export type { VideoPlayerProps, Episode, SubtitleTrack, IntroConfig, NextEpisodeConfig, WatchHistoryData, } from "./VideoPlayer/types/VideoPlayerTypes";
|
|
5
5
|
export type { SubtitleStyleConfig } from "./VideoPlayer/hooks/useSubtitleStyling";
|
|
6
|
+
export type { VideoQualityConfig } from "./VideoPlayer/types/VideoPlayerTypes";
|
|
6
7
|
export type { VideoState, VideoRefsState, VideoPlaybackState, VideoTimingState, VideoControlsState, VideoQualityState, SubtitlesState, EpisodesState, IntroState, } from "./store/types/StoreTypes";
|