@rxdrag/website-lib-core 0.0.110 → 0.0.111
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rxdrag/website-lib-core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.111",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./index.ts"
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"eslint": "^7.32.0",
|
|
26
26
|
"typescript": "^5",
|
|
27
27
|
"@rxdrag/eslint-config-custom": "0.2.12",
|
|
28
|
-
"@rxdrag/
|
|
29
|
-
"@rxdrag/
|
|
28
|
+
"@rxdrag/tsconfig": "0.2.0",
|
|
29
|
+
"@rxdrag/slate-preview": "1.2.63"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@iconify/utils": "^3.0.2",
|
|
@@ -19,6 +19,8 @@ export type VideoPlayerClassNames = {
|
|
|
19
19
|
playButtonOuter?: string;
|
|
20
20
|
playButtonInner?: string;
|
|
21
21
|
playIcon?: string;
|
|
22
|
+
loadingOverlay?: string;
|
|
23
|
+
loadingContent?: string;
|
|
22
24
|
overlay?: string;
|
|
23
25
|
overlayTitle?: string;
|
|
24
26
|
ctaButton?: string;
|
|
@@ -57,6 +59,7 @@ export const ReactVideoPlayer = forwardRef<
|
|
|
57
59
|
const sourceReadyRef = useRef(false);
|
|
58
60
|
const [isLoading, setIsLoading] = useState(false);
|
|
59
61
|
const isEndedRef = useRef(false);
|
|
62
|
+
const [hasStarted, setHasStarted] = useState(false);
|
|
60
63
|
|
|
61
64
|
const ensureSourceReady = useCallback(() => {
|
|
62
65
|
const video = videoRef.current;
|
|
@@ -163,6 +166,7 @@ export const ReactVideoPlayer = forwardRef<
|
|
|
163
166
|
setIsEnded(false);
|
|
164
167
|
isEndedRef.current = false;
|
|
165
168
|
setIsLoading(false);
|
|
169
|
+
setHasStarted(true);
|
|
166
170
|
};
|
|
167
171
|
const onPause = () => setIsPlaying(false);
|
|
168
172
|
const onEnded = () => {
|
|
@@ -223,7 +227,8 @@ export const ReactVideoPlayer = forwardRef<
|
|
|
223
227
|
"w-full h-full rounded-lg object-cover",
|
|
224
228
|
classNames?.video
|
|
225
229
|
)}
|
|
226
|
-
|
|
230
|
+
playsInline
|
|
231
|
+
controls={!designMode && hasStarted}
|
|
227
232
|
>
|
|
228
233
|
{!media.storageType && media.file?.original && (eagerLoad || isSourceReady) ? (
|
|
229
234
|
<source src={media.file.original} />
|
|
@@ -276,11 +281,16 @@ export const ReactVideoPlayer = forwardRef<
|
|
|
276
281
|
<div
|
|
277
282
|
className={clsx(
|
|
278
283
|
"absolute inset-0 flex items-center justify-center w-full h-full rounded-lg z-10 bg-black/20",
|
|
279
|
-
classNames?.
|
|
284
|
+
classNames?.loadingOverlay
|
|
280
285
|
)}
|
|
281
286
|
onClick={(e) => e.stopPropagation()}
|
|
282
287
|
>
|
|
283
|
-
<div
|
|
288
|
+
<div
|
|
289
|
+
className={clsx(
|
|
290
|
+
"flex items-center gap-3 rounded-full bg-black/50 px-4 py-2 text-white",
|
|
291
|
+
classNames?.loadingContent
|
|
292
|
+
)}
|
|
293
|
+
>
|
|
284
294
|
<div className="h-4 w-4 animate-spin rounded-full border-2 border-white/30 border-t-white" />
|
|
285
295
|
<span className="text-sm">Loading...</span>
|
|
286
296
|
</div>
|