@zezosoft/react-player 0.0.8 → 0.0.9
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/dist/VideoPlayer/VideoPlayer.d.ts +1 -0
- package/dist/VideoPlayer/components/AdOverlay.d.ts +10 -0
- package/dist/VideoPlayer/components/Overlay.d.ts +4 -0
- package/dist/VideoPlayer/components/SubtitleOverlay.d.ts +7 -0
- package/dist/VideoPlayer/components/controls/BottomControls.d.ts +5 -0
- package/dist/VideoPlayer/components/controls/ControlsHeader.d.ts +5 -0
- package/dist/VideoPlayer/components/controls/MiddleControls.d.ts +3 -0
- package/dist/VideoPlayer/components/controls/VideoPlayerControls.d.ts +4 -0
- package/dist/VideoPlayer/components/controls/index.d.ts +4 -0
- package/dist/VideoPlayer/components/time-line/TimeLine.d.ts +21 -0
- package/dist/VideoPlayer/components/time-line/components/HoverTimeWithPreview.d.ts +16 -0
- package/dist/VideoPlayer/components/time-line/components/Thumb.d.ts +9 -0
- package/dist/VideoPlayer/components/time-line/components/TimeCodeItem.d.ts +21 -0
- package/dist/VideoPlayer/components/time-line/components/TimeCodes.d.ts +15 -0
- package/dist/VideoPlayer/components/time-line/utils/getEndTimeByIndex.d.ts +2 -0
- package/dist/VideoPlayer/components/time-line/utils/getHoverTimePosition.d.ts +3 -0
- package/dist/VideoPlayer/components/time-line/utils/getPositionPercent.d.ts +1 -0
- package/dist/VideoPlayer/components/time-line/utils/getTimeScale.d.ts +1 -0
- package/dist/VideoPlayer/components/time-line/utils/isInRange.d.ts +1 -0
- package/dist/VideoPlayer/components/time-line/utils/positionToMs.d.ts +1 -0
- package/dist/VideoPlayer/components/time-line/utils/secondsToTime.d.ts +6 -0
- package/dist/VideoPlayer/components/time-line/utils/timeToTimeString.d.ts +1 -0
- package/dist/VideoPlayer/constants.d.ts +3 -0
- package/dist/VideoPlayer/hooks/index.d.ts +2 -0
- package/dist/VideoPlayer/hooks/useAdManager.d.ts +8 -0
- package/dist/VideoPlayer/hooks/usePrimaryVideoLifecycle.d.ts +17 -0
- package/dist/VideoPlayer/hooks/useVideoSource.d.ts +1 -14
- package/dist/VideoPlayer/types/AdTypes.d.ts +36 -0
- package/dist/VideoPlayer/types/VideoPlayerTypes.d.ts +4 -2
- package/dist/VideoPlayer/utils/index.d.ts +1 -1
- package/dist/VideoPlayer/utils/qualityManager.d.ts +6 -32
- package/dist/components/ui/FullScreenToggle.d.ts +1 -1
- package/dist/components/ui/PiPictureInPictureToggle.d.ts +1 -1
- package/dist/index.js +1784 -345
- package/dist/store/slices/adsSlice.d.ts +24 -0
- package/dist/store/slices/index.d.ts +1 -0
- package/dist/store/types/StoreTypes.d.ts +31 -9
- package/package.json +7 -6
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { AdBreak } from "../types/AdTypes";
|
|
3
|
+
import { IPlayerConfig } from "../../types";
|
|
4
|
+
interface AdOverlayProps {
|
|
5
|
+
adBreak: AdBreak;
|
|
6
|
+
onSkip?: () => void;
|
|
7
|
+
config?: IPlayerConfig;
|
|
8
|
+
}
|
|
9
|
+
declare const AdOverlay: React.FC<AdOverlayProps>;
|
|
10
|
+
export default AdOverlay;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { SubtitleStyleConfig } from "../hooks/useSubtitleStyling";
|
|
3
|
+
interface SubtitleOverlayProps {
|
|
4
|
+
styleConfig?: SubtitleStyleConfig;
|
|
5
|
+
}
|
|
6
|
+
declare const SubtitleOverlay: React.FC<SubtitleOverlayProps>;
|
|
7
|
+
export default SubtitleOverlay;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./time-line.css";
|
|
3
|
+
export interface TimeCode {
|
|
4
|
+
fromMs: number;
|
|
5
|
+
description: string;
|
|
6
|
+
}
|
|
7
|
+
export interface TimeLineProps {
|
|
8
|
+
max: number;
|
|
9
|
+
currentTime: number;
|
|
10
|
+
bufferTime?: number;
|
|
11
|
+
offset?: number;
|
|
12
|
+
timeCodes?: TimeCode[];
|
|
13
|
+
hideThumbTooltip?: boolean;
|
|
14
|
+
limitTimeTooltipBySides?: boolean;
|
|
15
|
+
secondsPrefix?: string;
|
|
16
|
+
minutesPrefix?: string;
|
|
17
|
+
onChange: (time: number, offsetTime: number) => void;
|
|
18
|
+
getPreviewScreenUrl?: (hoverTimeValue: number) => string;
|
|
19
|
+
trackColor?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare const VideoSeekSlider: React.FC<TimeLineProps>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface HoverTimeWithPreviewProps {
|
|
3
|
+
max: number;
|
|
4
|
+
hoverTimeValue: number;
|
|
5
|
+
trackWidth: number;
|
|
6
|
+
seekHoverPosition: number;
|
|
7
|
+
offset: number;
|
|
8
|
+
isThumbActive: boolean;
|
|
9
|
+
limitTimeTooltipBySides: boolean;
|
|
10
|
+
label: string;
|
|
11
|
+
secondsPrefix?: string;
|
|
12
|
+
minutesPrefix?: string;
|
|
13
|
+
getPreviewScreenUrl?: (hoverTimeValue: number) => string;
|
|
14
|
+
}
|
|
15
|
+
export declare const HoverTimeWithPreview: React.FC<HoverTimeWithPreviewProps>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface TimeCode {
|
|
3
|
+
fromMs: number;
|
|
4
|
+
description: string;
|
|
5
|
+
}
|
|
6
|
+
export interface TimeCodeItemProps {
|
|
7
|
+
currentTime: number;
|
|
8
|
+
seekHoverTime: number;
|
|
9
|
+
bufferTime: number;
|
|
10
|
+
startTime: number;
|
|
11
|
+
endTime: number;
|
|
12
|
+
maxTime: number;
|
|
13
|
+
label?: string;
|
|
14
|
+
isTimePassed?: boolean;
|
|
15
|
+
isBufferPassed?: boolean;
|
|
16
|
+
isHoverPassed?: boolean;
|
|
17
|
+
onHover?: (label: string) => void;
|
|
18
|
+
withGap?: boolean;
|
|
19
|
+
trackColor?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare const TimeCodeItem: React.FC<TimeCodeItemProps>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { TimeCode } from "./TimeCodeItem";
|
|
3
|
+
export interface TimeCodesProps {
|
|
4
|
+
max: number;
|
|
5
|
+
currentTime: number;
|
|
6
|
+
bufferTime: number;
|
|
7
|
+
seekHoverPosition: number;
|
|
8
|
+
timeCodes: TimeCode[] | undefined;
|
|
9
|
+
trackWidth: number;
|
|
10
|
+
mobileSeeking: boolean;
|
|
11
|
+
label: string;
|
|
12
|
+
setLabel: React.Dispatch<React.SetStateAction<string>>;
|
|
13
|
+
trackColor?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare const TimeCodes: React.FC<TimeCodesProps>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getPositionPercent(max: number, current: number): number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getTimeScale(currentTime: number, startTime: number, endTime: number, isTimePassed: boolean): number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isInRange: (time: number, start: number, end: number) => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function positionToMs(max: number, position: number, trackWidth: number): number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function timeToTimeString(max: number, seekHoverTime: number, offset?: number, minutesPrefix?: string, secondsPrefix?: string): string;
|
|
@@ -5,3 +5,5 @@ export { useVideoTracking } from "./useVideoTracking";
|
|
|
5
5
|
export { useIntroSkip } from "./useIntroSkip";
|
|
6
6
|
export { useEpisodes } from "./useEpisodes";
|
|
7
7
|
export { useVideoEvents } from "./useVideoEvents";
|
|
8
|
+
export { useAdManager } from "./useAdManager";
|
|
9
|
+
export { usePrimaryVideoLifecycle } from "./usePrimaryVideoLifecycle";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { VideoState } from "../../store/types/StoreTypes";
|
|
2
|
+
interface UsePrimaryVideoLifecycleParams {
|
|
3
|
+
hasPreRoll: boolean;
|
|
4
|
+
trackSrc: string;
|
|
5
|
+
}
|
|
6
|
+
interface PrimaryVideoLifecycleResult {
|
|
7
|
+
registerVideoRef: (node: HTMLVideoElement | null) => void;
|
|
8
|
+
videoRef: HTMLVideoElement | null;
|
|
9
|
+
isAdPlaying: boolean;
|
|
10
|
+
currentAd: VideoState["currentAd"];
|
|
11
|
+
adType: VideoState["adType"];
|
|
12
|
+
initialAdFinished: boolean;
|
|
13
|
+
shouldCoverMainVideo: boolean;
|
|
14
|
+
shouldShowPlaceholder: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare const usePrimaryVideoLifecycle: ({ hasPreRoll, trackSrc, }: UsePrimaryVideoLifecycleParams) => PrimaryVideoLifecycleResult;
|
|
17
|
+
export {};
|
|
@@ -1,14 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Video Source Hook
|
|
3
|
-
*
|
|
4
|
-
* Manages video source loading and streaming technology detection
|
|
5
|
-
* Supports HLS.js, DASH.js, and native HTML5 video
|
|
6
|
-
*
|
|
7
|
-
* Features:
|
|
8
|
-
* - Automatic stream type detection
|
|
9
|
-
* - HLS.js fallback for older browsers
|
|
10
|
-
* - DASH.js support with proper initialization
|
|
11
|
-
* - Quality level extraction for all stream types
|
|
12
|
-
* - Error handling and cleanup
|
|
13
|
-
*/
|
|
14
|
-
export declare const useVideoSource: (trackSrc: string, type?: "hls" | "mp4" | "dash" | "other" | "youtube" | undefined) => void;
|
|
1
|
+
export declare const useVideoSource: (trackSrc: string, type?: "hls" | "dash" | "mp4" | "other" | "youtube" | undefined) => void;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export type AdType = "pre-roll" | "mid-roll" | "post-roll" | "overlay";
|
|
2
|
+
export interface AdBreak {
|
|
3
|
+
id: string;
|
|
4
|
+
type: AdType;
|
|
5
|
+
time: number;
|
|
6
|
+
adUrl: string;
|
|
7
|
+
skipable?: boolean;
|
|
8
|
+
skipAfter?: number;
|
|
9
|
+
duration?: number;
|
|
10
|
+
sponsoredUrl?: string;
|
|
11
|
+
title?: string;
|
|
12
|
+
description?: string;
|
|
13
|
+
relevance?: "high" | "medium" | "low";
|
|
14
|
+
}
|
|
15
|
+
export interface AdConfig {
|
|
16
|
+
preRoll?: AdBreak;
|
|
17
|
+
midRoll?: AdBreak[];
|
|
18
|
+
postRoll?: AdBreak;
|
|
19
|
+
overlay?: {
|
|
20
|
+
imageUrl: string;
|
|
21
|
+
clickUrl?: string;
|
|
22
|
+
showDuration: number;
|
|
23
|
+
position?: "top-left" | "top-right" | "bottom-left" | "bottom-right";
|
|
24
|
+
};
|
|
25
|
+
smartPlacement?: {
|
|
26
|
+
enabled: boolean;
|
|
27
|
+
minVideoDuration?: number;
|
|
28
|
+
minGapBetweenAds?: number;
|
|
29
|
+
avoidNearEnd?: number;
|
|
30
|
+
preferNaturalBreaks?: boolean;
|
|
31
|
+
};
|
|
32
|
+
onAdStart?: (adBreak: AdBreak) => void;
|
|
33
|
+
onAdEnd?: (adBreak: AdBreak) => void;
|
|
34
|
+
onAdSkip?: (adBreak: AdBreak) => void;
|
|
35
|
+
onAdError?: (adBreak: AdBreak, error: Error) => void;
|
|
36
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { TimeCode } from "../
|
|
1
|
+
import { TimeCode } from "../components/time-line/TimeLine";
|
|
2
2
|
import { IOnWatchTimeUpdated } from "../../types";
|
|
3
3
|
import { SubtitleStyleConfig } from "../hooks/useSubtitleStyling";
|
|
4
|
+
import { AdConfig } from "./AdTypes";
|
|
4
5
|
export interface VideoPlayerProps {
|
|
5
6
|
trackSrc: string;
|
|
6
7
|
showControls?: boolean;
|
|
@@ -11,7 +12,7 @@ export interface VideoPlayerProps {
|
|
|
11
12
|
trackPoster?: string;
|
|
12
13
|
isTrailer?: boolean;
|
|
13
14
|
className?: string;
|
|
14
|
-
type?: "hls" | "mp4" | "other" | "youtube" | undefined;
|
|
15
|
+
type?: "hls" | "dash" | "mp4" | "other" | "youtube" | undefined;
|
|
15
16
|
width?: string;
|
|
16
17
|
height?: string;
|
|
17
18
|
onClose?: () => void;
|
|
@@ -41,6 +42,7 @@ export interface VideoPlayerProps {
|
|
|
41
42
|
showAtEnd?: boolean;
|
|
42
43
|
};
|
|
43
44
|
subtitleStyle?: SubtitleStyleConfig;
|
|
45
|
+
ads?: AdConfig;
|
|
44
46
|
}
|
|
45
47
|
export type { SubtitleTrack, Episode } from "../../store/types/StoreTypes";
|
|
46
48
|
export interface IntroConfig {
|
|
@@ -27,4 +27,4 @@ export declare const millisecondsToSeconds: (milliseconds: number) => number;
|
|
|
27
27
|
* @returns
|
|
28
28
|
*/
|
|
29
29
|
export declare const getExtensionFromUrl: (url: string) => string | undefined;
|
|
30
|
-
export { QualityManager } from
|
|
30
|
+
export { QualityManager } from "./qualityManager";
|
|
@@ -1,16 +1,6 @@
|
|
|
1
|
-
import Hls from
|
|
2
|
-
import * as dashjs from
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Video Quality Management Utility
|
|
6
|
-
* Provides a unified interface for quality switching across HLS.js and DASH.js
|
|
7
|
-
*
|
|
8
|
-
* This utility follows OTT-grade best practices for smooth quality switching:
|
|
9
|
-
* - Immediate quality changes without playback interruption
|
|
10
|
-
* - Proper ABR (Adaptive Bitrate) control
|
|
11
|
-
* - Error handling and fallback mechanisms
|
|
12
|
-
* - Support for both manual and auto quality modes
|
|
13
|
-
*/
|
|
1
|
+
import Hls from "hls.js";
|
|
2
|
+
import * as dashjs from "dashjs";
|
|
3
|
+
import { StreamType } from "../../store/types/StoreTypes";
|
|
14
4
|
export declare class QualityManager {
|
|
15
5
|
/**
|
|
16
6
|
* Set video quality for HLS streams with OTT-grade smoothness
|
|
@@ -26,21 +16,12 @@ export declare class QualityManager {
|
|
|
26
16
|
*/
|
|
27
17
|
static setHlsQuality(hlsInstance: Hls | null | undefined, levelIndex: number): void;
|
|
28
18
|
/**
|
|
29
|
-
|
|
30
|
-
*
|
|
31
|
-
* Best practices implemented:
|
|
32
|
-
* 1. Use autoSwitchBitrate settings to control ABR behavior
|
|
33
|
-
* 2. Use setRepresentationForTypeById for immediate quality change
|
|
34
|
-
* 3. Handle representation discovery and selection properly
|
|
35
|
-
* 4. Provide visual feedback through console logs
|
|
36
|
-
*
|
|
19
|
+
|
|
37
20
|
* @param dashInstance DASH.js instance
|
|
38
21
|
* @param qualityId Quality level ID (undefined/null for auto)
|
|
39
22
|
*/
|
|
40
|
-
static setDashQuality(dashInstance: dashjs.MediaPlayerClass,
|
|
23
|
+
static setDashQuality(dashInstance: dashjs.MediaPlayerClass | undefined | null, qualityIndex: number | null | undefined): void;
|
|
41
24
|
/**
|
|
42
|
-
* Get available quality levels for HLS with proper error handling
|
|
43
|
-
*
|
|
44
25
|
* @param hlsInstance HLS.js instance
|
|
45
26
|
* @returns Array of quality level objects
|
|
46
27
|
*/
|
|
@@ -50,8 +31,6 @@ export declare class QualityManager {
|
|
|
50
31
|
originalIndex: number;
|
|
51
32
|
}>;
|
|
52
33
|
/**
|
|
53
|
-
* Get available quality levels for DASH with proper error handling
|
|
54
|
-
*
|
|
55
34
|
* @param dashInstance DASH.js instance
|
|
56
35
|
* @returns Array of quality level objects
|
|
57
36
|
*/
|
|
@@ -61,16 +40,11 @@ export declare class QualityManager {
|
|
|
61
40
|
id: string;
|
|
62
41
|
}>;
|
|
63
42
|
/**
|
|
64
|
-
* Unified quality setting function that works with both HLS and DASH
|
|
65
|
-
* Provides a single interface for quality management across streaming technologies
|
|
66
|
-
*
|
|
67
43
|
* @param streamType Type of stream (hls, dash, etc.)
|
|
68
44
|
* @param qualityIdentifier Quality level identifier (index for HLS, ID for DASH)
|
|
69
45
|
*/
|
|
70
|
-
static setQuality(streamType: StreamType, qualityIdentifier: string
|
|
46
|
+
static setQuality(streamType: StreamType, qualityIdentifier: string): void;
|
|
71
47
|
/**
|
|
72
|
-
* Enable auto quality switching for the current stream type
|
|
73
|
-
*
|
|
74
48
|
* @param streamType Type of stream (hls, dash, etc.)
|
|
75
49
|
*/
|
|
76
50
|
static setAutoQuality(streamType: StreamType): void;
|