stormcloud-video-player 0.2.4 → 0.2.5
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/stormcloud-vp.min.js +2 -2
- package/lib/index.cjs +418 -56
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +29 -0
- package/lib/index.d.ts +29 -0
- package/lib/index.js +418 -56
- package/lib/index.js.map +1 -1
- package/lib/types-DOcCdwQI.d.cts +78 -0
- package/lib/ui/StormcloudVideoPlayer.cjs +66 -3
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
interface StormcloudVideoPlayerConfig {
|
|
2
|
+
videoElement: HTMLVideoElement;
|
|
3
|
+
src: string;
|
|
4
|
+
autoplay?: boolean;
|
|
5
|
+
muted?: boolean;
|
|
6
|
+
allowNativeHls?: boolean;
|
|
7
|
+
lowLatencyMode?: boolean;
|
|
8
|
+
driftToleranceMs?: number;
|
|
9
|
+
immediateManifestAds?: boolean;
|
|
10
|
+
debugAdTiming?: boolean;
|
|
11
|
+
adFailsafeTimeoutMs?: number;
|
|
12
|
+
showCustomControls?: boolean;
|
|
13
|
+
onVolumeToggle?: () => void;
|
|
14
|
+
onFullscreenToggle?: () => void;
|
|
15
|
+
onControlClick?: () => void;
|
|
16
|
+
licenseKey?: string;
|
|
17
|
+
adBreakGapToleranceMs?: number;
|
|
18
|
+
maxAdsPerBreak?: number;
|
|
19
|
+
minAdDurationMs?: number;
|
|
20
|
+
enableAdPreloading?: boolean;
|
|
21
|
+
}
|
|
22
|
+
interface AdInfo {
|
|
23
|
+
duration: number;
|
|
24
|
+
vastTagUrl: string;
|
|
25
|
+
isPreloaded: boolean;
|
|
26
|
+
}
|
|
27
|
+
interface ImaController {
|
|
28
|
+
initialize: () => void;
|
|
29
|
+
requestAds: (vastTagUrl: string) => Promise<void>;
|
|
30
|
+
play: () => Promise<void>;
|
|
31
|
+
stop: () => Promise<void>;
|
|
32
|
+
destroy: () => void;
|
|
33
|
+
isAdPlaying: () => boolean;
|
|
34
|
+
resize: (width: number, height: number) => void;
|
|
35
|
+
on: (event: string, listener: (payload?: any) => void) => void;
|
|
36
|
+
off: (event: string, listener: (payload?: any) => void) => void;
|
|
37
|
+
updateOriginalMutedState: (muted: boolean) => void;
|
|
38
|
+
getOriginalMutedState: () => boolean;
|
|
39
|
+
setAdVolume: (volume: number) => void;
|
|
40
|
+
getAdVolume: () => number;
|
|
41
|
+
getAdDuration: () => number;
|
|
42
|
+
preloadAds: (vastTagUrls: string[]) => Promise<AdInfo[]>;
|
|
43
|
+
}
|
|
44
|
+
interface ClientInfo {
|
|
45
|
+
brand: string;
|
|
46
|
+
os: string;
|
|
47
|
+
model: string;
|
|
48
|
+
deviceType: "tv" | "mobile" | "tablet" | "desktop";
|
|
49
|
+
isSmartTV: boolean;
|
|
50
|
+
isAndroid: boolean;
|
|
51
|
+
isWebView: boolean;
|
|
52
|
+
isWebApp: boolean;
|
|
53
|
+
domain: string;
|
|
54
|
+
origin: string;
|
|
55
|
+
path: string;
|
|
56
|
+
userAgent: string;
|
|
57
|
+
vendor: string;
|
|
58
|
+
platform: string;
|
|
59
|
+
screen: {
|
|
60
|
+
width?: number;
|
|
61
|
+
height?: number;
|
|
62
|
+
availWidth?: number;
|
|
63
|
+
availHeight?: number;
|
|
64
|
+
orientation?: string;
|
|
65
|
+
pixelDepth?: number;
|
|
66
|
+
};
|
|
67
|
+
hardwareConcurrency: number;
|
|
68
|
+
deviceMemory: number | null;
|
|
69
|
+
maxTouchPoints: number;
|
|
70
|
+
language: string;
|
|
71
|
+
languages: string;
|
|
72
|
+
cookieEnabled: boolean;
|
|
73
|
+
doNotTrack: string;
|
|
74
|
+
referrer: string;
|
|
75
|
+
visibilityState: string;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export type { AdInfo as A, ClientInfo as C, ImaController as I, StormcloudVideoPlayerConfig as S };
|
|
@@ -1807,6 +1807,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(
|
|
|
1807
1807
|
const [isLoading, setIsLoading] = import_react.default.useState(true);
|
|
1808
1808
|
const [isBuffering, setIsBuffering] = import_react.default.useState(false);
|
|
1809
1809
|
const [showCenterPlay, setShowCenterPlay] = import_react.default.useState(false);
|
|
1810
|
+
const [showLicenseWarning, setShowLicenseWarning] = import_react.default.useState(false);
|
|
1810
1811
|
const formatTime = (seconds) => {
|
|
1811
1812
|
if (!isFinite(seconds)) return "0:00:00";
|
|
1812
1813
|
const hours = Math.floor(seconds / 3600);
|
|
@@ -1864,6 +1865,15 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(
|
|
|
1864
1865
|
if (typeof window === "undefined") return;
|
|
1865
1866
|
const el = videoRef.current;
|
|
1866
1867
|
if (!el || !src) return;
|
|
1868
|
+
if (!licenseKey) {
|
|
1869
|
+
setShowLicenseWarning(true);
|
|
1870
|
+
setIsLoading(false);
|
|
1871
|
+
console.warn(
|
|
1872
|
+
"StormcloudVideoPlayer: License key is required but not provided. Please set the licenseKey prop to use the player."
|
|
1873
|
+
);
|
|
1874
|
+
return;
|
|
1875
|
+
}
|
|
1876
|
+
setShowLicenseWarning(false);
|
|
1867
1877
|
if (playerRef.current) {
|
|
1868
1878
|
try {
|
|
1869
1879
|
playerRef.current.destroy();
|
|
@@ -2187,7 +2197,60 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(
|
|
|
2187
2197
|
)
|
|
2188
2198
|
}
|
|
2189
2199
|
),
|
|
2190
|
-
|
|
2200
|
+
showLicenseWarning && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
2201
|
+
"div",
|
|
2202
|
+
{
|
|
2203
|
+
style: {
|
|
2204
|
+
position: "absolute",
|
|
2205
|
+
top: "50%",
|
|
2206
|
+
left: "50%",
|
|
2207
|
+
transform: "translate(-50%, -50%)",
|
|
2208
|
+
zIndex: 25,
|
|
2209
|
+
background: "linear-gradient(135deg, rgba(220, 38, 38, 0.95) 0%, rgba(185, 28, 28, 0.9) 100%)",
|
|
2210
|
+
color: "white",
|
|
2211
|
+
padding: "24px 32px",
|
|
2212
|
+
borderRadius: "16px",
|
|
2213
|
+
backdropFilter: "blur(20px)",
|
|
2214
|
+
border: "2px solid rgba(255, 255, 255, 0.2)",
|
|
2215
|
+
boxShadow: "0 20px 60px rgba(0, 0, 0, 0.6), inset 0 2px 0 rgba(255, 255, 255, 0.2)",
|
|
2216
|
+
textAlign: "center",
|
|
2217
|
+
maxWidth: "400px",
|
|
2218
|
+
margin: "0 16px"
|
|
2219
|
+
},
|
|
2220
|
+
children: [
|
|
2221
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2222
|
+
"div",
|
|
2223
|
+
{
|
|
2224
|
+
style: {
|
|
2225
|
+
fontSize: "20px",
|
|
2226
|
+
fontWeight: "bold",
|
|
2227
|
+
marginBottom: "12px",
|
|
2228
|
+
color: "#ffffff",
|
|
2229
|
+
textShadow: "0 2px 4px rgba(0, 0, 0, 0.5)"
|
|
2230
|
+
},
|
|
2231
|
+
children: "License Key Required"
|
|
2232
|
+
}
|
|
2233
|
+
),
|
|
2234
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
2235
|
+
"div",
|
|
2236
|
+
{
|
|
2237
|
+
style: {
|
|
2238
|
+
fontSize: "14px",
|
|
2239
|
+
lineHeight: "1.5",
|
|
2240
|
+
color: "rgba(255, 255, 255, 0.9)",
|
|
2241
|
+
textShadow: "0 1px 2px rgba(0, 0, 0, 0.3)"
|
|
2242
|
+
},
|
|
2243
|
+
children: [
|
|
2244
|
+
"Please provide a valid license key to use the Stormcloud Video Player.",
|
|
2245
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("br", {}),
|
|
2246
|
+
"Contact your administrator for licensing information."
|
|
2247
|
+
]
|
|
2248
|
+
}
|
|
2249
|
+
)
|
|
2250
|
+
]
|
|
2251
|
+
}
|
|
2252
|
+
),
|
|
2253
|
+
showCenterPlay && !isLoading && !isBuffering && !showLicenseWarning && !adStatus.showAds && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2191
2254
|
"div",
|
|
2192
2255
|
{
|
|
2193
2256
|
onClick: handleCenterPlayClick,
|
|
@@ -2238,7 +2301,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(
|
|
|
2238
2301
|
)
|
|
2239
2302
|
}
|
|
2240
2303
|
),
|
|
2241
|
-
shouldShowEnhancedControls ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
2304
|
+
shouldShowEnhancedControls && !showLicenseWarning ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
2242
2305
|
"div",
|
|
2243
2306
|
{
|
|
2244
2307
|
style: {
|
|
@@ -2703,7 +2766,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(
|
|
|
2703
2766
|
)
|
|
2704
2767
|
]
|
|
2705
2768
|
}
|
|
2706
|
-
) }) : showCustomControls && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
2769
|
+
) }) : showCustomControls && !showLicenseWarning && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
2707
2770
|
"div",
|
|
2708
2771
|
{
|
|
2709
2772
|
style: {
|