@videojs/react 10.0.0-beta.6 → 10.0.0-beta.8
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/default/icons/dist/react/default/captions-off.js +0 -1
- package/dist/default/icons/dist/react/default/captions-off.js.map +1 -1
- package/dist/default/icons/dist/react/default/captions-on.js +0 -1
- package/dist/default/icons/dist/react/default/captions-on.js.map +1 -1
- package/dist/default/icons/dist/react/default/fullscreen-enter.js +0 -1
- package/dist/default/icons/dist/react/default/fullscreen-enter.js.map +1 -1
- package/dist/default/icons/dist/react/default/fullscreen-exit.js +0 -1
- package/dist/default/icons/dist/react/default/fullscreen-exit.js.map +1 -1
- package/dist/default/icons/dist/react/default/pause.js +0 -1
- package/dist/default/icons/dist/react/default/pause.js.map +1 -1
- package/dist/default/icons/dist/react/default/pip-enter.js +33 -0
- package/dist/default/icons/dist/react/default/pip-enter.js.map +1 -0
- package/dist/default/icons/dist/react/default/pip-exit.js +33 -0
- package/dist/default/icons/dist/react/default/pip-exit.js.map +1 -0
- package/dist/default/icons/dist/react/default/play.js +0 -1
- package/dist/default/icons/dist/react/default/play.js.map +1 -1
- package/dist/default/icons/dist/react/default/restart.js +0 -1
- package/dist/default/icons/dist/react/default/restart.js.map +1 -1
- package/dist/default/icons/dist/react/default/seek.js +0 -1
- package/dist/default/icons/dist/react/default/seek.js.map +1 -1
- package/dist/default/icons/dist/react/default/spinner.js +0 -1
- package/dist/default/icons/dist/react/default/spinner.js.map +1 -1
- package/dist/default/icons/dist/react/default/volume-high.js +0 -1
- package/dist/default/icons/dist/react/default/volume-high.js.map +1 -1
- package/dist/default/icons/dist/react/default/volume-low.js +0 -1
- package/dist/default/icons/dist/react/default/volume-low.js.map +1 -1
- package/dist/default/icons/dist/react/default/volume-off.js +0 -1
- package/dist/default/icons/dist/react/default/volume-off.js.map +1 -1
- package/dist/default/icons/dist/react/minimal/captions-off.js +0 -1
- package/dist/default/icons/dist/react/minimal/captions-off.js.map +1 -1
- package/dist/default/icons/dist/react/minimal/captions-on.js +0 -1
- package/dist/default/icons/dist/react/minimal/captions-on.js.map +1 -1
- package/dist/default/icons/dist/react/minimal/fullscreen-enter.js +0 -1
- package/dist/default/icons/dist/react/minimal/fullscreen-enter.js.map +1 -1
- package/dist/default/icons/dist/react/minimal/fullscreen-exit.js +0 -1
- package/dist/default/icons/dist/react/minimal/fullscreen-exit.js.map +1 -1
- package/dist/default/icons/dist/react/minimal/pause.js +0 -1
- package/dist/default/icons/dist/react/minimal/pause.js.map +1 -1
- package/dist/default/icons/dist/react/minimal/pip-enter.js +37 -0
- package/dist/default/icons/dist/react/minimal/pip-enter.js.map +1 -0
- package/dist/default/icons/dist/react/minimal/pip-exit.js +37 -0
- package/dist/default/icons/dist/react/minimal/pip-exit.js.map +1 -0
- package/dist/default/icons/dist/react/minimal/play.js +0 -1
- package/dist/default/icons/dist/react/minimal/play.js.map +1 -1
- package/dist/default/icons/dist/react/minimal/restart.js +0 -1
- package/dist/default/icons/dist/react/minimal/restart.js.map +1 -1
- package/dist/default/icons/dist/react/minimal/seek.js +0 -1
- package/dist/default/icons/dist/react/minimal/seek.js.map +1 -1
- package/dist/default/icons/dist/react/minimal/spinner.js +0 -1
- package/dist/default/icons/dist/react/minimal/spinner.js.map +1 -1
- package/dist/default/icons/dist/react/minimal/volume-high.js +0 -1
- package/dist/default/icons/dist/react/minimal/volume-high.js.map +1 -1
- package/dist/default/icons/dist/react/minimal/volume-low.js +0 -1
- package/dist/default/icons/dist/react/minimal/volume-low.js.map +1 -1
- package/dist/default/icons/dist/react/minimal/volume-off.js +0 -1
- package/dist/default/icons/dist/react/minimal/volume-off.js.map +1 -1
- package/dist/default/index.js +2 -2
- package/dist/default/media/audio.js +3 -6
- package/dist/default/media/audio.js.map +1 -1
- package/dist/default/media/background-video/index.js +2 -2
- package/dist/default/media/background-video/index.js.map +1 -1
- package/dist/default/media/dash-video/index.js +26 -0
- package/dist/default/media/dash-video/index.js.map +1 -0
- package/dist/default/media/hls-video/index.js +2 -2
- package/dist/default/media/hls-video/index.js.map +1 -1
- package/dist/default/media/simple-hls-video/index.js +2 -2
- package/dist/default/media/simple-hls-video/index.js.map +1 -1
- package/dist/default/media/video.js +3 -6
- package/dist/default/media/video.js.map +1 -1
- package/dist/default/player/context.js +16 -10
- package/dist/default/player/context.js.map +1 -1
- package/dist/default/player/create-player.js +16 -2
- package/dist/default/player/create-player.js.map +1 -1
- package/dist/default/presets/audio/minimal-skin.css +22 -12
- package/dist/default/presets/audio/minimal-skin.js +32 -26
- package/dist/default/presets/audio/minimal-skin.js.map +1 -1
- package/dist/default/presets/audio/minimal-skin.tailwind.js +36 -30
- package/dist/default/presets/audio/minimal-skin.tailwind.js.map +1 -1
- package/dist/default/presets/audio/skin.css +19 -14
- package/dist/default/presets/audio/skin.js +32 -26
- package/dist/default/presets/audio/skin.js.map +1 -1
- package/dist/default/presets/audio/skin.tailwind.js +37 -32
- package/dist/default/presets/audio/skin.tailwind.js.map +1 -1
- package/dist/default/presets/video/minimal-skin.css +101 -63
- package/dist/default/presets/video/minimal-skin.js +45 -31
- package/dist/default/presets/video/minimal-skin.js.map +1 -1
- package/dist/default/presets/video/minimal-skin.tailwind.js +51 -34
- package/dist/default/presets/video/minimal-skin.tailwind.js.map +1 -1
- package/dist/default/presets/video/skin.css +98 -64
- package/dist/default/presets/video/skin.js +45 -31
- package/dist/default/presets/video/skin.js.map +1 -1
- package/dist/default/presets/video/skin.tailwind.js +51 -34
- package/dist/default/presets/video/skin.tailwind.js.map +1 -1
- package/dist/default/skins/dist/default/default/tailwind/audio.tailwind.js +6 -5
- package/dist/default/skins/dist/default/default/tailwind/audio.tailwind.js.map +1 -1
- package/dist/default/skins/dist/default/default/tailwind/components/controls.js +1 -1
- package/dist/default/skins/dist/default/default/tailwind/components/controls.js.map +1 -1
- package/dist/default/skins/dist/default/default/tailwind/components/error.js +1 -1
- package/dist/default/skins/dist/default/default/tailwind/components/error.js.map +1 -1
- package/dist/default/skins/dist/default/default/tailwind/components/poster.js +16 -0
- package/dist/default/skins/dist/default/default/tailwind/components/poster.js.map +1 -0
- package/dist/default/skins/dist/default/default/tailwind/video.tailwind.js +6 -5
- package/dist/default/skins/dist/default/default/tailwind/video.tailwind.js.map +1 -1
- package/dist/default/skins/dist/default/minimal/tailwind/audio.tailwind.js +1 -1
- package/dist/default/skins/dist/default/minimal/tailwind/audio.tailwind.js.map +1 -1
- package/dist/default/skins/dist/default/minimal/tailwind/components/controls.js +1 -1
- package/dist/default/skins/dist/default/minimal/tailwind/components/controls.js.map +1 -1
- package/dist/default/skins/dist/default/minimal/tailwind/components/error.js +1 -1
- package/dist/default/skins/dist/default/minimal/tailwind/components/error.js.map +1 -1
- package/dist/default/skins/dist/default/minimal/tailwind/components/poster.js +16 -0
- package/dist/default/skins/dist/default/minimal/tailwind/components/poster.js.map +1 -0
- package/dist/default/skins/dist/default/minimal/tailwind/components/time.js +1 -1
- package/dist/default/skins/dist/default/minimal/tailwind/components/time.js.map +1 -1
- package/dist/default/skins/dist/default/minimal/tailwind/video.tailwind.js +5 -4
- package/dist/default/skins/dist/default/minimal/tailwind/video.tailwind.js.map +1 -1
- package/dist/default/skins/dist/default/shared/tailwind/icon-state.js +5 -0
- package/dist/default/skins/dist/default/shared/tailwind/icon-state.js.map +1 -1
- package/dist/default/ui/popover/popover-popup.js +11 -2
- package/dist/default/ui/popover/popover-popup.js.map +1 -1
- package/dist/default/ui/time-slider/time-slider-root.js +1 -1
- package/dist/default/ui/time-slider/time-slider-root.js.map +1 -1
- package/dist/default/ui/tooltip/tooltip-popup.js +11 -2
- package/dist/default/ui/tooltip/tooltip-popup.js.map +1 -1
- package/dist/default/ui/volume-slider/volume-slider-root.js +3 -3
- package/dist/default/ui/volume-slider/volume-slider-root.js.map +1 -1
- package/dist/default/utils/use-render.js +5 -1
- package/dist/default/utils/use-render.js.map +1 -1
- package/dist/dev/icons/dist/react/default/captions-off.js +0 -1
- package/dist/dev/icons/dist/react/default/captions-off.js.map +1 -1
- package/dist/dev/icons/dist/react/default/captions-on.js +0 -1
- package/dist/dev/icons/dist/react/default/captions-on.js.map +1 -1
- package/dist/dev/icons/dist/react/default/fullscreen-enter.js +0 -1
- package/dist/dev/icons/dist/react/default/fullscreen-enter.js.map +1 -1
- package/dist/dev/icons/dist/react/default/fullscreen-exit.js +0 -1
- package/dist/dev/icons/dist/react/default/fullscreen-exit.js.map +1 -1
- package/dist/dev/icons/dist/react/default/pause.js +0 -1
- package/dist/dev/icons/dist/react/default/pause.js.map +1 -1
- package/dist/dev/icons/dist/react/default/pip-enter.js +33 -0
- package/dist/dev/icons/dist/react/default/pip-enter.js.map +1 -0
- package/dist/dev/icons/dist/react/default/pip-exit.js +33 -0
- package/dist/dev/icons/dist/react/default/pip-exit.js.map +1 -0
- package/dist/dev/icons/dist/react/default/play.js +0 -1
- package/dist/dev/icons/dist/react/default/play.js.map +1 -1
- package/dist/dev/icons/dist/react/default/restart.js +0 -1
- package/dist/dev/icons/dist/react/default/restart.js.map +1 -1
- package/dist/dev/icons/dist/react/default/seek.js +0 -1
- package/dist/dev/icons/dist/react/default/seek.js.map +1 -1
- package/dist/dev/icons/dist/react/default/spinner.js +0 -1
- package/dist/dev/icons/dist/react/default/spinner.js.map +1 -1
- package/dist/dev/icons/dist/react/default/volume-high.js +0 -1
- package/dist/dev/icons/dist/react/default/volume-high.js.map +1 -1
- package/dist/dev/icons/dist/react/default/volume-low.js +0 -1
- package/dist/dev/icons/dist/react/default/volume-low.js.map +1 -1
- package/dist/dev/icons/dist/react/default/volume-off.js +0 -1
- package/dist/dev/icons/dist/react/default/volume-off.js.map +1 -1
- package/dist/dev/icons/dist/react/minimal/captions-off.js +0 -1
- package/dist/dev/icons/dist/react/minimal/captions-off.js.map +1 -1
- package/dist/dev/icons/dist/react/minimal/captions-on.js +0 -1
- package/dist/dev/icons/dist/react/minimal/captions-on.js.map +1 -1
- package/dist/dev/icons/dist/react/minimal/fullscreen-enter.js +0 -1
- package/dist/dev/icons/dist/react/minimal/fullscreen-enter.js.map +1 -1
- package/dist/dev/icons/dist/react/minimal/fullscreen-exit.js +0 -1
- package/dist/dev/icons/dist/react/minimal/fullscreen-exit.js.map +1 -1
- package/dist/dev/icons/dist/react/minimal/pause.js +0 -1
- package/dist/dev/icons/dist/react/minimal/pause.js.map +1 -1
- package/dist/dev/icons/dist/react/minimal/pip-enter.js +37 -0
- package/dist/dev/icons/dist/react/minimal/pip-enter.js.map +1 -0
- package/dist/dev/icons/dist/react/minimal/pip-exit.js +37 -0
- package/dist/dev/icons/dist/react/minimal/pip-exit.js.map +1 -0
- package/dist/dev/icons/dist/react/minimal/play.js +0 -1
- package/dist/dev/icons/dist/react/minimal/play.js.map +1 -1
- package/dist/dev/icons/dist/react/minimal/restart.js +0 -1
- package/dist/dev/icons/dist/react/minimal/restart.js.map +1 -1
- package/dist/dev/icons/dist/react/minimal/seek.js +0 -1
- package/dist/dev/icons/dist/react/minimal/seek.js.map +1 -1
- package/dist/dev/icons/dist/react/minimal/spinner.js +0 -1
- package/dist/dev/icons/dist/react/minimal/spinner.js.map +1 -1
- package/dist/dev/icons/dist/react/minimal/volume-high.js +0 -1
- package/dist/dev/icons/dist/react/minimal/volume-high.js.map +1 -1
- package/dist/dev/icons/dist/react/minimal/volume-low.js +0 -1
- package/dist/dev/icons/dist/react/minimal/volume-low.js.map +1 -1
- package/dist/dev/icons/dist/react/minimal/volume-off.js +0 -1
- package/dist/dev/icons/dist/react/minimal/volume-off.js.map +1 -1
- package/dist/dev/index.d.ts +2 -2
- package/dist/dev/index.js +2 -2
- package/dist/dev/media/audio.d.ts.map +1 -1
- package/dist/dev/media/audio.js +3 -6
- package/dist/dev/media/audio.js.map +1 -1
- package/dist/dev/media/background-video/index.js +2 -2
- package/dist/dev/media/background-video/index.js.map +1 -1
- package/dist/dev/media/dash-video/index.d.ts +11 -0
- package/dist/dev/media/dash-video/index.d.ts.map +1 -0
- package/dist/dev/media/dash-video/index.js +26 -0
- package/dist/dev/media/dash-video/index.js.map +1 -0
- package/dist/dev/media/hls-video/index.js +2 -2
- package/dist/dev/media/hls-video/index.js.map +1 -1
- package/dist/dev/media/simple-hls-video/index.js +2 -2
- package/dist/dev/media/simple-hls-video/index.js.map +1 -1
- package/dist/dev/media/video.d.ts.map +1 -1
- package/dist/dev/media/video.js +3 -6
- package/dist/dev/media/video.js.map +1 -1
- package/dist/dev/player/context.d.ts +10 -4
- package/dist/dev/player/context.d.ts.map +1 -1
- package/dist/dev/player/context.js +16 -10
- package/dist/dev/player/context.js.map +1 -1
- package/dist/dev/player/create-player.js +16 -2
- package/dist/dev/player/create-player.js.map +1 -1
- package/dist/dev/presets/audio/minimal-skin.css +22 -12
- package/dist/dev/presets/audio/minimal-skin.d.ts.map +1 -1
- package/dist/dev/presets/audio/minimal-skin.js +32 -26
- package/dist/dev/presets/audio/minimal-skin.js.map +1 -1
- package/dist/dev/presets/audio/minimal-skin.tailwind.d.ts.map +1 -1
- package/dist/dev/presets/audio/minimal-skin.tailwind.js +36 -30
- package/dist/dev/presets/audio/minimal-skin.tailwind.js.map +1 -1
- package/dist/dev/presets/audio/skin.css +19 -14
- package/dist/dev/presets/audio/skin.d.ts.map +1 -1
- package/dist/dev/presets/audio/skin.js +32 -26
- package/dist/dev/presets/audio/skin.js.map +1 -1
- package/dist/dev/presets/audio/skin.tailwind.d.ts.map +1 -1
- package/dist/dev/presets/audio/skin.tailwind.js +37 -32
- package/dist/dev/presets/audio/skin.tailwind.js.map +1 -1
- package/dist/dev/presets/types.d.ts +6 -1
- package/dist/dev/presets/types.d.ts.map +1 -1
- package/dist/dev/presets/video/minimal-skin.css +101 -63
- package/dist/dev/presets/video/minimal-skin.d.ts +2 -2
- package/dist/dev/presets/video/minimal-skin.d.ts.map +1 -1
- package/dist/dev/presets/video/minimal-skin.js +45 -31
- package/dist/dev/presets/video/minimal-skin.js.map +1 -1
- package/dist/dev/presets/video/minimal-skin.tailwind.d.ts.map +1 -1
- package/dist/dev/presets/video/minimal-skin.tailwind.js +51 -34
- package/dist/dev/presets/video/minimal-skin.tailwind.js.map +1 -1
- package/dist/dev/presets/video/skin.css +98 -64
- package/dist/dev/presets/video/skin.d.ts +2 -2
- package/dist/dev/presets/video/skin.d.ts.map +1 -1
- package/dist/dev/presets/video/skin.js +45 -31
- package/dist/dev/presets/video/skin.js.map +1 -1
- package/dist/dev/presets/video/skin.tailwind.d.ts.map +1 -1
- package/dist/dev/presets/video/skin.tailwind.js +51 -34
- package/dist/dev/presets/video/skin.tailwind.js.map +1 -1
- package/dist/dev/skins/dist/default/default/tailwind/audio.tailwind.js +6 -5
- package/dist/dev/skins/dist/default/default/tailwind/audio.tailwind.js.map +1 -1
- package/dist/dev/skins/dist/default/default/tailwind/components/controls.js +1 -1
- package/dist/dev/skins/dist/default/default/tailwind/components/controls.js.map +1 -1
- package/dist/dev/skins/dist/default/default/tailwind/components/error.js +1 -1
- package/dist/dev/skins/dist/default/default/tailwind/components/error.js.map +1 -1
- package/dist/dev/skins/dist/default/default/tailwind/components/poster.js +16 -0
- package/dist/dev/skins/dist/default/default/tailwind/components/poster.js.map +1 -0
- package/dist/dev/skins/dist/default/default/tailwind/video.tailwind.js +6 -5
- package/dist/dev/skins/dist/default/default/tailwind/video.tailwind.js.map +1 -1
- package/dist/dev/skins/dist/default/minimal/tailwind/audio.tailwind.js +1 -1
- package/dist/dev/skins/dist/default/minimal/tailwind/audio.tailwind.js.map +1 -1
- package/dist/dev/skins/dist/default/minimal/tailwind/components/controls.js +1 -1
- package/dist/dev/skins/dist/default/minimal/tailwind/components/controls.js.map +1 -1
- package/dist/dev/skins/dist/default/minimal/tailwind/components/error.js +1 -1
- package/dist/dev/skins/dist/default/minimal/tailwind/components/error.js.map +1 -1
- package/dist/dev/skins/dist/default/minimal/tailwind/components/poster.js +16 -0
- package/dist/dev/skins/dist/default/minimal/tailwind/components/poster.js.map +1 -0
- package/dist/dev/skins/dist/default/minimal/tailwind/components/time.js +1 -1
- package/dist/dev/skins/dist/default/minimal/tailwind/components/time.js.map +1 -1
- package/dist/dev/skins/dist/default/minimal/tailwind/video.tailwind.js +5 -4
- package/dist/dev/skins/dist/default/minimal/tailwind/video.tailwind.js.map +1 -1
- package/dist/dev/skins/dist/default/shared/tailwind/icon-state.js +5 -0
- package/dist/dev/skins/dist/default/shared/tailwind/icon-state.js.map +1 -1
- package/dist/dev/ui/popover/popover-popup.d.ts.map +1 -1
- package/dist/dev/ui/popover/popover-popup.js +11 -2
- package/dist/dev/ui/popover/popover-popup.js.map +1 -1
- package/dist/dev/ui/time-slider/time-slider-root.js +1 -1
- package/dist/dev/ui/time-slider/time-slider-root.js.map +1 -1
- package/dist/dev/ui/tooltip/tooltip-popup.d.ts.map +1 -1
- package/dist/dev/ui/tooltip/tooltip-popup.js +11 -2
- package/dist/dev/ui/tooltip/tooltip-popup.js.map +1 -1
- package/dist/dev/ui/volume-slider/volume-slider-root.js +3 -3
- package/dist/dev/ui/volume-slider/volume-slider-root.js.map +1 -1
- package/dist/dev/utils/use-render.d.ts.map +1 -1
- package/dist/dev/utils/use-render.js +5 -1
- package/dist/dev/utils/use-render.js.map +1 -1
- package/package.json +7 -7
- package/dist/default/icons/dist/react/default/pip.js +0 -27
- package/dist/default/icons/dist/react/default/pip.js.map +0 -1
- package/dist/default/icons/dist/react/minimal/pip.js +0 -27
- package/dist/default/icons/dist/react/minimal/pip.js.map +0 -1
- package/dist/dev/icons/dist/react/default/pip.js +0 -27
- package/dist/dev/icons/dist/react/default/pip.js.map +0 -1
- package/dist/dev/icons/dist/react/minimal/pip.js +0 -27
- package/dist/dev/icons/dist/react/minimal/pip.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spinner.js","names":[],"sources":["../../../../../../../icons/dist/react/minimal/spinner.js"],"sourcesContent":["import { jsx, jsxs } from \"react/jsx-runtime\";\nconst SpinnerIcon = (props) => /* @__PURE__ */ jsxs(\"svg\", { xmlns: \"http://www.w3.org/2000/svg\", width: 18, height: 18, fill: \"currentColor\", \"aria-hidden\": \"true\",
|
|
1
|
+
{"version":3,"file":"spinner.js","names":[],"sources":["../../../../../../../icons/dist/react/minimal/spinner.js"],"sourcesContent":["import { jsx, jsxs } from \"react/jsx-runtime\";\nconst SpinnerIcon = (props) => /* @__PURE__ */ jsxs(\"svg\", { xmlns: \"http://www.w3.org/2000/svg\", width: 18, height: 18, fill: \"currentColor\", \"aria-hidden\": \"true\", ...props, children: [\n /* @__PURE__ */ jsx(\"rect\", { width: 2, height: 5, x: 8, y: 0.5, opacity: 0.5, rx: 1, children: /* @__PURE__ */ jsx(\"animate\", { attributeName: \"opacity\", begin: \"0s\", calcMode: \"linear\", dur: \"1s\", repeatCount: \"indefinite\", values: \"1;0\" }) }),\n /* @__PURE__ */ jsx(\"rect\", { width: 2, height: 5, x: 12.243, y: 2.257, opacity: 0.45, rx: 1, transform: \"rotate(45 13.243 4.757)\", children: /* @__PURE__ */ jsx(\"animate\", { attributeName: \"opacity\", begin: \"0.125s\", calcMode: \"linear\", dur: \"1s\", repeatCount: \"indefinite\", values: \"1;0\" }) }),\n /* @__PURE__ */ jsx(\"rect\", { width: 5, height: 2, x: 12.5, y: 8, opacity: 0.4, rx: 1, children: /* @__PURE__ */ jsx(\"animate\", { attributeName: \"opacity\", begin: \"0.25s\", calcMode: \"linear\", dur: \"1s\", repeatCount: \"indefinite\", values: \"1;0\" }) }),\n /* @__PURE__ */ jsx(\"rect\", { width: 5, height: 2, x: 10.743, y: 12.243, opacity: 0.35, rx: 1, transform: \"rotate(45 13.243 13.243)\", children: /* @__PURE__ */ jsx(\"animate\", { attributeName: \"opacity\", begin: \"0.375s\", calcMode: \"linear\", dur: \"1s\", repeatCount: \"indefinite\", values: \"1;0\" }) }),\n /* @__PURE__ */ jsx(\"rect\", { width: 2, height: 5, x: 8, y: 12.5, opacity: 0.3, rx: 1, children: /* @__PURE__ */ jsx(\"animate\", { attributeName: \"opacity\", begin: \"0.5s\", calcMode: \"linear\", dur: \"1s\", repeatCount: \"indefinite\", values: \"1;0\" }) }),\n /* @__PURE__ */ jsx(\"rect\", { width: 2, height: 5, x: 3.757, y: 10.743, opacity: 0.25, rx: 1, transform: \"rotate(45 4.757 13.243)\", children: /* @__PURE__ */ jsx(\"animate\", { attributeName: \"opacity\", begin: \"0.625s\", calcMode: \"linear\", dur: \"1s\", repeatCount: \"indefinite\", values: \"1;0\" }) }),\n /* @__PURE__ */ jsx(\"rect\", { width: 5, height: 2, x: 0.5, y: 8, opacity: 0.15, rx: 1, children: /* @__PURE__ */ jsx(\"animate\", { attributeName: \"opacity\", begin: \"0.75s\", calcMode: \"linear\", dur: \"1s\", repeatCount: \"indefinite\", values: \"1;0\" }) }),\n /* @__PURE__ */ jsx(\"rect\", { width: 5, height: 2, x: 2.257, y: 3.757, opacity: 0.1, rx: 1, transform: \"rotate(45 4.757 4.757)\", children: /* @__PURE__ */ jsx(\"animate\", { attributeName: \"opacity\", begin: \"0.875s\", calcMode: \"linear\", dur: \"1s\", repeatCount: \"indefinite\", values: \"1;0\" }) })\n] });\nexport default SpinnerIcon;\n"],"mappings":";;;AACA,MAAM,eAAe,UAA0B,qBAAK,OAAO;CAAE,OAAO;CAA8B,OAAO;CAAI,QAAQ;CAAI,MAAM;CAAgB,eAAe;CAAQ,GAAG;CAAO,UAAU;EACxK,oBAAI,QAAQ;GAAE,OAAO;GAAG,QAAQ;GAAG,GAAG;GAAG,GAAG;GAAK,SAAS;GAAK,IAAI;GAAG,UAA0B,oBAAI,WAAW;IAAE,eAAe;IAAW,OAAO;IAAM,UAAU;IAAU,KAAK;IAAM,aAAa;IAAc,QAAQ;IAAO,CAAC;GAAE,CAAC;EACrO,oBAAI,QAAQ;GAAE,OAAO;GAAG,QAAQ;GAAG,GAAG;GAAQ,GAAG;GAAO,SAAS;GAAM,IAAI;GAAG,WAAW;GAA2B,UAA0B,oBAAI,WAAW;IAAE,eAAe;IAAW,OAAO;IAAU,UAAU;IAAU,KAAK;IAAM,aAAa;IAAc,QAAQ;IAAO,CAAC;GAAE,CAAC;EACvR,oBAAI,QAAQ;GAAE,OAAO;GAAG,QAAQ;GAAG,GAAG;GAAM,GAAG;GAAG,SAAS;GAAK,IAAI;GAAG,UAA0B,oBAAI,WAAW;IAAE,eAAe;IAAW,OAAO;IAAS,UAAU;IAAU,KAAK;IAAM,aAAa;IAAc,QAAQ;IAAO,CAAC;GAAE,CAAC;EACzO,oBAAI,QAAQ;GAAE,OAAO;GAAG,QAAQ;GAAG,GAAG;GAAQ,GAAG;GAAQ,SAAS;GAAM,IAAI;GAAG,WAAW;GAA4B,UAA0B,oBAAI,WAAW;IAAE,eAAe;IAAW,OAAO;IAAU,UAAU;IAAU,KAAK;IAAM,aAAa;IAAc,QAAQ;IAAO,CAAC;GAAE,CAAC;EACzR,oBAAI,QAAQ;GAAE,OAAO;GAAG,QAAQ;GAAG,GAAG;GAAG,GAAG;GAAM,SAAS;GAAK,IAAI;GAAG,UAA0B,oBAAI,WAAW;IAAE,eAAe;IAAW,OAAO;IAAQ,UAAU;IAAU,KAAK;IAAM,aAAa;IAAc,QAAQ;IAAO,CAAC;GAAE,CAAC;EACxO,oBAAI,QAAQ;GAAE,OAAO;GAAG,QAAQ;GAAG,GAAG;GAAO,GAAG;GAAQ,SAAS;GAAM,IAAI;GAAG,WAAW;GAA2B,UAA0B,oBAAI,WAAW;IAAE,eAAe;IAAW,OAAO;IAAU,UAAU;IAAU,KAAK;IAAM,aAAa;IAAc,QAAQ;IAAO,CAAC;GAAE,CAAC;EACvR,oBAAI,QAAQ;GAAE,OAAO;GAAG,QAAQ;GAAG,GAAG;GAAK,GAAG;GAAG,SAAS;GAAM,IAAI;GAAG,UAA0B,oBAAI,WAAW;IAAE,eAAe;IAAW,OAAO;IAAS,UAAU;IAAU,KAAK;IAAM,aAAa;IAAc,QAAQ;IAAO,CAAC;GAAE,CAAC;EACzO,oBAAI,QAAQ;GAAE,OAAO;GAAG,QAAQ;GAAG,GAAG;GAAO,GAAG;GAAO,SAAS;GAAK,IAAI;GAAG,WAAW;GAA0B,UAA0B,oBAAI,WAAW;IAAE,eAAe;IAAW,OAAO;IAAU,UAAU;IAAU,KAAK;IAAM,aAAa;IAAc,QAAQ;IAAO,CAAC;GAAE,CAAC;EACrS;CAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"volume-high.js","names":[],"sources":["../../../../../../../icons/dist/react/minimal/volume-high.js"],"sourcesContent":["import { jsx, jsxs } from \"react/jsx-runtime\";\nconst VolumeHighIcon = (props) => /* @__PURE__ */ jsxs(\"svg\", { xmlns: \"http://www.w3.org/2000/svg\", width: 18, height: 18, fill: \"none\", \"aria-hidden\": \"true\",
|
|
1
|
+
{"version":3,"file":"volume-high.js","names":[],"sources":["../../../../../../../icons/dist/react/minimal/volume-high.js"],"sourcesContent":["import { jsx, jsxs } from \"react/jsx-runtime\";\nconst VolumeHighIcon = (props) => /* @__PURE__ */ jsxs(\"svg\", { xmlns: \"http://www.w3.org/2000/svg\", width: 18, height: 18, fill: \"none\", \"aria-hidden\": \"true\", ...props, children: [\n /* @__PURE__ */ jsx(\"path\", { fill: \"currentColor\", d: \"M15.6 3.3c-.4-.4-1-.4-1.4 0s-.4 1 0 1.4C15.4 5.9 16 7.4 16 9s-.6 3.1-1.8 4.3c-.4.4-.4 1 0 1.4.2.2.5.3.7.3.3 0 .5-.1.7-.3C17.1 13.2 18 11.2 18 9s-.9-4.2-2.4-5.7\" }),\n /* @__PURE__ */ jsx(\"path\", { fill: \"currentColor\", d: \"M.714 6.008h3.072l4.071-3.857c.5-.376 1.143 0 1.143.601V15.28c0 .602-.643.903-1.143.602l-4.071-3.858H.714c-.428 0-.714-.3-.714-.752V6.76c0-.451.286-.752.714-.752m10.568.59a.91.91 0 0 1 0-1.316.91.91 0 0 1 1.316 0c1.203 1.203 1.47 2.216 1.522 3.208q.012.255.011.51c0 1.16-.358 2.733-1.533 3.803a.7.7 0 0 1-.298.156c-.382.106-.873-.011-1.018-.156a.91.91 0 0 1 0-1.316c.57-.57.995-1.551.995-2.487 0-.944-.26-1.667-.995-2.402\" })\n] });\nexport default VolumeHighIcon;\n"],"mappings":";;;AACA,MAAM,kBAAkB,UAA0B,qBAAK,OAAO;CAAE,OAAO;CAA8B,OAAO;CAAI,QAAQ;CAAI,MAAM;CAAQ,eAAe;CAAQ,GAAG;CAAO,UAAU,CACnK,oBAAI,QAAQ;EAAE,MAAM;EAAgB,GAAG;EAAmK,CAAC,EAC3M,oBAAI,QAAQ;EAAE,MAAM;EAAgB,GAAG;EAAya,CAAC,CACle;CAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"volume-low.js","names":[],"sources":["../../../../../../../icons/dist/react/minimal/volume-low.js"],"sourcesContent":["import { jsx } from \"react/jsx-runtime\";\nconst VolumeLowIcon = (props) => /* @__PURE__ */ jsx(\"svg\", { xmlns: \"http://www.w3.org/2000/svg\", width: 18, height: 18, fill: \"none\", \"aria-hidden\": \"true\",
|
|
1
|
+
{"version":3,"file":"volume-low.js","names":[],"sources":["../../../../../../../icons/dist/react/minimal/volume-low.js"],"sourcesContent":["import { jsx } from \"react/jsx-runtime\";\nconst VolumeLowIcon = (props) => /* @__PURE__ */ jsx(\"svg\", { xmlns: \"http://www.w3.org/2000/svg\", width: 18, height: 18, fill: \"none\", \"aria-hidden\": \"true\", ...props, children: /* @__PURE__ */ jsx(\"path\", { fill: \"currentColor\", d: \"M.714 6.008h3.072l4.071-3.857c.5-.376 1.143 0 1.143.601V15.28c0 .602-.643.903-1.143.602l-4.071-3.858H.714c-.428 0-.714-.3-.714-.752V6.76c0-.451.286-.752.714-.752m10.568.59a.91.91 0 0 1 0-1.316.91.91 0 0 1 1.316 0c1.203 1.203 1.47 2.216 1.522 3.208q.012.255.011.51c0 1.16-.358 2.733-1.533 3.803a.7.7 0 0 1-.298.156c-.382.106-.873-.011-1.018-.156a.91.91 0 0 1 0-1.316c.57-.57.995-1.551.995-2.487 0-.944-.26-1.667-.995-2.402\" }) });\nexport default VolumeLowIcon;\n"],"mappings":";;;AACA,MAAM,iBAAiB,UAA0B,oBAAI,OAAO;CAAE,OAAO;CAA8B,OAAO;CAAI,QAAQ;CAAI,MAAM;CAAQ,eAAe;CAAQ,GAAG;CAAO,UAA0B,oBAAI,QAAQ;EAAE,MAAM;EAAgB,GAAG;EAAya,CAAC;CAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"volume-off.js","names":[],"sources":["../../../../../../../icons/dist/react/minimal/volume-off.js"],"sourcesContent":["import { jsx } from \"react/jsx-runtime\";\nconst VolumeOffIcon = (props) => /* @__PURE__ */ jsx(\"svg\", { xmlns: \"http://www.w3.org/2000/svg\", width: 18, height: 18, fill: \"none\", \"aria-hidden\": \"true\",
|
|
1
|
+
{"version":3,"file":"volume-off.js","names":[],"sources":["../../../../../../../icons/dist/react/minimal/volume-off.js"],"sourcesContent":["import { jsx } from \"react/jsx-runtime\";\nconst VolumeOffIcon = (props) => /* @__PURE__ */ jsx(\"svg\", { xmlns: \"http://www.w3.org/2000/svg\", width: 18, height: 18, fill: \"none\", \"aria-hidden\": \"true\", ...props, children: /* @__PURE__ */ jsx(\"path\", { fill: \"currentColor\", d: \"M.714 6.008h3.072l4.071-3.857c.5-.376 1.143 0 1.143.601V15.28c0 .602-.643.903-1.143.602l-4.071-3.858H.714c-.428 0-.714-.3-.714-.752V6.76c0-.451.286-.752.714-.752M14.5 7.586l-1.768-1.768a1 1 0 1 0-1.414 1.414L13.085 9l-1.767 1.768a1 1 0 0 0 1.414 1.414l1.768-1.768 1.768 1.768a1 1 0 0 0 1.414-1.414L15.914 9l1.768-1.768a1 1 0 0 0-1.414-1.414z\" }) });\nexport default VolumeOffIcon;\n"],"mappings":";;;AACA,MAAM,iBAAiB,UAA0B,oBAAI,OAAO;CAAE,OAAO;CAA8B,OAAO;CAAI,QAAQ;CAAI,MAAM;CAAQ,eAAe;CAAQ,GAAG;CAAO,UAA0B,oBAAI,QAAQ;EAAE,MAAM;EAAgB,GAAG;EAAyV,CAAC;CAAE,CAAC"}
|
package/dist/default/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { Container, useMedia,
|
|
3
|
+
import { Container, useContainer, useContainerAttach, useMedia, useMediaAttach, usePlayer, usePlayerContext } from "./player/context.js";
|
|
4
4
|
import { createPlayer } from "./player/create-player.js";
|
|
5
5
|
import { useAlertDialogContext } from "./ui/alert-dialog/context.js";
|
|
6
6
|
import { mergeProps } from "./utils/merge-props.js";
|
|
@@ -32,4 +32,4 @@ import { useSelector, useStore } from "@videojs/store/react";
|
|
|
32
32
|
|
|
33
33
|
export * from "@videojs/core/dom"
|
|
34
34
|
|
|
35
|
-
export { index_parts_exports as AlertDialog, BufferingIndicator, CaptionsButton, Container, index_parts_exports$1 as Controls, FullscreenButton, MuteButton, PiPButton, PlayButton, PlaybackRateButton, index_parts_exports$2 as Popover, Poster, SeekButton, index_parts_exports$3 as Slider, Thumbnail, index_parts_exports$4 as Time, index_parts_exports$5 as TimeSlider, index_parts_exports$6 as Tooltip, index_parts_exports$7 as VolumeSlider, createPlayer, createSelector, mergeProps, renderElement, shallowEqual, useAlertDialogContext, useButton, useMedia,
|
|
35
|
+
export { index_parts_exports as AlertDialog, BufferingIndicator, CaptionsButton, Container, index_parts_exports$1 as Controls, FullscreenButton, MuteButton, PiPButton, PlayButton, PlaybackRateButton, index_parts_exports$2 as Popover, Poster, SeekButton, index_parts_exports$3 as Slider, Thumbnail, index_parts_exports$4 as Time, index_parts_exports$5 as TimeSlider, index_parts_exports$6 as Tooltip, index_parts_exports$7 as VolumeSlider, createPlayer, createSelector, mergeProps, renderElement, shallowEqual, useAlertDialogContext, useButton, useContainer, useContainerAttach, useMedia, useMediaAttach, usePlayer, usePlayerContext, usePopoverContext, useSelector, useSlider, useStore, useTooltipContext };
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { useComposedRefs } from "../utils/use-composed-refs.js";
|
|
4
|
-
import {
|
|
5
|
-
import { forwardRef
|
|
4
|
+
import { useMediaAttach } from "../player/context.js";
|
|
5
|
+
import { forwardRef } from "react";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
7
|
|
|
8
8
|
//#region src/media/audio.tsx
|
|
9
9
|
const Audio = forwardRef(function Audio({ children, ...props }, ref) {
|
|
10
|
-
const setMedia = useMediaRegistration();
|
|
11
10
|
return /* @__PURE__ */ jsx("audio", {
|
|
12
|
-
ref: useComposedRefs(ref,
|
|
13
|
-
setMedia?.(el);
|
|
14
|
-
}, [setMedia])),
|
|
11
|
+
ref: useComposedRefs(ref, useMediaAttach()),
|
|
15
12
|
...props,
|
|
16
13
|
children
|
|
17
14
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audio.js","names":[],"sources":["../../../src/media/audio.tsx"],"sourcesContent":["'use client';\n\nimport type { AudioHTMLAttributes } from 'react';\nimport { forwardRef
|
|
1
|
+
{"version":3,"file":"audio.js","names":[],"sources":["../../../src/media/audio.tsx"],"sourcesContent":["'use client';\n\nimport type { AudioHTMLAttributes } from 'react';\nimport { forwardRef } from 'react';\n\nimport { useMediaAttach } from '../player/context';\nimport { useComposedRefs } from '../utils/use-composed-refs';\n\nexport interface AudioProps extends AudioHTMLAttributes<HTMLAudioElement> {}\n\nexport const Audio = forwardRef<HTMLAudioElement, AudioProps>(function Audio({ children, ...props }, ref) {\n const setMedia = useMediaAttach();\n const composedRef = useComposedRefs(ref, setMedia);\n\n return (\n <audio ref={composedRef} {...props}>\n {children}\n </audio>\n );\n});\n\nexport namespace Audio {\n export type Props = AudioProps;\n}\n"],"mappings":";;;;;;;;AAUA,MAAa,QAAQ,WAAyC,SAAS,MAAM,EAAE,UAAU,GAAG,SAAS,KAAK;AAIxG,QACE,oBAAC;EAAM,KAHW,gBAAgB,KADnB,gBAAgB,CACiB;EAGvB,GAAI;EAC1B;GACK;EAEV"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { useComposedRefs } from "../../utils/use-composed-refs.js";
|
|
4
|
-
import {
|
|
4
|
+
import { useMediaAttach } from "../../player/context.js";
|
|
5
5
|
import { forwardRef, useCallback } from "react";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
7
|
|
|
8
8
|
//#region src/media/background-video/index.tsx
|
|
9
9
|
const BackgroundVideo = forwardRef(function BackgroundVideo({ children, ...props }, ref) {
|
|
10
|
-
const setMedia =
|
|
10
|
+
const setMedia = useMediaAttach();
|
|
11
11
|
return /* @__PURE__ */ jsx("video", {
|
|
12
12
|
ref: useComposedRefs(ref, useCallback((el) => {
|
|
13
13
|
setMedia?.(el);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/media/background-video/index.tsx"],"sourcesContent":["'use client';\n\nimport type { VideoHTMLAttributes } from 'react';\nimport { forwardRef, useCallback } from 'react';\n\nimport {
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/media/background-video/index.tsx"],"sourcesContent":["'use client';\n\nimport type { VideoHTMLAttributes } from 'react';\nimport { forwardRef, useCallback } from 'react';\n\nimport { useMediaAttach } from '../../player/context';\nimport { useComposedRefs } from '../../utils/use-composed-refs';\n\nexport interface BackgroundVideoProps extends VideoHTMLAttributes<HTMLVideoElement> {}\n\nexport const BackgroundVideo = forwardRef<HTMLVideoElement, BackgroundVideoProps>(function BackgroundVideo(\n { children, ...props },\n ref\n) {\n const setMedia = useMediaAttach();\n\n const mediaRef = useCallback(\n (el: HTMLVideoElement | null) => {\n setMedia?.(el);\n },\n [setMedia]\n );\n\n const composedRef = useComposedRefs(ref, mediaRef);\n\n return (\n <video ref={composedRef} muted autoPlay loop playsInline disableRemotePlayback disablePictureInPicture {...props}>\n {children}\n </video>\n );\n});\n\nexport namespace BackgroundVideo {\n export type Props = BackgroundVideoProps;\n}\n"],"mappings":";;;;;;;;AAUA,MAAa,kBAAkB,WAAmD,SAAS,gBACzF,EAAE,UAAU,GAAG,SACf,KACA;CACA,MAAM,WAAW,gBAAgB;AAWjC,QACE,oBAAC;EAAM,KAHW,gBAAgB,KAPnB,aACd,OAAgC;AAC/B,cAAW,GAAG;KAEhB,CAAC,SAAS,CACX,CAEiD;EAGvB;EAAM;EAAS;EAAK;EAAY;EAAsB;EAAwB,GAAI;EACxG;GACK;EAEV"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useComposedRefs } from "../../utils/use-composed-refs.js";
|
|
2
|
+
import { useMediaAttach } from "../../player/context.js";
|
|
3
|
+
import { useDestroy } from "../../utils/use-destroy.js";
|
|
4
|
+
import { attachMediaElement } from "../../utils/attach-media-element.js";
|
|
5
|
+
import { mediaProps } from "../../utils/media-props.js";
|
|
6
|
+
import { forwardRef, useMemo } from "react";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
import { DashMedia } from "@videojs/core/dom/media/dash";
|
|
9
|
+
|
|
10
|
+
//#region src/media/dash-video/index.tsx
|
|
11
|
+
const DashVideo = forwardRef(({ children, ...props }, ref) => {
|
|
12
|
+
const mediaApi = useMemo(() => new DashMedia(), []);
|
|
13
|
+
const setMedia = useMediaAttach();
|
|
14
|
+
useDestroy(mediaApi, () => {
|
|
15
|
+
setMedia?.(mediaApi);
|
|
16
|
+
});
|
|
17
|
+
return /* @__PURE__ */ jsx("video", {
|
|
18
|
+
ref: useComposedRefs(attachMediaElement(mediaApi), ref),
|
|
19
|
+
...mediaProps(mediaApi, props),
|
|
20
|
+
children
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
export { DashVideo, DashVideo as default };
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/media/dash-video/index.tsx"],"sourcesContent":["import { DashMedia } from '@videojs/core/dom/media/dash';\nimport type { PropsWithChildren, VideoHTMLAttributes } from 'react';\nimport { forwardRef, useMemo } from 'react';\nimport { useMediaAttach } from '../../player/context';\nimport { attachMediaElement } from '../../utils/attach-media-element';\nimport { mediaProps } from '../../utils/media-props';\nimport { useComposedRefs } from '../../utils/use-composed-refs';\nimport { useDestroy } from '../../utils/use-destroy';\n\nexport type DashVideoProps = PropsWithChildren<VideoHTMLAttributes<HTMLVideoElement>>;\n\nexport const DashVideo = forwardRef<HTMLVideoElement, DashVideoProps>(({ children, ...props }, ref) => {\n const mediaApi = useMemo(() => new DashMedia(), []);\n const setMedia = useMediaAttach();\n\n useDestroy(mediaApi, () => {\n setMedia?.(mediaApi);\n });\n\n const composedRef = useComposedRefs(attachMediaElement(mediaApi), ref);\n\n return (\n <video ref={composedRef} {...mediaProps(mediaApi, props)}>\n {children}\n </video>\n );\n});\n\nexport default DashVideo;\n"],"mappings":";;;;;;;;;;AAWA,MAAa,YAAY,YAA8C,EAAE,UAAU,GAAG,SAAS,QAAQ;CACrG,MAAM,WAAW,cAAc,IAAI,WAAW,EAAE,EAAE,CAAC;CACnD,MAAM,WAAW,gBAAgB;AAEjC,YAAW,gBAAgB;AACzB,aAAW,SAAS;GACpB;AAIF,QACE,oBAAC;EAAM,KAHW,gBAAgB,mBAAmB,SAAS,EAAE,IAAI;EAG3C,GAAI,WAAW,UAAU,MAAM;EACrD;GACK;EAEV"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useComposedRefs } from "../../utils/use-composed-refs.js";
|
|
2
|
-
import {
|
|
2
|
+
import { useMediaAttach } from "../../player/context.js";
|
|
3
3
|
import { useDestroy } from "../../utils/use-destroy.js";
|
|
4
4
|
import { attachMediaElement } from "../../utils/attach-media-element.js";
|
|
5
5
|
import { mediaProps } from "../../utils/media-props.js";
|
|
@@ -10,7 +10,7 @@ import { HlsMedia } from "@videojs/core/dom/media/hls";
|
|
|
10
10
|
//#region src/media/hls-video/index.tsx
|
|
11
11
|
const HlsVideo = forwardRef(({ children, ...props }, ref) => {
|
|
12
12
|
const mediaApi = useMemo(() => new HlsMedia(), []);
|
|
13
|
-
const setMedia =
|
|
13
|
+
const setMedia = useMediaAttach();
|
|
14
14
|
useDestroy(mediaApi, () => {
|
|
15
15
|
setMedia?.(mediaApi);
|
|
16
16
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/media/hls-video/index.tsx"],"sourcesContent":["import { HlsMedia } from '@videojs/core/dom/media/hls';\nimport type { PropsWithChildren, VideoHTMLAttributes } from 'react';\nimport { forwardRef, useMemo } from 'react';\nimport {
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/media/hls-video/index.tsx"],"sourcesContent":["import { HlsMedia } from '@videojs/core/dom/media/hls';\nimport type { PropsWithChildren, VideoHTMLAttributes } from 'react';\nimport { forwardRef, useMemo } from 'react';\nimport { useMediaAttach } from '../../player/context';\nimport { attachMediaElement } from '../../utils/attach-media-element';\nimport { mediaProps } from '../../utils/media-props';\nimport { useComposedRefs } from '../../utils/use-composed-refs';\nimport { useDestroy } from '../../utils/use-destroy';\n\nexport type HlsVideoProps = PropsWithChildren<VideoHTMLAttributes<HTMLVideoElement>>;\n\nexport const HlsVideo = forwardRef<HTMLVideoElement, HlsVideoProps>(({ children, ...props }, ref) => {\n const mediaApi = useMemo(() => new HlsMedia(), []);\n const setMedia = useMediaAttach();\n\n useDestroy(mediaApi, () => {\n setMedia?.(mediaApi);\n });\n\n const composedRef = useComposedRefs(attachMediaElement(mediaApi), ref);\n\n return (\n <video ref={composedRef} {...mediaProps(mediaApi, props)}>\n {children}\n </video>\n );\n});\n\nexport default HlsVideo;\n"],"mappings":";;;;;;;;;;AAWA,MAAa,WAAW,YAA6C,EAAE,UAAU,GAAG,SAAS,QAAQ;CACnG,MAAM,WAAW,cAAc,IAAI,UAAU,EAAE,EAAE,CAAC;CAClD,MAAM,WAAW,gBAAgB;AAEjC,YAAW,gBAAgB;AACzB,aAAW,SAAS;GACpB;AAIF,QACE,oBAAC;EAAM,KAHW,gBAAgB,mBAAmB,SAAS,EAAE,IAAI;EAG3C,GAAI,WAAW,UAAU,MAAM;EACrD;GACK;EAEV"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useComposedRefs } from "../../utils/use-composed-refs.js";
|
|
2
|
-
import {
|
|
2
|
+
import { useMediaAttach } from "../../player/context.js";
|
|
3
3
|
import { attachMediaElement } from "../../utils/attach-media-element.js";
|
|
4
4
|
import { mediaProps } from "../../utils/media-props.js";
|
|
5
5
|
import { forwardRef, useEffect, useMemo } from "react";
|
|
@@ -9,7 +9,7 @@ import { SimpleHlsMedia } from "@videojs/core/dom/media/simple-hls";
|
|
|
9
9
|
//#region src/media/simple-hls-video/index.tsx
|
|
10
10
|
const SimpleHlsVideo = forwardRef(({ children, ...props }, ref) => {
|
|
11
11
|
const mediaApi = useMemo(() => new SimpleHlsMedia(), []);
|
|
12
|
-
const setMedia =
|
|
12
|
+
const setMedia = useMediaAttach();
|
|
13
13
|
useEffect(() => {
|
|
14
14
|
setMedia?.(mediaApi);
|
|
15
15
|
}, [mediaApi, setMedia]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/media/simple-hls-video/index.tsx"],"sourcesContent":["import { SimpleHlsMedia } from '@videojs/core/dom/media/simple-hls';\nimport type { PropsWithChildren, VideoHTMLAttributes } from 'react';\nimport { forwardRef, useEffect, useMemo } from 'react';\nimport {
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/media/simple-hls-video/index.tsx"],"sourcesContent":["import { SimpleHlsMedia } from '@videojs/core/dom/media/simple-hls';\nimport type { PropsWithChildren, VideoHTMLAttributes } from 'react';\nimport { forwardRef, useEffect, useMemo } from 'react';\nimport { useMediaAttach } from '../../player/context';\nimport { attachMediaElement } from '../../utils/attach-media-element';\nimport { mediaProps } from '../../utils/media-props';\nimport { useComposedRefs } from '../../utils/use-composed-refs';\n\n// TODO: mediaProps uses media.preload which SimpleHlsMedia does not yet expose.\n// Add preload getter/setter to SimpleHlsMedia as a follow-up.\nexport type SimpleHlsVideoProps = PropsWithChildren<VideoHTMLAttributes<HTMLVideoElement>>;\n\nexport const SimpleHlsVideo = forwardRef<HTMLVideoElement, SimpleHlsVideoProps>(({ children, ...props }, ref) => {\n const mediaApi = useMemo(() => new SimpleHlsMedia(), []);\n const setMedia = useMediaAttach();\n\n useEffect(() => {\n setMedia?.(mediaApi);\n }, [mediaApi, setMedia]);\n\n const composedRef = useComposedRefs(attachMediaElement(mediaApi), ref);\n\n return (\n <video ref={composedRef} {...mediaProps(mediaApi, props)}>\n {children}\n </video>\n );\n});\n\nexport default SimpleHlsVideo;\n"],"mappings":";;;;;;;;;AAYA,MAAa,iBAAiB,YAAmD,EAAE,UAAU,GAAG,SAAS,QAAQ;CAC/G,MAAM,WAAW,cAAc,IAAI,gBAAgB,EAAE,EAAE,CAAC;CACxD,MAAM,WAAW,gBAAgB;AAEjC,iBAAgB;AACd,aAAW,SAAS;IACnB,CAAC,UAAU,SAAS,CAAC;AAIxB,QACE,oBAAC;EAAM,KAHW,gBAAgB,mBAAmB,SAAS,EAAE,IAAI;EAG3C,GAAI,WAAW,UAAU,MAAM;EACrD;GACK;EAEV"}
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { useComposedRefs } from "../utils/use-composed-refs.js";
|
|
4
|
-
import {
|
|
5
|
-
import { forwardRef
|
|
4
|
+
import { useMediaAttach } from "../player/context.js";
|
|
5
|
+
import { forwardRef } from "react";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
7
|
|
|
8
8
|
//#region src/media/video.tsx
|
|
9
9
|
const Video = forwardRef(function Video({ children, ...props }, ref) {
|
|
10
|
-
const setMedia = useMediaRegistration();
|
|
11
10
|
return /* @__PURE__ */ jsx("video", {
|
|
12
|
-
ref: useComposedRefs(ref,
|
|
13
|
-
setMedia?.(el);
|
|
14
|
-
}, [setMedia])),
|
|
11
|
+
ref: useComposedRefs(ref, useMediaAttach()),
|
|
15
12
|
...props,
|
|
16
13
|
children
|
|
17
14
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"video.js","names":[],"sources":["../../../src/media/video.tsx"],"sourcesContent":["'use client';\n\nimport type { VideoHTMLAttributes } from 'react';\nimport { forwardRef
|
|
1
|
+
{"version":3,"file":"video.js","names":[],"sources":["../../../src/media/video.tsx"],"sourcesContent":["'use client';\n\nimport type { VideoHTMLAttributes } from 'react';\nimport { forwardRef } from 'react';\n\nimport { useMediaAttach } from '../player/context';\nimport { useComposedRefs } from '../utils/use-composed-refs';\n\nexport interface VideoProps extends VideoHTMLAttributes<HTMLVideoElement> {}\n\nexport const Video = forwardRef<HTMLVideoElement, VideoProps>(function Video({ children, ...props }, ref) {\n const setMedia = useMediaAttach();\n const composedRef = useComposedRefs(ref, setMedia);\n\n return (\n <video ref={composedRef} {...props}>\n {children}\n </video>\n );\n});\n\nexport namespace Video {\n export type Props = VideoProps;\n}\n"],"mappings":";;;;;;;;AAUA,MAAa,QAAQ,WAAyC,SAAS,MAAM,EAAE,UAAU,GAAG,SAAS,KAAK;AAIxG,QACE,oBAAC;EAAM,KAHW,gBAAgB,KADnB,gBAAgB,CACiB;EAGvB,GAAI;EAC1B;GACK;EAEV"}
|
|
@@ -38,21 +38,27 @@ function useMedia() {
|
|
|
38
38
|
const { media } = usePlayerContext();
|
|
39
39
|
return media;
|
|
40
40
|
}
|
|
41
|
-
/** Access the
|
|
42
|
-
function
|
|
41
|
+
/** Access the container element from within a Player Provider. */
|
|
42
|
+
function useContainer() {
|
|
43
|
+
const { container } = usePlayerContext();
|
|
44
|
+
return container;
|
|
45
|
+
}
|
|
46
|
+
/** Access the media attach setter for connecting a media element to the player. */
|
|
47
|
+
function useMediaAttach() {
|
|
43
48
|
return useContext(PlayerContext)?.setMedia;
|
|
44
49
|
}
|
|
50
|
+
/** Access the container attach setter for connecting a container element to the player. */
|
|
51
|
+
function useContainerAttach() {
|
|
52
|
+
return useContext(PlayerContext)?.setContainer;
|
|
53
|
+
}
|
|
45
54
|
const Container = forwardRef(function Container({ children, ...props }, ref) {
|
|
46
|
-
const
|
|
55
|
+
const setContainer = useContainerAttach();
|
|
47
56
|
const internalRef = useRef(null);
|
|
48
57
|
const composedRef = useComposedRefs(ref, internalRef);
|
|
49
58
|
useEffect(() => {
|
|
50
|
-
|
|
51
|
-
return
|
|
52
|
-
|
|
53
|
-
container: internalRef.current
|
|
54
|
-
});
|
|
55
|
-
}, [media, store]);
|
|
59
|
+
setContainer?.(internalRef.current);
|
|
60
|
+
return () => setContainer?.(null);
|
|
61
|
+
}, [setContainer]);
|
|
56
62
|
return /* @__PURE__ */ jsx("div", {
|
|
57
63
|
ref: composedRef,
|
|
58
64
|
...props,
|
|
@@ -61,5 +67,5 @@ const Container = forwardRef(function Container({ children, ...props }, ref) {
|
|
|
61
67
|
});
|
|
62
68
|
|
|
63
69
|
//#endregion
|
|
64
|
-
export { Container, PlayerContextProvider, useMedia,
|
|
70
|
+
export { Container, PlayerContextProvider, useContainer, useContainerAttach, useMedia, useMediaAttach, useOptionalPlayer, usePlayer, usePlayerContext };
|
|
65
71
|
//# sourceMappingURL=context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","names":[],"sources":["../../../src/player/context.tsx"],"sourcesContent":["'use client';\n\nimport type { Media } from '@videojs/core/dom';\nimport type { UnknownState, UnknownStore } from '@videojs/store';\nimport { useStore } from '@videojs/store/react';\nimport type { Dispatch, HTMLAttributes, ReactNode, SetStateAction } from 'react';\nimport { createContext, forwardRef, useContext, useEffect, useRef } from 'react';\n\nimport { useComposedRefs } from '../utils/use-composed-refs';\n\nexport interface PlayerContextValue {\n store: UnknownStore;\n media: Media | null;\n setMedia: Dispatch<SetStateAction<Media | null>>;\n}\n\nconst PlayerContext = createContext<PlayerContextValue | null>(null);\nconst EMPTY_UNSUBSCRIBE = () => {};\nconst EMPTY_STORE = {\n state: {} as UnknownState,\n subscribe: () => EMPTY_UNSUBSCRIBE,\n} as Pick<UnknownStore, 'state' | 'subscribe'>;\n\nexport function PlayerContextProvider({\n value,\n children,\n}: {\n value: PlayerContextValue;\n children: ReactNode;\n}): ReactNode {\n return <PlayerContext.Provider value={value}>{children}</PlayerContext.Provider>;\n}\n\n/** Access the full player context value. Throws if used outside a Player Provider. */\nexport function usePlayerContext(): PlayerContextValue {\n const ctx = useContext(PlayerContext);\n if (!ctx) throw new Error('usePlayerContext must be used within a Player Provider');\n return ctx;\n}\n\n/**\n * Access the player store from within a Player Provider.\n *\n * @label Without Selector\n */\nexport function usePlayer(): UnknownStore;\n/**\n * Select a value from the player store. Re-renders when the selected value changes.\n *\n * @label With Selector\n * @param selector - Derives a value from the player store state.\n */\nexport function usePlayer<R>(selector: (state: UnknownState) => R): R;\nexport function usePlayer<R>(selector?: (state: UnknownState) => R) {\n const { store } = usePlayerContext();\n return useStore(store, selector as any);\n}\n\n/**\n * Access player state when available, but return `undefined` outside Provider.\n *\n * This is useful for components that can operate without player context\n * (e.g. they accept fully explicit props as a fallback).\n */\n/** @label Without Selector */\nexport function useOptionalPlayer(): UnknownStore | undefined;\n/** @label With Selector */\nexport function useOptionalPlayer<R>(selector: (state: UnknownState) => R): R | undefined;\nexport function useOptionalPlayer<R>(selector?: (state: UnknownState) => R) {\n const ctx = useContext(PlayerContext);\n const store = (ctx?.store ?? (EMPTY_STORE as unknown as UnknownStore)) as UnknownStore;\n const value = useStore(store, (ctx ? selector : undefined) as any);\n return ctx ? value : undefined;\n}\n\n/** Access the media element from within a Player Provider. */\nexport function useMedia(): Media | null {\n const { media } = usePlayerContext();\n return media;\n}\n\n/** Access the media
|
|
1
|
+
{"version":3,"file":"context.js","names":[],"sources":["../../../src/player/context.tsx"],"sourcesContent":["'use client';\n\nimport type { Media, MediaContainer } from '@videojs/core/dom';\nimport type { UnknownState, UnknownStore } from '@videojs/store';\nimport { useStore } from '@videojs/store/react';\nimport type { Dispatch, HTMLAttributes, ReactNode, SetStateAction } from 'react';\nimport { createContext, forwardRef, useContext, useEffect, useRef } from 'react';\n\nimport { useComposedRefs } from '../utils/use-composed-refs';\n\nexport interface PlayerContextValue {\n store: UnknownStore;\n media: Media | null;\n setMedia: Dispatch<SetStateAction<Media | null>>;\n container: MediaContainer | null;\n setContainer: Dispatch<SetStateAction<HTMLElement | null>>;\n}\n\nconst PlayerContext = createContext<PlayerContextValue | null>(null);\nconst EMPTY_UNSUBSCRIBE = () => {};\nconst EMPTY_STORE = {\n state: {} as UnknownState,\n subscribe: () => EMPTY_UNSUBSCRIBE,\n} as Pick<UnknownStore, 'state' | 'subscribe'>;\n\nexport function PlayerContextProvider({\n value,\n children,\n}: {\n value: PlayerContextValue;\n children: ReactNode;\n}): ReactNode {\n return <PlayerContext.Provider value={value}>{children}</PlayerContext.Provider>;\n}\n\n/** Access the full player context value. Throws if used outside a Player Provider. */\nexport function usePlayerContext(): PlayerContextValue {\n const ctx = useContext(PlayerContext);\n if (!ctx) throw new Error('usePlayerContext must be used within a Player Provider');\n return ctx;\n}\n\n/**\n * Access the player store from within a Player Provider.\n *\n * @label Without Selector\n */\nexport function usePlayer(): UnknownStore;\n/**\n * Select a value from the player store. Re-renders when the selected value changes.\n *\n * @label With Selector\n * @param selector - Derives a value from the player store state.\n */\nexport function usePlayer<R>(selector: (state: UnknownState) => R): R;\nexport function usePlayer<R>(selector?: (state: UnknownState) => R) {\n const { store } = usePlayerContext();\n return useStore(store, selector as any);\n}\n\n/**\n * Access player state when available, but return `undefined` outside Provider.\n *\n * This is useful for components that can operate without player context\n * (e.g. they accept fully explicit props as a fallback).\n */\n/** @label Without Selector */\nexport function useOptionalPlayer(): UnknownStore | undefined;\n/** @label With Selector */\nexport function useOptionalPlayer<R>(selector: (state: UnknownState) => R): R | undefined;\nexport function useOptionalPlayer<R>(selector?: (state: UnknownState) => R) {\n const ctx = useContext(PlayerContext);\n const store = (ctx?.store ?? (EMPTY_STORE as unknown as UnknownStore)) as UnknownStore;\n const value = useStore(store, (ctx ? selector : undefined) as any);\n return ctx ? value : undefined;\n}\n\n/** Access the media element from within a Player Provider. */\nexport function useMedia(): Media | null {\n const { media } = usePlayerContext();\n return media;\n}\n\n/** Access the container element from within a Player Provider. */\nexport function useContainer(): MediaContainer | null {\n const { container } = usePlayerContext();\n return container;\n}\n\n/** Access the media attach setter for connecting a media element to the player. */\nexport function useMediaAttach(): Dispatch<SetStateAction<Media | null>> | undefined {\n const ctx = useContext(PlayerContext);\n return ctx?.setMedia;\n}\n\n/** Access the container attach setter for connecting a container element to the player. */\nexport function useContainerAttach(): Dispatch<SetStateAction<HTMLElement | null>> | undefined {\n const ctx = useContext(PlayerContext);\n return ctx?.setContainer;\n}\n\nexport interface ContainerProps extends HTMLAttributes<HTMLDivElement> {\n children?: ReactNode;\n}\n\nexport const Container = forwardRef<HTMLDivElement, ContainerProps>(function Container({ children, ...props }, ref) {\n const setContainer = useContainerAttach();\n const internalRef = useRef<HTMLDivElement>(null);\n const composedRef = useComposedRefs(ref, internalRef);\n\n useEffect(() => {\n setContainer?.(internalRef.current);\n return () => setContainer?.(null);\n }, [setContainer]);\n\n return (\n <div ref={composedRef} {...props}>\n {children}\n </div>\n );\n});\n\nexport namespace Container {\n export type Props = ContainerProps;\n}\n"],"mappings":";;;;;;;;AAkBA,MAAM,gBAAgB,cAAyC,KAAK;AACpE,MAAM,0BAA0B;AAChC,MAAM,cAAc;CAClB,OAAO,EAAE;CACT,iBAAiB;CAClB;AAED,SAAgB,sBAAsB,EACpC,OACA,YAIY;AACZ,QAAO,oBAAC,cAAc;EAAgB;EAAQ;GAAkC;;;AAIlF,SAAgB,mBAAuC;CACrD,MAAM,MAAM,WAAW,cAAc;AACrC,KAAI,CAAC,IAAK,OAAM,IAAI,MAAM,yDAAyD;AACnF,QAAO;;AAgBT,SAAgB,UAAa,UAAuC;CAClE,MAAM,EAAE,UAAU,kBAAkB;AACpC,QAAO,SAAS,OAAO,SAAgB;;AAazC,SAAgB,kBAAqB,UAAuC;CAC1E,MAAM,MAAM,WAAW,cAAc;CAErC,MAAM,QAAQ,SADC,KAAK,SAAU,aACC,MAAM,WAAW,OAAkB;AAClE,QAAO,MAAM,QAAQ;;;AAIvB,SAAgB,WAAyB;CACvC,MAAM,EAAE,UAAU,kBAAkB;AACpC,QAAO;;;AAIT,SAAgB,eAAsC;CACpD,MAAM,EAAE,cAAc,kBAAkB;AACxC,QAAO;;;AAIT,SAAgB,iBAAqE;AAEnF,QADY,WAAW,cAAc,EACzB;;;AAId,SAAgB,qBAA+E;AAE7F,QADY,WAAW,cAAc,EACzB;;AAOd,MAAa,YAAY,WAA2C,SAAS,UAAU,EAAE,UAAU,GAAG,SAAS,KAAK;CAClH,MAAM,eAAe,oBAAoB;CACzC,MAAM,cAAc,OAAuB,KAAK;CAChD,MAAM,cAAc,gBAAgB,KAAK,YAAY;AAErD,iBAAgB;AACd,iBAAe,YAAY,QAAQ;AACnC,eAAa,eAAe,KAAK;IAChC,CAAC,aAAa,CAAC;AAElB,QACE,oBAAC;EAAI,KAAK;EAAa,GAAI;EACxB;GACG;EAER"}
|
|
@@ -4,7 +4,7 @@ import { Container, PlayerContextProvider, useMedia, usePlayerContext } from "./
|
|
|
4
4
|
import { useDestroy } from "../utils/use-destroy.js";
|
|
5
5
|
import { combine, createStore } from "@videojs/store";
|
|
6
6
|
import { useStore } from "@videojs/store/react";
|
|
7
|
-
import { useState } from "react";
|
|
7
|
+
import { useEffect, useState } from "react";
|
|
8
8
|
import { jsx } from "react/jsx-runtime";
|
|
9
9
|
|
|
10
10
|
//#region src/player/create-player.tsx
|
|
@@ -12,12 +12,26 @@ function createPlayer(config) {
|
|
|
12
12
|
function Provider({ children }) {
|
|
13
13
|
const [store] = useState(() => createStore()(combine(...config.features)));
|
|
14
14
|
const [media, setMedia] = useState(null);
|
|
15
|
+
const [container, setContainer] = useState(null);
|
|
15
16
|
useDestroy(store);
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
if (!media) return;
|
|
19
|
+
return store.attach({
|
|
20
|
+
media,
|
|
21
|
+
container
|
|
22
|
+
});
|
|
23
|
+
}, [
|
|
24
|
+
media,
|
|
25
|
+
container,
|
|
26
|
+
store
|
|
27
|
+
]);
|
|
16
28
|
return /* @__PURE__ */ jsx(PlayerContextProvider, {
|
|
17
29
|
value: {
|
|
18
30
|
store,
|
|
19
31
|
media,
|
|
20
|
-
setMedia
|
|
32
|
+
setMedia,
|
|
33
|
+
container,
|
|
34
|
+
setContainer
|
|
21
35
|
},
|
|
22
36
|
children
|
|
23
37
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-player.js","names":[],"sources":["../../../src/player/create-player.tsx"],"sourcesContent":["'use client';\n\nimport type {\n AnyPlayerFeature,\n AnyPlayerStore,\n AudioFeatures,\n AudioPlayerStore,\n Media,\n PlayerStore,\n PlayerTarget,\n VideoFeatures,\n VideoPlayerStore,\n} from '@videojs/core/dom';\nimport type { InferStoreState } from '@videojs/store';\nimport { combine, createStore } from '@videojs/store';\nimport { useStore } from '@videojs/store/react';\nimport type { FC, ReactNode } from 'react';\nimport { useState } from 'react';\n\nimport { useDestroy } from '../utils/use-destroy';\nimport { Container, PlayerContextProvider, useMedia, usePlayerContext } from './context';\n\nexport interface CreatePlayerConfig<Features extends AnyPlayerFeature[]> {\n features: Features;\n displayName?: string;\n}\n\nexport interface ProviderProps {\n children: ReactNode;\n}\n\nexport interface CreatePlayerResult<Store extends PlayerStore> {\n Provider: FC<ProviderProps>;\n Container: typeof Container;\n usePlayer: UsePlayerHook<Store>;\n useMedia: () => Media | null;\n}\n\nexport type UsePlayerHook<Store extends PlayerStore> = {\n (): Store;\n <R>(selector: (state: InferStoreState<Store>) => R): R;\n};\n\n/**\n * Create a player instance with typed store, Provider component, Container, and hooks.\n *\n * @label Video\n * @param config - Player configuration with features and optional display name.\n */\nexport function createPlayer(config: CreatePlayerConfig<VideoFeatures>): CreatePlayerResult<VideoPlayerStore>;\n\n/**\n * Create a player for audio media.\n *\n * @label Audio\n * @param config - Player configuration with features and optional display name.\n */\nexport function createPlayer(config: CreatePlayerConfig<AudioFeatures>): CreatePlayerResult<AudioPlayerStore>;\n\n/**\n * Create a player with custom features.\n *\n * @label Generic\n * @param config - Player configuration with features and optional display name.\n */\nexport function createPlayer<const Features extends AnyPlayerFeature[]>(\n config: CreatePlayerConfig<Features>\n): CreatePlayerResult<PlayerStore<Features>>;\n\nexport function createPlayer(config: CreatePlayerConfig<AnyPlayerFeature[]>): CreatePlayerResult<AnyPlayerStore> {\n function Provider({ children }: ProviderProps): ReactNode {\n const [store] = useState(() => createStore<PlayerTarget>()(combine(...config.features)));\n const [media, setMedia] = useState<Media | null>(null);\n\n useDestroy(store);\n\n return <PlayerContextProvider value={{ store, media, setMedia }}
|
|
1
|
+
{"version":3,"file":"create-player.js","names":[],"sources":["../../../src/player/create-player.tsx"],"sourcesContent":["'use client';\n\nimport type {\n AnyPlayerFeature,\n AnyPlayerStore,\n AudioFeatures,\n AudioPlayerStore,\n Media,\n PlayerStore,\n PlayerTarget,\n VideoFeatures,\n VideoPlayerStore,\n} from '@videojs/core/dom';\nimport type { InferStoreState } from '@videojs/store';\nimport { combine, createStore } from '@videojs/store';\nimport { useStore } from '@videojs/store/react';\nimport type { FC, ReactNode } from 'react';\nimport { useEffect, useState } from 'react';\n\nimport { useDestroy } from '../utils/use-destroy';\nimport { Container, PlayerContextProvider, useMedia, usePlayerContext } from './context';\n\nexport interface CreatePlayerConfig<Features extends AnyPlayerFeature[]> {\n features: Features;\n displayName?: string;\n}\n\nexport interface ProviderProps {\n children: ReactNode;\n}\n\nexport interface CreatePlayerResult<Store extends PlayerStore> {\n Provider: FC<ProviderProps>;\n Container: typeof Container;\n usePlayer: UsePlayerHook<Store>;\n useMedia: () => Media | null;\n}\n\nexport type UsePlayerHook<Store extends PlayerStore> = {\n (): Store;\n <R>(selector: (state: InferStoreState<Store>) => R): R;\n};\n\n/**\n * Create a player instance with typed store, Provider component, Container, and hooks.\n *\n * @label Video\n * @param config - Player configuration with features and optional display name.\n */\nexport function createPlayer(config: CreatePlayerConfig<VideoFeatures>): CreatePlayerResult<VideoPlayerStore>;\n\n/**\n * Create a player for audio media.\n *\n * @label Audio\n * @param config - Player configuration with features and optional display name.\n */\nexport function createPlayer(config: CreatePlayerConfig<AudioFeatures>): CreatePlayerResult<AudioPlayerStore>;\n\n/**\n * Create a player with custom features.\n *\n * @label Generic\n * @param config - Player configuration with features and optional display name.\n */\nexport function createPlayer<const Features extends AnyPlayerFeature[]>(\n config: CreatePlayerConfig<Features>\n): CreatePlayerResult<PlayerStore<Features>>;\n\nexport function createPlayer(config: CreatePlayerConfig<AnyPlayerFeature[]>): CreatePlayerResult<AnyPlayerStore> {\n function Provider({ children }: ProviderProps): ReactNode {\n const [store] = useState(() => createStore<PlayerTarget>()(combine(...config.features)));\n const [media, setMedia] = useState<Media | null>(null);\n const [container, setContainer] = useState<HTMLElement | null>(null);\n\n useDestroy(store);\n\n useEffect(() => {\n if (!media) return;\n return store.attach({ media, container });\n }, [media, container, store]);\n\n return (\n <PlayerContextProvider value={{ store, media, setMedia, container, setContainer }}>\n {children}\n </PlayerContextProvider>\n );\n }\n\n if (__DEV__ && config.displayName) {\n Provider.displayName = `${config.displayName}.Provider`;\n }\n\n function usePlayer<R>(selector?: (state: object) => R): AnyPlayerStore | R {\n const { store } = usePlayerContext();\n return useStore(store, selector as any);\n }\n\n return {\n Provider,\n Container,\n usePlayer,\n useMedia,\n };\n}\n"],"mappings":";;;;;;;;;;AAqEA,SAAgB,aAAa,QAAoF;CAC/G,SAAS,SAAS,EAAE,YAAsC;EACxD,MAAM,CAAC,SAAS,eAAe,aAA2B,CAAC,QAAQ,GAAG,OAAO,SAAS,CAAC,CAAC;EACxF,MAAM,CAAC,OAAO,YAAY,SAAuB,KAAK;EACtD,MAAM,CAAC,WAAW,gBAAgB,SAA6B,KAAK;AAEpE,aAAW,MAAM;AAEjB,kBAAgB;AACd,OAAI,CAAC,MAAO;AACZ,UAAO,MAAM,OAAO;IAAE;IAAO;IAAW,CAAC;KACxC;GAAC;GAAO;GAAW;GAAM,CAAC;AAE7B,SACE,oBAAC;GAAsB,OAAO;IAAE;IAAO;IAAO;IAAU;IAAW;IAAc;GAC9E;IACqB;;CAQ5B,SAAS,UAAa,UAAqD;EACzE,MAAM,EAAE,UAAU,kBAAkB;AACpC,SAAO,SAAS,OAAO,SAAgB;;AAGzC,QAAO;EACL;EACA;EACA;EACA;EACD"}
|
|
@@ -152,7 +152,7 @@
|
|
|
152
152
|
color: oklch(1 0 0);
|
|
153
153
|
font-size: 0.875rem;
|
|
154
154
|
text-shadow: 0 1px 0 oklch(0 0 0 / 0.5);
|
|
155
|
-
transition-property: opacity,
|
|
155
|
+
transition-property: opacity, scale;
|
|
156
156
|
transition-duration: 500ms;
|
|
157
157
|
transition-delay: 100ms;
|
|
158
158
|
transition-timing-function: linear(
|
|
@@ -178,7 +178,7 @@
|
|
|
178
178
|
.media-minimal-skin .media-error[data-starting-style] .media-error__dialog,
|
|
179
179
|
.media-minimal-skin .media-error[data-ending-style] .media-error__dialog {
|
|
180
180
|
opacity: 0;
|
|
181
|
-
|
|
181
|
+
scale: 0.5;
|
|
182
182
|
}
|
|
183
183
|
|
|
184
184
|
.media-minimal-skin .media-error__content {
|
|
@@ -195,6 +195,7 @@
|
|
|
195
195
|
|
|
196
196
|
.media-minimal-skin .media-error__description {
|
|
197
197
|
opacity: 0.7;
|
|
198
|
+
overflow-wrap: anywhere;
|
|
198
199
|
}
|
|
199
200
|
|
|
200
201
|
.media-minimal-skin .media-error__actions {
|
|
@@ -214,12 +215,12 @@
|
|
|
214
215
|
container: media-controls / inline-size;
|
|
215
216
|
display: flex;
|
|
216
217
|
align-items: center;
|
|
217
|
-
--media-controls-current-shadow-color: oklch(from currentColor 0 0 0 / clamp(0, calc((l - 0.5) * 0.5), 0.
|
|
218
|
+
--media-controls-current-shadow-color: oklch(from currentColor 0 0 0 / clamp(0, calc((l - 0.5) * 0.5), 0.15));
|
|
218
219
|
--media-controls-current-shadow-color-subtle: oklch(
|
|
219
220
|
from var(--media-controls-current-shadow-color) l c h /
|
|
220
221
|
calc(alpha * 0.4)
|
|
221
222
|
);
|
|
222
|
-
text-shadow: 0 0
|
|
223
|
+
text-shadow: 0 1px 0 var(--media-controls-current-shadow-color);
|
|
223
224
|
}
|
|
224
225
|
|
|
225
226
|
/* ==========================================================================
|
|
@@ -293,7 +294,7 @@
|
|
|
293
294
|
font-weight: 500;
|
|
294
295
|
text-align: center;
|
|
295
296
|
text-shadow: inherit;
|
|
296
|
-
transition-property: background-color, color, outline-offset,
|
|
297
|
+
transition-property: background-color, color, outline-offset, scale;
|
|
297
298
|
transition-duration: 150ms;
|
|
298
299
|
transition-timing-function: ease-out;
|
|
299
300
|
cursor: pointer;
|
|
@@ -333,7 +334,7 @@
|
|
|
333
334
|
}
|
|
334
335
|
|
|
335
336
|
&:active {
|
|
336
|
-
|
|
337
|
+
scale: 0.9;
|
|
337
338
|
}
|
|
338
339
|
|
|
339
340
|
& .media-icon {
|
|
@@ -444,7 +445,7 @@
|
|
|
444
445
|
/* Thumb */
|
|
445
446
|
.media-minimal-skin .media-slider__thumb {
|
|
446
447
|
position: absolute;
|
|
447
|
-
|
|
448
|
+
translate: -50% -50%;
|
|
448
449
|
z-index: 10;
|
|
449
450
|
width: 0.75rem;
|
|
450
451
|
height: 0.75rem;
|
|
@@ -547,13 +548,13 @@
|
|
|
547
548
|
border: 0;
|
|
548
549
|
color: inherit;
|
|
549
550
|
overflow: visible;
|
|
550
|
-
transition-property:
|
|
551
|
+
transition-property: scale, opacity, filter;
|
|
551
552
|
transition-duration: 150ms;
|
|
552
553
|
|
|
553
554
|
&[data-starting-style],
|
|
554
555
|
&[data-ending-style] {
|
|
555
556
|
opacity: 0;
|
|
556
|
-
|
|
557
|
+
scale: 0.5;
|
|
557
558
|
filter: blur(8px);
|
|
558
559
|
}
|
|
559
560
|
|
|
@@ -647,22 +648,31 @@
|
|
|
647
648
|
}
|
|
648
649
|
}
|
|
649
650
|
|
|
651
|
+
.media-minimal-skin .media-popover--volume:has(media-volume-slider[data-availability="unsupported"]) {
|
|
652
|
+
display: none;
|
|
653
|
+
}
|
|
654
|
+
|
|
650
655
|
|
|
651
656
|
/* ==========================================================================
|
|
652
|
-
|
|
657
|
+
Root
|
|
653
658
|
========================================================================== */
|
|
654
659
|
|
|
655
660
|
.media-minimal-skin--audio {
|
|
656
661
|
--media-controls-background-color: oklch(1 0 0);
|
|
657
662
|
--media-controls-border-color: oklch(0 0 0 / 0.1);
|
|
658
|
-
--media-controls-text-color: oklch(0 0 0);
|
|
663
|
+
--media-controls-text-color: var(--media-color-primary, oklch(0 0 0));
|
|
659
664
|
|
|
660
665
|
@media (prefers-color-scheme: dark) {
|
|
661
666
|
--media-controls-background-color: oklch(0 0 0);
|
|
662
667
|
--media-controls-border-color: oklch(1 0 0 / 0.1);
|
|
663
|
-
--media-controls-text-color: oklch(1 0 0);
|
|
668
|
+
--media-controls-text-color: var(--media-color-primary, oklch(1 0 0));
|
|
664
669
|
}
|
|
665
670
|
}
|
|
671
|
+
|
|
672
|
+
/* ==========================================================================
|
|
673
|
+
Controls
|
|
674
|
+
========================================================================== */
|
|
675
|
+
|
|
666
676
|
.media-minimal-skin--audio .media-controls {
|
|
667
677
|
gap: 0.5rem;
|
|
668
678
|
padding: 0.375rem;
|
|
@@ -45,6 +45,37 @@ function PlayLabel() {
|
|
|
45
45
|
if (usePlayer((s) => Boolean(s.ended))) return /* @__PURE__ */ jsx(Fragment, { children: "Replay" });
|
|
46
46
|
return paused ? /* @__PURE__ */ jsx(Fragment, { children: "Play" }) : /* @__PURE__ */ jsx(Fragment, { children: "Pause" });
|
|
47
47
|
}
|
|
48
|
+
function VolumePopover() {
|
|
49
|
+
const volumeUnsupported = usePlayer((s) => s.volumeAvailability === "unsupported");
|
|
50
|
+
const muteButton = /* @__PURE__ */ jsx(MuteButton, { render: (props) => /* @__PURE__ */ jsxs(Button, {
|
|
51
|
+
...props,
|
|
52
|
+
className: "media-button--icon media-button--mute",
|
|
53
|
+
children: [
|
|
54
|
+
/* @__PURE__ */ jsx(VolumeOffIcon, { className: "media-icon media-icon--volume-off" }),
|
|
55
|
+
/* @__PURE__ */ jsx(VolumeLowIcon, { className: "media-icon media-icon--volume-low" }),
|
|
56
|
+
/* @__PURE__ */ jsx(VolumeHighIcon, { className: "media-icon media-icon--volume-high" })
|
|
57
|
+
]
|
|
58
|
+
}) });
|
|
59
|
+
if (volumeUnsupported) return muteButton;
|
|
60
|
+
return /* @__PURE__ */ jsxs(PopoverRoot, {
|
|
61
|
+
openOnHover: true,
|
|
62
|
+
delay: 200,
|
|
63
|
+
closeDelay: 100,
|
|
64
|
+
side: "left",
|
|
65
|
+
children: [/* @__PURE__ */ jsx(PopoverTrigger, { render: muteButton }), /* @__PURE__ */ jsx(PopoverPopup, {
|
|
66
|
+
className: "media-popover media-popover--volume",
|
|
67
|
+
children: /* @__PURE__ */ jsxs(VolumeSliderRoot, {
|
|
68
|
+
className: "media-slider",
|
|
69
|
+
orientation: "horizontal",
|
|
70
|
+
thumbAlignment: "edge",
|
|
71
|
+
children: [/* @__PURE__ */ jsx(SliderTrack, {
|
|
72
|
+
className: "media-slider__track",
|
|
73
|
+
children: /* @__PURE__ */ jsx(SliderFill, { className: "media-slider__fill" })
|
|
74
|
+
}), /* @__PURE__ */ jsx(SliderThumb, { className: "media-slider__thumb media-slider__thumb--persistent" })]
|
|
75
|
+
})
|
|
76
|
+
})]
|
|
77
|
+
});
|
|
78
|
+
}
|
|
48
79
|
function MinimalAudioSkin(props) {
|
|
49
80
|
const { children, className, ...rest } = props;
|
|
50
81
|
return /* @__PURE__ */ jsxs(Container, {
|
|
@@ -155,32 +186,7 @@ function MinimalAudioSkin(props) {
|
|
|
155
186
|
className: "media-tooltip",
|
|
156
187
|
children: "Toggle playback rate"
|
|
157
188
|
})]
|
|
158
|
-
}), /* @__PURE__ */
|
|
159
|
-
openOnHover: true,
|
|
160
|
-
delay: 200,
|
|
161
|
-
closeDelay: 100,
|
|
162
|
-
side: "left",
|
|
163
|
-
children: [/* @__PURE__ */ jsx(PopoverTrigger, { render: /* @__PURE__ */ jsx(MuteButton, { render: (props) => /* @__PURE__ */ jsxs(Button, {
|
|
164
|
-
...props,
|
|
165
|
-
className: "media-button--icon media-button--mute",
|
|
166
|
-
children: [
|
|
167
|
-
/* @__PURE__ */ jsx(VolumeOffIcon, { className: "media-icon media-icon--volume-off" }),
|
|
168
|
-
/* @__PURE__ */ jsx(VolumeLowIcon, { className: "media-icon media-icon--volume-low" }),
|
|
169
|
-
/* @__PURE__ */ jsx(VolumeHighIcon, { className: "media-icon media-icon--volume-high" })
|
|
170
|
-
]
|
|
171
|
-
}) }) }), /* @__PURE__ */ jsx(PopoverPopup, {
|
|
172
|
-
className: "media-popover media-popover--volume",
|
|
173
|
-
children: /* @__PURE__ */ jsxs(VolumeSliderRoot, {
|
|
174
|
-
className: "media-slider",
|
|
175
|
-
orientation: "horizontal",
|
|
176
|
-
thumbAlignment: "edge",
|
|
177
|
-
children: [/* @__PURE__ */ jsx(SliderTrack, {
|
|
178
|
-
className: "media-slider__track",
|
|
179
|
-
children: /* @__PURE__ */ jsx(SliderFill, { className: "media-slider__fill" })
|
|
180
|
-
}), /* @__PURE__ */ jsx(SliderThumb, { className: "media-slider__thumb media-slider__thumb--persistent" })]
|
|
181
|
-
})
|
|
182
|
-
})]
|
|
183
|
-
})]
|
|
189
|
+
}), /* @__PURE__ */ jsx(VolumePopover, {})]
|
|
184
190
|
})
|
|
185
191
|
] })
|
|
186
192
|
})]
|