@m4l/gclick 0.10.0 → 0.11.0-beta-refactor-videojs-v10-player.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/components/CameraStream/defaults/DefaultPhaseStreaming.d.ts +1 -1
- package/components/CameraStream/defaults/DefaultPhaseStreaming.d.ts.map +1 -1
- package/components/CameraStreams/CameraStreamPlayersContext.d.ts +20 -12
- package/components/CameraStreams/CameraStreamPlayersContext.d.ts.map +1 -1
- package/components/CameraStreams/CameraStreamsProvider.d.ts +1 -1
- package/components/CameraStreams/CameraStreamsProvider.d.ts.map +1 -1
- package/components/CameraStreams/CameraStreamsProvider.js +18 -16
- package/components/CameraStreams/createCameraStreamPlayersRegistry.d.ts.map +1 -1
- package/components/CameraStreams/createCameraStreamPlayersRegistry.js +16 -6
- package/components/CameraStreams/subcomponents/CameraStreamsSuspensionController.d.ts +18 -0
- package/components/CameraStreams/subcomponents/CameraStreamsSuspensionController.d.ts.map +1 -0
- package/components/CameraStreams/subcomponents/CameraStreamsSuspensionController.js +35 -0
- package/components/CameraStreams/types.d.ts +11 -4
- package/components/CameraStreams/types.d.ts.map +1 -1
- package/components/CameraStreams/useCameraStreamPlayers.d.ts +4 -0
- package/components/CameraStreams/useCameraStreamPlayers.d.ts.map +1 -1
- package/components/CameraStreams/useCameraStreamPlayers.js +15 -18
- package/components/VideoPlayer/VideoPlayer.d.ts +30 -23
- package/components/VideoPlayer/VideoPlayer.d.ts.map +1 -1
- package/components/VideoPlayer/VideoPlayer.js +33 -256
- package/components/VideoPlayer/VideoPlayer.styles.d.ts +8 -7
- package/components/VideoPlayer/VideoPlayer.styles.d.ts.map +1 -1
- package/components/VideoPlayer/VideoPlayer.styles.js +9 -31
- package/components/VideoPlayer/constants.d.ts +11 -15
- package/components/VideoPlayer/constants.d.ts.map +1 -1
- package/components/VideoPlayer/constants.js +4 -15
- package/components/VideoPlayer/hlsConfig.d.ts +20 -0
- package/components/VideoPlayer/hlsConfig.d.ts.map +1 -0
- package/components/VideoPlayer/hlsConfig.js +19 -0
- package/components/VideoPlayer/hooks/usePlayerControl.d.ts +12 -0
- package/components/VideoPlayer/hooks/usePlayerControl.d.ts.map +1 -0
- package/components/VideoPlayer/hooks/usePlayerControl.js +78 -0
- package/components/VideoPlayer/hooks/usePlayerEvents.d.ts +25 -0
- package/components/VideoPlayer/hooks/usePlayerEvents.d.ts.map +1 -0
- package/components/VideoPlayer/hooks/usePlayerEvents.js +18 -0
- package/components/VideoPlayer/index.d.ts +3 -3
- package/components/VideoPlayer/index.d.ts.map +1 -1
- package/components/VideoPlayer/player.factory.d.ts +32 -0
- package/components/VideoPlayer/player.factory.d.ts.map +1 -0
- package/components/VideoPlayer/player.factory.js +8 -0
- package/components/VideoPlayer/slots/VideoPlayerSlots.d.ts +5 -3
- package/components/VideoPlayer/slots/VideoPlayerSlots.d.ts.map +1 -1
- package/components/VideoPlayer/slots/VideoPlayerSlots.js +8 -12
- package/components/VideoPlayer/slots/slots.d.ts +2 -2
- package/components/VideoPlayer/slots/slots.d.ts.map +1 -1
- package/components/VideoPlayer/slots/slots.js +1 -1
- package/components/VideoPlayer/subcomponents/GclickVideoSkin.d.ts +20 -0
- package/components/VideoPlayer/subcomponents/GclickVideoSkin.d.ts.map +1 -0
- package/components/VideoPlayer/subcomponents/GclickVideoSkin.js +187 -0
- package/components/VideoPlayer/subcomponents/VideoPlayerStage.d.ts +27 -0
- package/components/VideoPlayer/subcomponents/VideoPlayerStage.d.ts.map +1 -0
- package/components/VideoPlayer/subcomponents/VideoPlayerStage.js +61 -0
- package/components/VideoPlayer/types.d.ts +65 -101
- package/components/VideoPlayer/types.d.ts.map +1 -1
- package/components/VideoPlayer/utils.d.ts +15 -6
- package/components/VideoPlayer/utils.d.ts.map +1 -1
- package/components/VideoPlayer/utils.js +5 -1
- package/index.js +27 -27
- package/package.json +4 -4
|
@@ -22,7 +22,7 @@ import { CameraStreamPhaseStreamingSlotProps } from '../types';
|
|
|
22
22
|
* the consumer can override only a badge (via `slots.liveBadge` /
|
|
23
23
|
* `slots.replayBadge`) without rewriting this whole component.
|
|
24
24
|
*
|
|
25
|
-
* Registers its `
|
|
25
|
+
* Registers its `VideoPlayerControl` in the `CameraStreamPlayersRegistry` while
|
|
26
26
|
* mounted, so `useCameraStreamPlayers()` can drive this player's transport
|
|
27
27
|
* (pause / mute / fullscreen / snapshot) from outside the slot. The
|
|
28
28
|
* registration is null-safe: if the slot is rendered without a provider (e.g.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultPhaseStreaming.d.ts","sourceRoot":"","sources":["../../../../../../../packages/gclick/src/components/CameraStream/defaults/DefaultPhaseStreaming.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,UAAU,CAAC;AAcpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,SAAS,EACT,MAAM,EACN,IAAI,EACJ,KAAK,EACL,OAAO,EACP,QAAQ,EACR,WAAW,EACX,gBAAgB,EAChB,aAAa,EACb,eAAe,GAChB,EAAE,mCAAmC,
|
|
1
|
+
{"version":3,"file":"DefaultPhaseStreaming.d.ts","sourceRoot":"","sources":["../../../../../../../packages/gclick/src/components/CameraStream/defaults/DefaultPhaseStreaming.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,UAAU,CAAC;AAcpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,SAAS,EACT,MAAM,EACN,IAAI,EACJ,KAAK,EACL,OAAO,EACP,QAAQ,EACR,WAAW,EACX,gBAAgB,EAChB,aAAa,EACb,eAAe,GAChB,EAAE,mCAAmC,oDAyFrC"}
|
|
@@ -1,26 +1,34 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { VideoPlayerControl } from '../VideoPlayer/types';
|
|
2
2
|
import { PlayerKey } from './types';
|
|
3
3
|
/**
|
|
4
|
-
* Imperative registry of live
|
|
4
|
+
* Imperative registry of live {@link VideoPlayerControl}s keyed by `PlayerKey`.
|
|
5
5
|
*
|
|
6
|
-
* Kept OUTSIDE the Zustand store on purpose: a
|
|
7
|
-
* video.js
|
|
8
|
-
* would break the devtools/immer "state is serializable" invariant
|
|
9
|
-
* the SRP boundary (store = coordination/FSM, registry = video
|
|
6
|
+
* Kept OUTSIDE the Zustand store on purpose: a control is a mutable adapter
|
|
7
|
+
* over a video.js v10 player store, not serializable FSM state. Putting it in
|
|
8
|
+
* the store would break the devtools/immer "state is serializable" invariant
|
|
9
|
+
* and blur the SRP boundary (store = coordination/FSM, registry = video
|
|
10
|
+
* transport).
|
|
10
11
|
*
|
|
11
|
-
* The default `phaseStreaming` slot registers its
|
|
12
|
+
* The default `phaseStreaming` slot registers its control on mount and
|
|
12
13
|
* unregisters on unmount, so external imperative control works without the
|
|
13
14
|
* consumer overriding any slot.
|
|
14
15
|
*/
|
|
15
16
|
export interface CameraStreamPlayersRegistry {
|
|
16
|
-
/** Register (or replace) the
|
|
17
|
-
register(key: PlayerKey,
|
|
18
|
-
/** Remove the
|
|
17
|
+
/** Register (or replace) the control for a player key. */
|
|
18
|
+
register(key: PlayerKey, control: VideoPlayerControl): void;
|
|
19
|
+
/** Remove the control for a player key (called on unmount). */
|
|
19
20
|
unregister(key: PlayerKey): void;
|
|
20
|
-
/** Resolve the
|
|
21
|
-
get(key: PlayerKey):
|
|
21
|
+
/** Resolve the control for a player key, or `null` when not registered. */
|
|
22
|
+
get(key: PlayerKey): VideoPlayerControl | null;
|
|
22
23
|
/** Every currently-registered player key. */
|
|
23
24
|
keys(): PlayerKey[];
|
|
25
|
+
/**
|
|
26
|
+
* Subscribe to registration changes (a control registered or unregistered).
|
|
27
|
+
* Returns an unsubscribe function. Lets the suspension coordinator catch
|
|
28
|
+
* players that start streaming *after* the subtree was already suspended (an
|
|
29
|
+
* in-flight request resolving while hidden), which a one-shot snapshot misses.
|
|
30
|
+
*/
|
|
31
|
+
subscribe(listener: () => void): () => void;
|
|
24
32
|
}
|
|
25
33
|
/**
|
|
26
34
|
* Context carrying the scoped registry down the tree. Mirrors the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CameraStreamPlayersContext.d.ts","sourceRoot":"","sources":["../../../../../../packages/gclick/src/components/CameraStreams/CameraStreamPlayersContext.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"CameraStreamPlayersContext.d.ts","sourceRoot":"","sources":["../../../../../../packages/gclick/src/components/CameraStreams/CameraStreamPlayersContext.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,2BAA2B;IAC1C,0DAA0D;IAC1D,QAAQ,CAAC,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAC5D,+DAA+D;IAC/D,UAAU,CAAC,GAAG,EAAE,SAAS,GAAG,IAAI,CAAC;IACjC,2EAA2E;IAC3E,GAAG,CAAC,GAAG,EAAE,SAAS,GAAG,kBAAkB,GAAG,IAAI,CAAC;IAC/C,6CAA6C;IAC7C,IAAI,IAAI,SAAS,EAAE,CAAC;IACpB;;;;;OAKG;IACH,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC;CAC7C;AAED;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,6DACkB,CAAC"}
|
|
@@ -9,7 +9,7 @@ import { CameraStreamsProviderProps } from './types';
|
|
|
9
9
|
* and call `useCameraStreams()` from any descendant.
|
|
10
10
|
*
|
|
11
11
|
* Alongside the store it provides a `CameraStreamPlayersRegistry` (a separate
|
|
12
|
-
* ref-based map of live `
|
|
12
|
+
* ref-based map of live `VideoPlayerControl`s). The default `phaseStreaming`
|
|
13
13
|
* slot registers into it, so `useCameraStreamPlayers()` can drive the video
|
|
14
14
|
* transport (pause / mute / fullscreen / snapshot) from outside the slot.
|
|
15
15
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CameraStreamsProvider.d.ts","sourceRoot":"","sources":["../../../../../../packages/gclick/src/components/CameraStreams/CameraStreamsProvider.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CameraStreamsProvider.d.ts","sourceRoot":"","sources":["../../../../../../packages/gclick/src/components/CameraStreams/CameraStreamsProvider.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAC;AAE1D;;;;;;;;;;;;;GAaG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,0BAA0B,oDAkCtE"}
|
|
@@ -1,27 +1,29 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
1
|
+
import { jsx as t, jsxs as c } from "@emotion/react/jsx-runtime";
|
|
2
2
|
import { useRef as o } from "react";
|
|
3
|
-
import { useModuleDictionary as
|
|
4
|
-
import { resolveCameraStreamsDictionaryLabels as
|
|
5
|
-
import { CameraStreamsContext as
|
|
6
|
-
import { CameraStreamPlayersContext as
|
|
7
|
-
import { createCameraStreamsStore as
|
|
8
|
-
import { createCameraStreamPlayersRegistry as
|
|
9
|
-
import { CameraStreamsEngine as
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
3
|
+
import { useModuleDictionary as f } from "@m4l/core";
|
|
4
|
+
import { resolveCameraStreamsDictionaryLabels as u } from "./dictionary.js";
|
|
5
|
+
import { CameraStreamsContext as p } from "./CameraStreamsContext.js";
|
|
6
|
+
import { CameraStreamPlayersContext as C } from "./CameraStreamPlayersContext.js";
|
|
7
|
+
import { createCameraStreamsStore as S } from "./store.js";
|
|
8
|
+
import { createCameraStreamPlayersRegistry as d } from "./createCameraStreamPlayersRegistry.js";
|
|
9
|
+
import { CameraStreamsEngine as y } from "./subcomponents/CameraStreamsEngine.js";
|
|
10
|
+
import { CameraStreamsSuspensionController as v } from "./subcomponents/CameraStreamsSuspensionController.js";
|
|
11
|
+
function M(a) {
|
|
12
|
+
const { children: m, labels: s, suspended: i = !1, ...n } = a, { getLabel: l } = f(), r = o(null);
|
|
13
|
+
r.current || (r.current = S({
|
|
13
14
|
...n,
|
|
14
15
|
labels: {
|
|
15
|
-
...
|
|
16
|
-
...
|
|
16
|
+
...u(l),
|
|
17
|
+
...s ?? {}
|
|
17
18
|
}
|
|
18
19
|
}));
|
|
19
20
|
const e = o(null);
|
|
20
|
-
return e.current || (e.current =
|
|
21
|
-
/* @__PURE__ */ t(
|
|
21
|
+
return e.current || (e.current = d()), /* @__PURE__ */ t(p.Provider, { value: r.current, children: /* @__PURE__ */ c(C.Provider, { value: e.current, children: [
|
|
22
|
+
/* @__PURE__ */ t(y, {}),
|
|
23
|
+
/* @__PURE__ */ t(v, { suspended: i }),
|
|
22
24
|
m
|
|
23
25
|
] }) });
|
|
24
26
|
}
|
|
25
27
|
export {
|
|
26
|
-
|
|
28
|
+
M as CameraStreamsProvider
|
|
27
29
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createCameraStreamPlayersRegistry.d.ts","sourceRoot":"","sources":["../../../../../../packages/gclick/src/components/CameraStreams/createCameraStreamPlayersRegistry.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AAIhF;;;GAGG;AACH,wBAAgB,iCAAiC,IAAI,2BAA2B,
|
|
1
|
+
{"version":3,"file":"createCameraStreamPlayersRegistry.d.ts","sourceRoot":"","sources":["../../../../../../packages/gclick/src/components/CameraStreams/createCameraStreamPlayersRegistry.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AAIhF;;;GAGG;AACH,wBAAgB,iCAAiC,IAAI,2BAA2B,CAkC/E"}
|
|
@@ -1,20 +1,30 @@
|
|
|
1
|
-
function
|
|
2
|
-
const r = /* @__PURE__ */ new Map()
|
|
1
|
+
function o() {
|
|
2
|
+
const r = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set(), n = () => {
|
|
3
|
+
t.forEach((e) => e());
|
|
4
|
+
};
|
|
3
5
|
return {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
+
/** Store (or replace) the control for a key and notify subscribers. */
|
|
7
|
+
register(e, s) {
|
|
8
|
+
r.set(e, s), n();
|
|
6
9
|
},
|
|
10
|
+
/** Drop the control for a key and notify subscribers. */
|
|
7
11
|
unregister(e) {
|
|
8
|
-
r.delete(e);
|
|
12
|
+
r.delete(e), n();
|
|
9
13
|
},
|
|
10
14
|
get(e) {
|
|
11
15
|
return r.get(e) ?? null;
|
|
12
16
|
},
|
|
13
17
|
keys() {
|
|
14
18
|
return Array.from(r.keys());
|
|
19
|
+
},
|
|
20
|
+
/** Register a change listener; returns a function that removes it. */
|
|
21
|
+
subscribe(e) {
|
|
22
|
+
return t.add(e), () => {
|
|
23
|
+
t.delete(e);
|
|
24
|
+
};
|
|
15
25
|
}
|
|
16
26
|
};
|
|
17
27
|
}
|
|
18
28
|
export {
|
|
19
|
-
|
|
29
|
+
o as createCameraStreamPlayersRegistry
|
|
20
30
|
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface CameraStreamsSuspensionControllerProps {
|
|
2
|
+
/** Whether the provider's subtree is currently suspended (hidden). */
|
|
3
|
+
suspended: boolean;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Invisible coordinator that pauses/resumes video decode when the provider is
|
|
7
|
+
* suspended (the subtree is hidden but kept alive, e.g. behind an inactive tab).
|
|
8
|
+
*
|
|
9
|
+
* On suspend it pauses every currently-playing clip — freeing decode while
|
|
10
|
+
* preserving the playhead and store — and remembers exactly that set so it can
|
|
11
|
+
* resume it later. It also pauses any clip that starts streaming *while*
|
|
12
|
+
* suspended (an in-flight request resolving after the tab was hidden), which a
|
|
13
|
+
* one-shot snapshot would miss. On resume it replays only the clips it paused;
|
|
14
|
+
* idle, ended, and user-paused players are left untouched.
|
|
15
|
+
*/
|
|
16
|
+
export declare function CameraStreamsSuspensionController({ suspended, }: CameraStreamsSuspensionControllerProps): null;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=CameraStreamsSuspensionController.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CameraStreamsSuspensionController.d.ts","sourceRoot":"","sources":["../../../../../../../packages/gclick/src/components/CameraStreams/subcomponents/CameraStreamsSuspensionController.tsx"],"names":[],"mappings":"AAOA,UAAU,sCAAsC;IAC9C,sEAAsE;IACtE,SAAS,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iCAAiC,CAAC,EAChD,SAAS,GACV,EAAE,sCAAsC,GAAG,IAAI,CAsD/C"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { useContext as i, useRef as c, useEffect as f } from "react";
|
|
2
|
+
import { CameraStreamPlayersContext as d } from "../CameraStreamPlayersContext.js";
|
|
3
|
+
function p({
|
|
4
|
+
suspended: n
|
|
5
|
+
}) {
|
|
6
|
+
const e = i(d), o = c(/* @__PURE__ */ new Set());
|
|
7
|
+
return f(() => {
|
|
8
|
+
if (!e)
|
|
9
|
+
return;
|
|
10
|
+
const s = o.current;
|
|
11
|
+
if (!n) {
|
|
12
|
+
s.forEach((t) => {
|
|
13
|
+
e.get(t)?.play();
|
|
14
|
+
}), s.clear();
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
const a = new Set(e.keys());
|
|
18
|
+
e.keys().forEach((t) => {
|
|
19
|
+
const r = e.get(t);
|
|
20
|
+
r && !r.isPaused() && (r.pause(), s.add(t));
|
|
21
|
+
});
|
|
22
|
+
const u = () => {
|
|
23
|
+
e.keys().forEach((t) => {
|
|
24
|
+
if (a.has(t) || s.has(t))
|
|
25
|
+
return;
|
|
26
|
+
const r = e.get(t);
|
|
27
|
+
r && (r.pause(), s.add(t));
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
return e.subscribe(u);
|
|
31
|
+
}, [n, e]), null;
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
p as CameraStreamsSuspensionController
|
|
35
|
+
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { ChannelType } from '../VideoTimeLineSelector/types';
|
|
3
|
-
import { VideoPlayerHandle } from '../VideoPlayer/types';
|
|
4
3
|
/**
|
|
5
4
|
* String identifier reused as the per-channel key. Mirrors `ChannelType['id']`
|
|
6
5
|
* so consumers can index without conversion. A channel is one transport stream
|
|
@@ -265,6 +264,16 @@ export interface CameraStreamsStoreInitProps extends Omit<InitialCameraStreamsSt
|
|
|
265
264
|
/** Provider props — init slice + React children. */
|
|
266
265
|
export interface CameraStreamsProviderProps extends InitialCameraStreamsStoreProps {
|
|
267
266
|
children: ReactNode;
|
|
267
|
+
/**
|
|
268
|
+
* Soft-suspend the provider while the subtree is hidden (e.g. behind an
|
|
269
|
+
* inactive tab kept alive via `display:none`). When it flips to `true` the
|
|
270
|
+
* playing clips are paused — freeing video decode — while their state, the
|
|
271
|
+
* store and the DOM stay intact; flipping back to `false` resumes exactly the
|
|
272
|
+
* clips that were playing. Idle/ended/user-paused players are left untouched.
|
|
273
|
+
* Defaults to `false` (no suspension). Tab-agnostic: callers map their own
|
|
274
|
+
* visibility (`suspended={!isActive}`).
|
|
275
|
+
*/
|
|
276
|
+
suspended?: boolean;
|
|
268
277
|
}
|
|
269
278
|
/**
|
|
270
279
|
* Public surface of `useCameraStreams()`. Selectors live on the headless hook
|
|
@@ -278,7 +287,7 @@ export interface UseCameraStreamsResult {
|
|
|
278
287
|
}
|
|
279
288
|
/**
|
|
280
289
|
* Live playback status of one player, derived on demand from its
|
|
281
|
-
* `
|
|
290
|
+
* `VideoPlayerControl`. Distinct from the FSM `phase` (which describes the
|
|
282
291
|
* request lifecycle) — this reflects the `<video>` element transport state.
|
|
283
292
|
*/
|
|
284
293
|
export interface CameraStreamPlaybackState {
|
|
@@ -317,8 +326,6 @@ export interface UseCameraStreamPlayersResult {
|
|
|
317
326
|
snapshot(key: PlayerKey): string | null;
|
|
318
327
|
/** Read the live playback status of one player, or `null` when not streaming. */
|
|
319
328
|
getPlaybackState(key: PlayerKey): CameraStreamPlaybackState | null;
|
|
320
|
-
/** Escape hatch: the raw `VideoPlayerHandle` of one player, or `null`. */
|
|
321
|
-
getHandle(key: PlayerKey): VideoPlayerHandle | null;
|
|
322
329
|
}
|
|
323
330
|
/**
|
|
324
331
|
* Compose a stable `PlayerKey` from its components. Centralised so producers
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../packages/gclick/src/components/CameraStreams/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../packages/gclick/src/components/CameraStreams/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAElE;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC;AAE/B;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC;AAE/B,gFAAgF;AAChF,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,UAAU,CAAC;AAEnD;;;;;;GAMG;AACH,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,iBAAiB,EAAE,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AE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACjD,2EAA2E;IAC3E,uBAAuB,CAAC,GAAG,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvD,4EAA4E;IAC5E,QAAQ,CAAC,GAAG,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,CAAC;IACxC,iFAAiF;IACjF,gBAAgB,CAAC,GAAG,EAAE,SAAS,GAAG,yBAAyB,GAAG,IAAI,CAAC;CACpE;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,GAAG,SAAS,CAEnG"}
|
|
@@ -6,6 +6,10 @@ import { UseCameraStreamPlayersResult } from './types';
|
|
|
6
6
|
* (`pause / mute / seek / fullscreen / snapshot`) of players that are already
|
|
7
7
|
* streaming — without the consumer overriding the `phaseStreaming` slot.
|
|
8
8
|
*
|
|
9
|
+
* Each registered player is a {@link VideoPlayerControl} — a thin adapter over
|
|
10
|
+
* the player's video.js v10 store — so every action below dispatches a store
|
|
11
|
+
* action under the hood.
|
|
12
|
+
*
|
|
9
13
|
* Bulk-able mutations accept an optional `keys` array: omit it to act on every
|
|
10
14
|
* registered player, or pass a subset to scope the action.
|
|
11
15
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCameraStreamPlayers.d.ts","sourceRoot":"","sources":["../../../../../../packages/gclick/src/components/CameraStreams/useCameraStreamPlayers.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAa,4BAA4B,EAAE,MAAM,SAAS,CAAC;AAEvE
|
|
1
|
+
{"version":3,"file":"useCameraStreamPlayers.d.ts","sourceRoot":"","sources":["../../../../../../packages/gclick/src/components/CameraStreams/useCameraStreamPlayers.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAa,4BAA4B,EAAE,MAAM,SAAS,CAAC;AAEvE;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,sBAAsB,IAAI,4BAA4B,CA+DrE"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { useContext as u, useMemo as
|
|
1
|
+
import { useContext as u, useMemo as i } from "react";
|
|
2
2
|
import { CameraStreamPlayersContext as o } from "./CameraStreamPlayersContext.js";
|
|
3
3
|
function c() {
|
|
4
|
-
const
|
|
5
|
-
if (!
|
|
4
|
+
const s = u(o);
|
|
5
|
+
if (!s)
|
|
6
6
|
throw new Error(
|
|
7
7
|
"useCameraStreamPlayers must be used inside a <CameraStreamsProvider>."
|
|
8
8
|
);
|
|
9
|
-
return
|
|
10
|
-
const a = (e) => (e ??
|
|
9
|
+
return i(() => {
|
|
10
|
+
const a = (e) => (e ?? s.keys()).map((r) => s.get(r)).filter((r) => r !== null);
|
|
11
11
|
return {
|
|
12
12
|
pause(e) {
|
|
13
13
|
a(e).forEach((t) => t.pause());
|
|
@@ -16,40 +16,37 @@ function c() {
|
|
|
16
16
|
await Promise.all(a(e).map((t) => t.play()));
|
|
17
17
|
},
|
|
18
18
|
setMuted(e, t) {
|
|
19
|
-
a(t).forEach((
|
|
19
|
+
a(t).forEach((r) => r.setMuted(e));
|
|
20
20
|
},
|
|
21
21
|
toggleMuted(e) {
|
|
22
|
-
a(e).forEach((t) => t.setMuted(!t.
|
|
22
|
+
a(e).forEach((t) => t.setMuted(!t.isMuted()));
|
|
23
23
|
},
|
|
24
24
|
seek(e, t) {
|
|
25
|
-
a(t).forEach((
|
|
25
|
+
a(t).forEach((r) => r.seek(e));
|
|
26
26
|
},
|
|
27
27
|
setPlaybackRate(e, t) {
|
|
28
|
-
a(t).forEach((
|
|
28
|
+
a(t).forEach((r) => r.setPlaybackRate(e));
|
|
29
29
|
},
|
|
30
30
|
requestFullscreen(e) {
|
|
31
|
-
return
|
|
31
|
+
return s.get(e)?.requestFullscreen() ?? Promise.resolve();
|
|
32
32
|
},
|
|
33
33
|
requestPictureInPicture(e) {
|
|
34
|
-
return
|
|
34
|
+
return s.get(e)?.requestPictureInPicture() ?? Promise.resolve();
|
|
35
35
|
},
|
|
36
36
|
snapshot(e) {
|
|
37
|
-
return
|
|
37
|
+
return s.get(e)?.snapshot() ?? null;
|
|
38
38
|
},
|
|
39
39
|
/** Read the live mute/pause/live status of one player, or null when absent. */
|
|
40
40
|
getPlaybackState(e) {
|
|
41
|
-
const t =
|
|
41
|
+
const t = s.get(e);
|
|
42
42
|
return t ? {
|
|
43
|
-
isMuted: t.
|
|
43
|
+
isMuted: t.isMuted(),
|
|
44
44
|
isPaused: t.isPaused(),
|
|
45
45
|
isLive: t.isLive()
|
|
46
46
|
} : null;
|
|
47
|
-
},
|
|
48
|
-
getHandle(e) {
|
|
49
|
-
return r.get(e);
|
|
50
47
|
}
|
|
51
48
|
};
|
|
52
|
-
}, [
|
|
49
|
+
}, [s]);
|
|
53
50
|
}
|
|
54
51
|
export {
|
|
55
52
|
c as useCameraStreamPlayers
|
|
@@ -1,30 +1,37 @@
|
|
|
1
1
|
import { VideoPlayerProps } from './types';
|
|
2
2
|
/**
|
|
3
|
-
* HLS-capable video player built on
|
|
4
|
-
* the video.js lifecycle: no UI state for loading, error, or "no source" —
|
|
5
|
-
* those concerns live one layer up (`@m4l/gclick/CameraStream`). When `src`
|
|
6
|
-
* is null or empty the component returns `null`, so consumers are expected
|
|
7
|
-
* to gate the mount based on their own state.
|
|
3
|
+
* HLS-capable video player built on video.js v10 (`@videojs/react`).
|
|
8
4
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
5
|
+
* v10 is declarative and store-driven: a module-scope factory
|
|
6
|
+
* (`player.factory.ts`) yields a `Provider` + `Container` + `usePlayer`; this
|
|
7
|
+
* component mounts the provider once a source exists and renders the player
|
|
8
|
+
* inside it. There is no video.js `Player` object — playback is driven through
|
|
9
|
+
* the store, surfaced to consumers as a thin {@link VideoPlayerControl} handle.
|
|
12
10
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* - `ref` is accepted as a regular prop (no `forwardRef` needed) and is wired
|
|
19
|
-
* to a `VideoPlayerHandle` via `useImperativeHandle`.
|
|
11
|
+
* Pure wrapper around the player lifecycle: no UI state for loading, error or
|
|
12
|
+
* "no source" — those live one layer up (`@m4l/gclick/CameraStream`). When
|
|
13
|
+
* `src` is null/empty the component returns `null` (unmounting the provider and
|
|
14
|
+
* tearing the player down), so consumers gate the mount based on their own
|
|
15
|
+
* state.
|
|
20
16
|
*
|
|
21
|
-
*
|
|
22
|
-
* -
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
17
|
+
* Highlights:
|
|
18
|
+
* - **One composed v10 skin** — the chrome (controls, layout, poster, native
|
|
19
|
+
* live button) is owned by `GclickVideoSkin`, assembled from the dependency's
|
|
20
|
+
* building blocks + official `media-*` classes (no custom per-control CSS).
|
|
21
|
+
* - **Live ↔ VOD in one skin** — while the manifest is live the control bar
|
|
22
|
+
* shows the native `<LiveButton>` and hides the seek region; once it ends
|
|
23
|
+
* (`#EXT-X-ENDLIST` → `streamType: on-demand`) the seek bar + time displays
|
|
24
|
+
* appear. Driven by `isLive`, so the skin never swaps and the `<video>` is
|
|
25
|
+
* never remounted (no reload). See `GclickVideoSkin`.
|
|
26
|
+
* - **Signed-cookie HLS** — the `<video>` is configured so every manifest +
|
|
27
|
+
* segment request carries the CloudFront cookies (see `hlsConfig.ts`).
|
|
28
|
+
* - **Flat frame** — only one styling override on our side: the skin's
|
|
29
|
+
* `--media-border-radius` is set to `0` so the chrome is edge-to-edge and
|
|
30
|
+
* couples to the parent surface (see `VideoPlayer.styles.ts`).
|
|
31
|
+
* - **Poster** — `poster` is forwarded to the skin's poster slot (e.g. a cloud
|
|
32
|
+
* recording snapshot).
|
|
33
|
+
* - **React 19 ref-as-prop** — `ref` resolves to a {@link VideoPlayerControl}
|
|
34
|
+
* without `forwardRef`.
|
|
28
35
|
*/
|
|
29
|
-
export declare function VideoPlayer({ src, mode,
|
|
36
|
+
export declare function VideoPlayer({ src, mode, poster, className, onReady, onPlay, onPause, onEnded, onWaiting, onError, onDurationChange, ref, }: VideoPlayerProps): import("@emotion/react/jsx-runtime").JSX.Element | null;
|
|
30
37
|
//# sourceMappingURL=VideoPlayer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VideoPlayer.d.ts","sourceRoot":"","sources":["../../../../../../packages/gclick/src/components/VideoPlayer/VideoPlayer.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"VideoPlayer.d.ts","sourceRoot":"","sources":["../../../../../../packages/gclick/src/components/VideoPlayer/VideoPlayer.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,WAAW,CAAC,EAC1B,GAAG,EACH,IAAa,EACb,MAAM,EACN,SAAS,EACT,OAAO,EACP,MAAM,EACN,OAAO,EACP,OAAO,EACP,SAAS,EACT,OAAO,EACP,gBAAgB,EAChB,GAAG,GACJ,EAAE,gBAAgB,2DA4BlB"}
|