@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.
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ import { VideoError } from "../../store/types/StoreTypes";
3
+ interface ErrorOverlayProps {
4
+ error: VideoError;
5
+ onRetry: () => void;
6
+ }
7
+ declare const ErrorOverlay: React.FC<ErrorOverlayProps>;
8
+ export default ErrorOverlay;
@@ -7,3 +7,4 @@ export { useEpisodes } from "./useEpisodes";
7
7
  export { useVideoEvents } from "./useVideoEvents";
8
8
  export { useAdManager } from "./useAdManager";
9
9
  export { usePrimaryVideoLifecycle } from "./usePrimaryVideoLifecycle";
10
+ export { useVideoError } from "./useVideoError";
@@ -0,0 +1,7 @@
1
+ interface NetworkSpeedInfo {
2
+ speed: number;
3
+ quality: "slow" | "medium" | "fast" | "unknown";
4
+ message: string;
5
+ }
6
+ export declare const useNetworkSpeed: () => NetworkSpeedInfo | null;
7
+ export {};
@@ -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";
@@ -0,0 +1,7 @@
1
+ import { VideoError } from "../../store/types/StoreTypes";
2
+ export declare const useVideoError: () => {
3
+ error: VideoError | null;
4
+ handleVideoError: (e: React.SyntheticEvent<HTMLVideoElement, Event>) => void;
5
+ clearError: () => void;
6
+ retry: () => void;
7
+ };
@@ -1,2 +1,2 @@
1
- import { VideoPlayerProps } from "../types/VideoPlayerTypes";
2
- export declare const useVideoTracking: (tracking?: VideoPlayerProps["tracking"], episodeList?: VideoPlayerProps["episodeList"], currentEpisodeIndex?: number, onClose?: () => void) => void;
1
+ import { FeatureProps } from "../types/VideoPlayerTypes";
2
+ export declare const useVideoTracking: (tracking?: FeatureProps["tracking"], episodeList?: FeatureProps["episodeList"], currentEpisodeIndex?: number, onClose?: () => void) => void;
@@ -8,9 +8,6 @@ export interface AdBreak {
8
8
  skipAfter?: number;
9
9
  duration?: number;
10
10
  sponsoredUrl?: string;
11
- title?: string;
12
- description?: string;
13
- relevance?: "high" | "medium" | "low";
14
11
  }
15
12
  export interface AdConfig {
16
13
  preRoll?: AdBreak;
@@ -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 VideoPlayerProps {
6
- trackSrc: string;
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
- onEnded?: (e: React.SyntheticEvent<HTMLVideoElement>) => void;
10
- onError?: (e?: React.SyntheticEvent<HTMLVideoElement, Event>) => void;
11
- trackTitle?: string;
12
- trackPoster?: string;
13
- isTrailer?: boolean;
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";