@nikelroot/video-player 0.1.12 → 0.2.0

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/index.cjs CHANGED
@@ -471,39 +471,39 @@ var TimeBlock = ({ duration, currentTime }) => {
471
471
  formatTime(duration)
472
472
  ] });
473
473
  };
474
+ var ICON_PATHS = {
475
+ back: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
476
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M11 7l-6 5 6 5V7z" }),
477
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M19 7l-6 5 6 5V7z" })
478
+ ] }),
479
+ forward: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
480
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M5 7l6 5-6 5V7z" }),
481
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M13 7l6 5-6 5V7z" })
482
+ ] }),
483
+ fullscreen: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
484
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M5 10V5h5" }),
485
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M14 5h5v5" }),
486
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M19 14v5h-5" }),
487
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M10 19H5v-5" })
488
+ ] }),
489
+ mute: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
490
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M4 10v4h4l5 4V6l-5 4H4z" }),
491
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M17 9l4 6" }),
492
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M21 9l-4 6" })
493
+ ] }),
494
+ pause: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
495
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M8 6h3v12H8z" }),
496
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M13 6h3v12h-3z" })
497
+ ] }),
498
+ play: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M8 5v14l11-7L8 5z" }),
499
+ sound: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
500
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M4 10v4h4l5 4V6l-5 4H4z" }),
501
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M16 9a4 4 0 010 6" }),
502
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M18.5 6.5a8 8 0 010 11" })
503
+ ] })
504
+ };
474
505
  var Icon = ({ name }) => {
475
- const paths = {
476
- back: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
477
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M11 7l-6 5 6 5V7z" }),
478
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M19 7l-6 5 6 5V7z" })
479
- ] }),
480
- forward: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
481
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M5 7l6 5-6 5V7z" }),
482
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M13 7l6 5-6 5V7z" })
483
- ] }),
484
- fullscreen: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
485
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M5 10V5h5" }),
486
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M14 5h5v5" }),
487
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M19 14v5h-5" }),
488
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M10 19H5v-5" })
489
- ] }),
490
- mute: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
491
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M4 10v4h4l5 4V6l-5 4H4z" }),
492
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M17 9l4 6" }),
493
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M21 9l-4 6" })
494
- ] }),
495
- pause: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
496
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M8 6h3v12H8z" }),
497
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M13 6h3v12h-3z" })
498
- ] }),
499
- play: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M8 5v14l11-7L8 5z" }),
500
- sound: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
501
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M4 10v4h4l5 4V6l-5 4H4z" }),
502
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M16 9a4 4 0 010 6" }),
503
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M18.5 6.5a8 8 0 010 11" })
504
- ] })
505
- };
506
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { "aria-hidden": "true", className: "video-player-icon", focusable: "false", viewBox: "0 0 24 24", children: paths[name] });
506
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { "aria-hidden": "true", className: "video-player-icon", focusable: "false", viewBox: "0 0 24 24", children: ICON_PATHS[name] });
507
507
  };
508
508
  var ControlButton = ({
509
509
  disabled,
@@ -828,7 +828,6 @@ var VideoPlayerBase = (props, ref) => {
828
828
  scrollTo = true,
829
829
  muted: mutedProp,
830
830
  defaultMuted = false,
831
- currentTime: currentTimeProp,
832
831
  duration: durationProp,
833
832
  hlsConfig,
834
833
  vodHlsConfig,
@@ -863,17 +862,19 @@ var VideoPlayerBase = (props, ref) => {
863
862
  const [showControl, setControlVisible] = (0, import_react3.useState)(true);
864
863
  const [errorState, setErrorState] = (0, import_react3.useState)(null);
865
864
  const [reloadToken, setReloadToken] = (0, import_react3.useState)(0);
865
+ const showControlRef = (0, import_react3.useRef)(showControl);
866
866
  const playing = playingProp != null ? playingProp : playingState;
867
867
  const muted = mutedProp != null ? mutedProp : mutedState;
868
868
  const isDurationControlled = durationProp !== void 0;
869
- const isCurrentTimeControlled = currentTimeProp !== void 0;
870
869
  const duration = durationProp != null ? durationProp : durationState;
871
- const currentTime = currentTimeProp != null ? currentTimeProp : currentTimeState;
870
+ const currentTime = currentTimeState;
872
871
  const fullscreenAllowed = active != null ? active : true;
873
872
  const onTimeChangeRef = (0, import_react3.useRef)(onTimeChange);
874
873
  const onDurationChangeRef = (0, import_react3.useRef)(onDurationChange);
875
874
  onTimeChangeRef.current = onTimeChange;
876
875
  onDurationChangeRef.current = onDurationChange;
876
+ showControlRef.current = showControl;
877
+ const { currentTime: _ignoredCurrentTime, ...domVideoProps } = videoProps;
877
878
  const setTimeD = (0, import_react3.useRef)(
878
879
  createThrottledNumberFn((value) => {
879
880
  const v = videoRef.current;
@@ -881,6 +882,7 @@ var VideoPlayerBase = (props, ref) => {
881
882
  v.currentTime = value;
882
883
  }, 30)
883
884
  );
885
+ const setCurrentTimeUi = (0, import_react3.useRef)(createThrottledNumberFn((value) => setCurrentTimeState(value), 250));
884
886
  const clearTimers = (0, import_react3.useCallback)(() => {
885
887
  if (reloadTimer.current) {
886
888
  clearTimeout(reloadTimer.current);
@@ -954,9 +956,9 @@ var VideoPlayerBase = (props, ref) => {
954
956
  const el = videoRef.current;
955
957
  if (!el) return;
956
958
  const nextTime = Number.isFinite(el.currentTime) ? el.currentTime : 0;
957
- if (!isCurrentTimeControlled) setCurrentTimeState(nextTime);
959
+ setCurrentTimeUi.current(nextTime);
958
960
  (_a = onTimeChangeRef.current) == null ? void 0 : _a.call(onTimeChangeRef, nextTime, el);
959
- }, [isCurrentTimeControlled]);
961
+ }, []);
960
962
  const onDur = (0, import_react3.useCallback)(() => {
961
963
  var _a;
962
964
  const el = videoRef.current;
@@ -1037,10 +1039,11 @@ var VideoPlayerBase = (props, ref) => {
1037
1039
  if (!el) return;
1038
1040
  const next = clampTime(value, duration);
1039
1041
  setTimeD.current(next);
1040
- if (currentTimeProp === void 0) setCurrentTimeState(next);
1042
+ setCurrentTimeUi.current.cancel();
1043
+ setCurrentTimeState(next);
1041
1044
  notifyActiveChange(el, "seek");
1042
1045
  },
1043
- [currentTimeProp, duration, notifyActiveChange]
1046
+ [duration, notifyActiveChange]
1044
1047
  );
1045
1048
  const seekPrevAction = (0, import_react3.useCallback)(
1046
1049
  (sec = 15) => {
@@ -1288,10 +1291,10 @@ var VideoPlayerBase = (props, ref) => {
1288
1291
  notifyActiveChange(null, "destroy");
1289
1292
  setNextPlaying(false);
1290
1293
  if (durationProp === void 0) setDurationState(0);
1291
- if (currentTimeProp === void 0) setCurrentTimeState(0);
1294
+ setCurrentTimeUi.current.cancel();
1295
+ setCurrentTimeState(0);
1292
1296
  }, [
1293
1297
  clearTimers,
1294
- currentTimeProp,
1295
1298
  durationProp,
1296
1299
  notifyActiveChange,
1297
1300
  onDur,
@@ -1353,8 +1356,12 @@ var VideoPlayerBase = (props, ref) => {
1353
1356
  }, [clearErrorState]);
1354
1357
  const mouseMoveHandler = (0, import_react3.useCallback)(() => {
1355
1358
  if (controlTime.current) clearTimeout(controlTime.current);
1356
- setControlVisible(true);
1359
+ if (!showControlRef.current) {
1360
+ showControlRef.current = true;
1361
+ setControlVisible(true);
1362
+ }
1357
1363
  controlTime.current = setTimeout(() => {
1364
+ showControlRef.current = false;
1358
1365
  setControlVisible(false);
1359
1366
  }, 1e3 * 10);
1360
1367
  }, []);
@@ -1380,12 +1387,6 @@ var VideoPlayerBase = (props, ref) => {
1380
1387
  if (playingProp) void playAction();
1381
1388
  else pauseAction();
1382
1389
  }, [pauseAction, playAction, playingProp]);
1383
- (0, import_react3.useEffect)(() => {
1384
- const el = videoRef.current;
1385
- if (!el || currentTimeProp === void 0) return;
1386
- if (Math.abs(el.currentTime - currentTimeProp) < 0.25) return;
1387
- el.currentTime = clampTime(currentTimeProp, duration);
1388
- }, [currentTimeProp, duration]);
1389
1390
  (0, import_react3.useEffect)(() => {
1390
1391
  if (!videoRef.current) return;
1391
1392
  const loadId = sourceLoadId.current + 1;
@@ -1459,6 +1460,7 @@ var VideoPlayerBase = (props, ref) => {
1459
1460
  (0, import_react3.useEffect)(() => {
1460
1461
  return () => {
1461
1462
  setTimeD.current.cancel();
1463
+ setCurrentTimeUi.current.cancel();
1462
1464
  destroy();
1463
1465
  };
1464
1466
  }, [destroy]);
@@ -1500,7 +1502,7 @@ var VideoPlayerBase = (props, ref) => {
1500
1502
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1501
1503
  "video",
1502
1504
  {
1503
- ...videoProps,
1505
+ ...domVideoProps,
1504
1506
  controls: false,
1505
1507
  ref: setVideoEl,
1506
1508
  crossOrigin,
package/dist/index.d.cts CHANGED
@@ -58,7 +58,6 @@ interface VideoPlayerProps extends Omit<React.VideoHTMLAttributes<HTMLVideoEleme
58
58
  defaultPlaying?: boolean;
59
59
  playing?: boolean;
60
60
  onPlayingChange?: (playing: boolean) => void;
61
- currentTime?: number;
62
61
  duration?: number;
63
62
  onTimeChange?: (time: number, video: HTMLVideoElement) => void;
64
63
  onDurationChange?: (duration: number, video: HTMLVideoElement) => void;
package/dist/index.d.ts CHANGED
@@ -58,7 +58,6 @@ interface VideoPlayerProps extends Omit<React.VideoHTMLAttributes<HTMLVideoEleme
58
58
  defaultPlaying?: boolean;
59
59
  playing?: boolean;
60
60
  onPlayingChange?: (playing: boolean) => void;
61
- currentTime?: number;
62
61
  duration?: number;
63
62
  onTimeChange?: (time: number, video: HTMLVideoElement) => void;
64
63
  onDurationChange?: (duration: number, video: HTMLVideoElement) => void;
package/dist/index.js CHANGED
@@ -442,39 +442,39 @@ var TimeBlock = ({ duration, currentTime }) => {
442
442
  formatTime(duration)
443
443
  ] });
444
444
  };
445
+ var ICON_PATHS = {
446
+ back: /* @__PURE__ */ jsxs(Fragment, { children: [
447
+ /* @__PURE__ */ jsx("path", { d: "M11 7l-6 5 6 5V7z" }),
448
+ /* @__PURE__ */ jsx("path", { d: "M19 7l-6 5 6 5V7z" })
449
+ ] }),
450
+ forward: /* @__PURE__ */ jsxs(Fragment, { children: [
451
+ /* @__PURE__ */ jsx("path", { d: "M5 7l6 5-6 5V7z" }),
452
+ /* @__PURE__ */ jsx("path", { d: "M13 7l6 5-6 5V7z" })
453
+ ] }),
454
+ fullscreen: /* @__PURE__ */ jsxs(Fragment, { children: [
455
+ /* @__PURE__ */ jsx("path", { d: "M5 10V5h5" }),
456
+ /* @__PURE__ */ jsx("path", { d: "M14 5h5v5" }),
457
+ /* @__PURE__ */ jsx("path", { d: "M19 14v5h-5" }),
458
+ /* @__PURE__ */ jsx("path", { d: "M10 19H5v-5" })
459
+ ] }),
460
+ mute: /* @__PURE__ */ jsxs(Fragment, { children: [
461
+ /* @__PURE__ */ jsx("path", { d: "M4 10v4h4l5 4V6l-5 4H4z" }),
462
+ /* @__PURE__ */ jsx("path", { d: "M17 9l4 6" }),
463
+ /* @__PURE__ */ jsx("path", { d: "M21 9l-4 6" })
464
+ ] }),
465
+ pause: /* @__PURE__ */ jsxs(Fragment, { children: [
466
+ /* @__PURE__ */ jsx("path", { d: "M8 6h3v12H8z" }),
467
+ /* @__PURE__ */ jsx("path", { d: "M13 6h3v12h-3z" })
468
+ ] }),
469
+ play: /* @__PURE__ */ jsx("path", { d: "M8 5v14l11-7L8 5z" }),
470
+ sound: /* @__PURE__ */ jsxs(Fragment, { children: [
471
+ /* @__PURE__ */ jsx("path", { d: "M4 10v4h4l5 4V6l-5 4H4z" }),
472
+ /* @__PURE__ */ jsx("path", { d: "M16 9a4 4 0 010 6" }),
473
+ /* @__PURE__ */ jsx("path", { d: "M18.5 6.5a8 8 0 010 11" })
474
+ ] })
475
+ };
445
476
  var Icon = ({ name }) => {
446
- const paths = {
447
- back: /* @__PURE__ */ jsxs(Fragment, { children: [
448
- /* @__PURE__ */ jsx("path", { d: "M11 7l-6 5 6 5V7z" }),
449
- /* @__PURE__ */ jsx("path", { d: "M19 7l-6 5 6 5V7z" })
450
- ] }),
451
- forward: /* @__PURE__ */ jsxs(Fragment, { children: [
452
- /* @__PURE__ */ jsx("path", { d: "M5 7l6 5-6 5V7z" }),
453
- /* @__PURE__ */ jsx("path", { d: "M13 7l6 5-6 5V7z" })
454
- ] }),
455
- fullscreen: /* @__PURE__ */ jsxs(Fragment, { children: [
456
- /* @__PURE__ */ jsx("path", { d: "M5 10V5h5" }),
457
- /* @__PURE__ */ jsx("path", { d: "M14 5h5v5" }),
458
- /* @__PURE__ */ jsx("path", { d: "M19 14v5h-5" }),
459
- /* @__PURE__ */ jsx("path", { d: "M10 19H5v-5" })
460
- ] }),
461
- mute: /* @__PURE__ */ jsxs(Fragment, { children: [
462
- /* @__PURE__ */ jsx("path", { d: "M4 10v4h4l5 4V6l-5 4H4z" }),
463
- /* @__PURE__ */ jsx("path", { d: "M17 9l4 6" }),
464
- /* @__PURE__ */ jsx("path", { d: "M21 9l-4 6" })
465
- ] }),
466
- pause: /* @__PURE__ */ jsxs(Fragment, { children: [
467
- /* @__PURE__ */ jsx("path", { d: "M8 6h3v12H8z" }),
468
- /* @__PURE__ */ jsx("path", { d: "M13 6h3v12h-3z" })
469
- ] }),
470
- play: /* @__PURE__ */ jsx("path", { d: "M8 5v14l11-7L8 5z" }),
471
- sound: /* @__PURE__ */ jsxs(Fragment, { children: [
472
- /* @__PURE__ */ jsx("path", { d: "M4 10v4h4l5 4V6l-5 4H4z" }),
473
- /* @__PURE__ */ jsx("path", { d: "M16 9a4 4 0 010 6" }),
474
- /* @__PURE__ */ jsx("path", { d: "M18.5 6.5a8 8 0 010 11" })
475
- ] })
476
- };
477
- return /* @__PURE__ */ jsx("svg", { "aria-hidden": "true", className: "video-player-icon", focusable: "false", viewBox: "0 0 24 24", children: paths[name] });
477
+ return /* @__PURE__ */ jsx("svg", { "aria-hidden": "true", className: "video-player-icon", focusable: "false", viewBox: "0 0 24 24", children: ICON_PATHS[name] });
478
478
  };
479
479
  var ControlButton = ({
480
480
  disabled,
@@ -799,7 +799,6 @@ var VideoPlayerBase = (props, ref) => {
799
799
  scrollTo = true,
800
800
  muted: mutedProp,
801
801
  defaultMuted = false,
802
- currentTime: currentTimeProp,
803
802
  duration: durationProp,
804
803
  hlsConfig,
805
804
  vodHlsConfig,
@@ -834,17 +833,19 @@ var VideoPlayerBase = (props, ref) => {
834
833
  const [showControl, setControlVisible] = useState(true);
835
834
  const [errorState, setErrorState] = useState(null);
836
835
  const [reloadToken, setReloadToken] = useState(0);
836
+ const showControlRef = useRef2(showControl);
837
837
  const playing = playingProp != null ? playingProp : playingState;
838
838
  const muted = mutedProp != null ? mutedProp : mutedState;
839
839
  const isDurationControlled = durationProp !== void 0;
840
- const isCurrentTimeControlled = currentTimeProp !== void 0;
841
840
  const duration = durationProp != null ? durationProp : durationState;
842
- const currentTime = currentTimeProp != null ? currentTimeProp : currentTimeState;
841
+ const currentTime = currentTimeState;
843
842
  const fullscreenAllowed = active != null ? active : true;
844
843
  const onTimeChangeRef = useRef2(onTimeChange);
845
844
  const onDurationChangeRef = useRef2(onDurationChange);
846
845
  onTimeChangeRef.current = onTimeChange;
847
846
  onDurationChangeRef.current = onDurationChange;
847
+ showControlRef.current = showControl;
848
+ const { currentTime: _ignoredCurrentTime, ...domVideoProps } = videoProps;
848
849
  const setTimeD = useRef2(
849
850
  createThrottledNumberFn((value) => {
850
851
  const v = videoRef.current;
@@ -852,6 +853,7 @@ var VideoPlayerBase = (props, ref) => {
852
853
  v.currentTime = value;
853
854
  }, 30)
854
855
  );
856
+ const setCurrentTimeUi = useRef2(createThrottledNumberFn((value) => setCurrentTimeState(value), 250));
855
857
  const clearTimers = useCallback(() => {
856
858
  if (reloadTimer.current) {
857
859
  clearTimeout(reloadTimer.current);
@@ -925,9 +927,9 @@ var VideoPlayerBase = (props, ref) => {
925
927
  const el = videoRef.current;
926
928
  if (!el) return;
927
929
  const nextTime = Number.isFinite(el.currentTime) ? el.currentTime : 0;
928
- if (!isCurrentTimeControlled) setCurrentTimeState(nextTime);
930
+ setCurrentTimeUi.current(nextTime);
929
931
  (_a = onTimeChangeRef.current) == null ? void 0 : _a.call(onTimeChangeRef, nextTime, el);
930
- }, [isCurrentTimeControlled]);
932
+ }, []);
931
933
  const onDur = useCallback(() => {
932
934
  var _a;
933
935
  const el = videoRef.current;
@@ -1008,10 +1010,11 @@ var VideoPlayerBase = (props, ref) => {
1008
1010
  if (!el) return;
1009
1011
  const next = clampTime(value, duration);
1010
1012
  setTimeD.current(next);
1011
- if (currentTimeProp === void 0) setCurrentTimeState(next);
1013
+ setCurrentTimeUi.current.cancel();
1014
+ setCurrentTimeState(next);
1012
1015
  notifyActiveChange(el, "seek");
1013
1016
  },
1014
- [currentTimeProp, duration, notifyActiveChange]
1017
+ [duration, notifyActiveChange]
1015
1018
  );
1016
1019
  const seekPrevAction = useCallback(
1017
1020
  (sec = 15) => {
@@ -1259,10 +1262,10 @@ var VideoPlayerBase = (props, ref) => {
1259
1262
  notifyActiveChange(null, "destroy");
1260
1263
  setNextPlaying(false);
1261
1264
  if (durationProp === void 0) setDurationState(0);
1262
- if (currentTimeProp === void 0) setCurrentTimeState(0);
1265
+ setCurrentTimeUi.current.cancel();
1266
+ setCurrentTimeState(0);
1263
1267
  }, [
1264
1268
  clearTimers,
1265
- currentTimeProp,
1266
1269
  durationProp,
1267
1270
  notifyActiveChange,
1268
1271
  onDur,
@@ -1324,8 +1327,12 @@ var VideoPlayerBase = (props, ref) => {
1324
1327
  }, [clearErrorState]);
1325
1328
  const mouseMoveHandler = useCallback(() => {
1326
1329
  if (controlTime.current) clearTimeout(controlTime.current);
1327
- setControlVisible(true);
1330
+ if (!showControlRef.current) {
1331
+ showControlRef.current = true;
1332
+ setControlVisible(true);
1333
+ }
1328
1334
  controlTime.current = setTimeout(() => {
1335
+ showControlRef.current = false;
1329
1336
  setControlVisible(false);
1330
1337
  }, 1e3 * 10);
1331
1338
  }, []);
@@ -1351,12 +1358,6 @@ var VideoPlayerBase = (props, ref) => {
1351
1358
  if (playingProp) void playAction();
1352
1359
  else pauseAction();
1353
1360
  }, [pauseAction, playAction, playingProp]);
1354
- useEffect(() => {
1355
- const el = videoRef.current;
1356
- if (!el || currentTimeProp === void 0) return;
1357
- if (Math.abs(el.currentTime - currentTimeProp) < 0.25) return;
1358
- el.currentTime = clampTime(currentTimeProp, duration);
1359
- }, [currentTimeProp, duration]);
1360
1361
  useEffect(() => {
1361
1362
  if (!videoRef.current) return;
1362
1363
  const loadId = sourceLoadId.current + 1;
@@ -1430,6 +1431,7 @@ var VideoPlayerBase = (props, ref) => {
1430
1431
  useEffect(() => {
1431
1432
  return () => {
1432
1433
  setTimeD.current.cancel();
1434
+ setCurrentTimeUi.current.cancel();
1433
1435
  destroy();
1434
1436
  };
1435
1437
  }, [destroy]);
@@ -1471,7 +1473,7 @@ var VideoPlayerBase = (props, ref) => {
1471
1473
  /* @__PURE__ */ jsx2(
1472
1474
  "video",
1473
1475
  {
1474
- ...videoProps,
1476
+ ...domVideoProps,
1475
1477
  controls: false,
1476
1478
  ref: setVideoEl,
1477
1479
  crossOrigin,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nikelroot/video-player",
3
- "version": "0.1.12",
3
+ "version": "0.2.0",
4
4
  "description": "Standalone React video player with HLS support.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",