@rxdrag/website-lib-core 0.0.110 → 0.0.112

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.110",
3
+ "version": "0.0.112",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./index.ts"
@@ -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;
@@ -32,6 +34,7 @@ export const ReactVideoPlayer = forwardRef<
32
34
  media: Media;
33
35
  posterUrl?: string;
34
36
  eagerLoad?: boolean;
37
+ showOverlayAfterStarted?: boolean;
35
38
  classNames?: VideoPlayerClassNames;
36
39
  callToAction?: string;
37
40
  onToggleSelect?: (id: ID) => void;
@@ -44,6 +47,7 @@ export const ReactVideoPlayer = forwardRef<
44
47
  onToggleSelect,
45
48
  posterUrl,
46
49
  eagerLoad,
50
+ showOverlayAfterStarted = true,
47
51
  classNames,
48
52
  callToAction,
49
53
  designMode,
@@ -57,6 +61,7 @@ export const ReactVideoPlayer = forwardRef<
57
61
  const sourceReadyRef = useRef(false);
58
62
  const [isLoading, setIsLoading] = useState(false);
59
63
  const isEndedRef = useRef(false);
64
+ const [hasStarted, setHasStarted] = useState(false);
60
65
 
61
66
  const ensureSourceReady = useCallback(() => {
62
67
  const video = videoRef.current;
@@ -163,6 +168,7 @@ export const ReactVideoPlayer = forwardRef<
163
168
  setIsEnded(false);
164
169
  isEndedRef.current = false;
165
170
  setIsLoading(false);
171
+ setHasStarted(true);
166
172
  };
167
173
  const onPause = () => setIsPlaying(false);
168
174
  const onEnded = () => {
@@ -223,7 +229,8 @@ export const ReactVideoPlayer = forwardRef<
223
229
  "w-full h-full rounded-lg object-cover",
224
230
  classNames?.video
225
231
  )}
226
- controls={!designMode}
232
+ playsInline
233
+ controls={!designMode && hasStarted}
227
234
  >
228
235
  {!media.storageType && media.file?.original && (eagerLoad || isSourceReady) ? (
229
236
  <source src={media.file.original} />
@@ -231,7 +238,10 @@ export const ReactVideoPlayer = forwardRef<
231
238
  Your browser does not support video playback.
232
239
  </video>
233
240
 
234
- {!isPlaying && !isEnded && !isLoading && (
241
+ {!isPlaying &&
242
+ !isEnded &&
243
+ !isLoading &&
244
+ (!hasStarted || showOverlayAfterStarted) && (
235
245
  <button
236
246
  type="button"
237
247
  onClick={handlePlayClick}
@@ -276,11 +286,16 @@ export const ReactVideoPlayer = forwardRef<
276
286
  <div
277
287
  className={clsx(
278
288
  "absolute inset-0 flex items-center justify-center w-full h-full rounded-lg z-10 bg-black/20",
279
- classNames?.playButton
289
+ classNames?.loadingOverlay
280
290
  )}
281
291
  onClick={(e) => e.stopPropagation()}
282
292
  >
283
- <div className="flex items-center gap-3 rounded-full bg-black/50 px-4 py-2 text-white">
293
+ <div
294
+ className={clsx(
295
+ "flex items-center gap-3 rounded-full bg-black/50 px-4 py-2 text-white",
296
+ classNames?.loadingContent
297
+ )}
298
+ >
284
299
  <div className="h-4 w-4 animate-spin rounded-full border-2 border-white/30 border-t-white" />
285
300
  <span className="text-sm">Loading...</span>
286
301
  </div>