@zezosoft/react-player 0.0.9 → 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.
@@ -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,5 @@ 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";
11
+ export { useNetworkSpeed } from "./useNetworkSpeed";
@@ -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 {};
@@ -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,37 @@ 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 StyleProps {
14
23
  className?: string;
15
- type?: "hls" | "dash" | "mp4" | "other" | "youtube" | undefined;
16
24
  width?: string;
17
25
  height?: string;
26
+ subtitleStyle?: SubtitleStyleConfig;
27
+ }
28
+ export interface EventProps {
29
+ onEnded?: (e: React.SyntheticEvent<HTMLVideoElement>) => void;
30
+ onError?: (e?: React.SyntheticEvent<HTMLVideoElement, Event>) => void;
18
31
  onClose?: () => void;
32
+ /** Called when player closes with watch progress data for history tracking */
33
+ onWatchHistoryUpdate?: (data: WatchHistoryData) => void;
34
+ }
35
+ export interface FeatureProps {
19
36
  timeCodes?: TimeCode[];
20
37
  getPreviewScreenUrl?: (hoverTimeValue: number) => string;
21
38
  tracking?: {
@@ -41,9 +58,14 @@ export interface VideoPlayerProps {
41
58
  showAtTime?: number;
42
59
  showAtEnd?: boolean;
43
60
  };
44
- subtitleStyle?: SubtitleStyleConfig;
45
61
  ads?: AdConfig;
46
62
  }
63
+ export interface VideoPlayerProps {
64
+ video: VideoProps;
65
+ style?: StyleProps;
66
+ events?: EventProps;
67
+ features?: FeatureProps;
68
+ }
47
69
  export type { SubtitleTrack, Episode } from "../../store/types/StoreTypes";
48
70
  export interface IntroConfig {
49
71
  start: number;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
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
6
  export type { VideoState, VideoRefsState, VideoPlaybackState, VideoTimingState, VideoControlsState, VideoQualityState, SubtitlesState, EpisodesState, IntroState, } from "./store/types/StoreTypes";