@ume-group/contracts 0.2.1
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/README.md +37 -0
- package/dist/adserving.d.ts +150 -0
- package/dist/adserving.d.ts.map +1 -0
- package/dist/adserving.js +8 -0
- package/dist/campaigns.d.ts +37 -0
- package/dist/campaigns.d.ts.map +1 -0
- package/dist/campaigns.js +8 -0
- package/dist/gausst.d.ts +236 -0
- package/dist/gausst.d.ts.map +1 -0
- package/dist/gausst.js +307 -0
- package/dist/gausst.test.d.ts +2 -0
- package/dist/gausst.test.d.ts.map +1 -0
- package/dist/gausst.test.js +71 -0
- package/dist/index.d.ts +1531 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1112 -0
- package/dist/layer2/index.d.ts +9 -0
- package/dist/layer2/index.d.ts.map +1 -0
- package/dist/layer2/index.js +10 -0
- package/dist/layer2/shaders.d.ts +185 -0
- package/dist/layer2/shaders.d.ts.map +1 -0
- package/dist/layer2/shaders.js +604 -0
- package/dist/layer2/webcam-utils.d.ts +113 -0
- package/dist/layer2/webcam-utils.d.ts.map +1 -0
- package/dist/layer2/webcam-utils.js +147 -0
- package/dist/layer2/webcam-utils.test.d.ts +2 -0
- package/dist/layer2/webcam-utils.test.d.ts.map +1 -0
- package/dist/layer2/webcam-utils.test.js +18 -0
- package/dist/layer2.d.ts +558 -0
- package/dist/layer2.d.ts.map +1 -0
- package/dist/layer2.js +376 -0
- package/dist/layer2.test.d.ts +2 -0
- package/dist/layer2.test.d.ts.map +1 -0
- package/dist/layer2.test.js +65 -0
- package/dist/perspective.d.ts +28 -0
- package/dist/perspective.d.ts.map +1 -0
- package/dist/perspective.js +157 -0
- package/dist/segmentation/MediaPipeSegmenter.d.ts +201 -0
- package/dist/segmentation/MediaPipeSegmenter.d.ts.map +1 -0
- package/dist/segmentation/MediaPipeSegmenter.js +434 -0
- package/dist/segmentation/index.d.ts +5 -0
- package/dist/segmentation/index.d.ts.map +1 -0
- package/dist/segmentation/index.js +4 -0
- package/dist/webcam/GarbageMatteDragManager.d.ts +63 -0
- package/dist/webcam/GarbageMatteDragManager.d.ts.map +1 -0
- package/dist/webcam/GarbageMatteDragManager.js +183 -0
- package/dist/webcam/WebcamStreamManager.d.ts +103 -0
- package/dist/webcam/WebcamStreamManager.d.ts.map +1 -0
- package/dist/webcam/WebcamStreamManager.js +356 -0
- package/dist/webcam/index.d.ts +5 -0
- package/dist/webcam/index.d.ts.map +1 -0
- package/dist/webcam/index.js +2 -0
- package/openapi/admetise.yaml +632 -0
- package/openapi/includu.yaml +621 -0
- package/openapi/integration.yaml +372 -0
- package/openapi/shared/schemas.yaml +227 -0
- package/package.json +53 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GarbageMatteDragManager — Framework-agnostic garbage matte drag logic.
|
|
3
|
+
*
|
|
4
|
+
* Extracted from editor/player GarbageMatteOverlay.svelte to eliminate
|
|
5
|
+
* code duplication. Both Svelte components become thin wrappers.
|
|
6
|
+
*
|
|
7
|
+
* Handles:
|
|
8
|
+
* - Drag state management (start, move, end)
|
|
9
|
+
* - UV-space coordinate calculation from pointer events
|
|
10
|
+
* - Rectangle corner/edge/move handle clamping
|
|
11
|
+
* - Window-level pointermove/pointerup listeners
|
|
12
|
+
*/
|
|
13
|
+
import type { RectangleGarbageMatte } from '../layer2.js';
|
|
14
|
+
/** Handle types for drag interaction */
|
|
15
|
+
export type DragHandle = 'tl' | 'tr' | 'bl' | 'br' | 't' | 'r' | 'b' | 'l' | 'move';
|
|
16
|
+
export interface GarbageMatteDragCallbacks {
|
|
17
|
+
/** Called on every drag move with the updated rectangle */
|
|
18
|
+
onRectangleChange: (rect: RectangleGarbageMatte) => void;
|
|
19
|
+
/** Called when drag starts (e.g., beginBatch for undo) */
|
|
20
|
+
onDragStart?: () => void;
|
|
21
|
+
/** Called when drag ends normally (e.g., endBatch + save to project) */
|
|
22
|
+
onDragEnd?: () => void;
|
|
23
|
+
/** Called when drag is cancelled by the system (e.g., cancelBatch to revert). Falls back to onDragEnd if not provided. */
|
|
24
|
+
onDragCancel?: () => void;
|
|
25
|
+
}
|
|
26
|
+
export interface GarbageMatteDragConfig {
|
|
27
|
+
/** Reference to the overlay element for getBoundingClientRect */
|
|
28
|
+
getOverlayElement: () => HTMLElement | null;
|
|
29
|
+
/** Webcam aspect ratio for correct UV mapping */
|
|
30
|
+
getWebcamAspectRatio: () => number;
|
|
31
|
+
/** Current rectangle state for drag start snapshot */
|
|
32
|
+
getCurrentRectangle: () => RectangleGarbageMatte;
|
|
33
|
+
}
|
|
34
|
+
export declare class GarbageMatteDragManager {
|
|
35
|
+
private callbacks;
|
|
36
|
+
private config;
|
|
37
|
+
private dragState;
|
|
38
|
+
private boundMove;
|
|
39
|
+
private boundUp;
|
|
40
|
+
constructor(callbacks: GarbageMatteDragCallbacks, config: GarbageMatteDragConfig);
|
|
41
|
+
/** Whether a drag is currently in progress */
|
|
42
|
+
get isDragging(): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Start a drag operation. Call from pointerdown on a handle element.
|
|
45
|
+
* Automatically calls preventDefault/stopPropagation on the event.
|
|
46
|
+
*/
|
|
47
|
+
startDrag(e: PointerEvent, handle: DragHandle): void;
|
|
48
|
+
private handlePointerMove;
|
|
49
|
+
private handlePointerUp;
|
|
50
|
+
/**
|
|
51
|
+
* Compute new rectangle from drag delta, applying handle-specific constraints.
|
|
52
|
+
* Pure function — no side effects.
|
|
53
|
+
*/
|
|
54
|
+
private computeNewRect;
|
|
55
|
+
/**
|
|
56
|
+
* Move a handle by a UV-space delta. For keyboard-driven adjustments.
|
|
57
|
+
* Reads the current rectangle, computes the new position, and fires onRectangleChange.
|
|
58
|
+
*/
|
|
59
|
+
moveHandle(handle: DragHandle, deltaX: number, deltaY: number): void;
|
|
60
|
+
/** Clean up window listeners if component unmounts during drag */
|
|
61
|
+
destroy(): void;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=GarbageMatteDragManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GarbageMatteDragManager.d.ts","sourceRoot":"","sources":["../../src/webcam/GarbageMatteDragManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAE1D,wCAAwC;AACxC,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,MAAM,CAAC;AAUpF,MAAM,WAAW,yBAAyB;IACzC,2DAA2D;IAC3D,iBAAiB,EAAE,CAAC,IAAI,EAAE,qBAAqB,KAAK,IAAI,CAAC;IACzD,0DAA0D;IAC1D,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,wEAAwE;IACxE,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,0HAA0H;IAC1H,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC1B;AAED,MAAM,WAAW,sBAAsB;IACtC,iEAAiE;IACjE,iBAAiB,EAAE,MAAM,WAAW,GAAG,IAAI,CAAC;IAC5C,iDAAiD;IACjD,oBAAoB,EAAE,MAAM,MAAM,CAAC;IACnC,sDAAsD;IACtD,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;CACjD;AAKD,qBAAa,uBAAuB;IAMlC,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,MAAM;IANf,OAAO,CAAC,SAAS,CAA0B;IAC3C,OAAO,CAAC,SAAS,CAA4B;IAC7C,OAAO,CAAC,OAAO,CAA4B;gBAGlC,SAAS,EAAE,yBAAyB,EACpC,MAAM,EAAE,sBAAsB;IAMvC,8CAA8C;IAC9C,IAAI,UAAU,IAAI,OAAO,CAExB;IAED;;;OAGG;IACH,SAAS,CAAC,CAAC,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,GAAG,IAAI;IAuBpD,OAAO,CAAC,iBAAiB;IAsBzB,OAAO,CAAC,eAAe;IAevB;;;OAGG;IACH,OAAO,CAAC,cAAc;IAkFtB;;;OAGG;IACH,UAAU,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAMpE,kEAAkE;IAClE,OAAO,IAAI,IAAI;CAQf"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GarbageMatteDragManager — Framework-agnostic garbage matte drag logic.
|
|
3
|
+
*
|
|
4
|
+
* Extracted from editor/player GarbageMatteOverlay.svelte to eliminate
|
|
5
|
+
* code duplication. Both Svelte components become thin wrappers.
|
|
6
|
+
*
|
|
7
|
+
* Handles:
|
|
8
|
+
* - Drag state management (start, move, end)
|
|
9
|
+
* - UV-space coordinate calculation from pointer events
|
|
10
|
+
* - Rectangle corner/edge/move handle clamping
|
|
11
|
+
* - Window-level pointermove/pointerup listeners
|
|
12
|
+
*/
|
|
13
|
+
/** Minimum size constraint (5% of UV space) to prevent zero-size rectangles */
|
|
14
|
+
const MIN_SIZE = 0.05;
|
|
15
|
+
export class GarbageMatteDragManager {
|
|
16
|
+
callbacks;
|
|
17
|
+
config;
|
|
18
|
+
dragState = null;
|
|
19
|
+
boundMove;
|
|
20
|
+
boundUp;
|
|
21
|
+
constructor(callbacks, config) {
|
|
22
|
+
this.callbacks = callbacks;
|
|
23
|
+
this.config = config;
|
|
24
|
+
this.boundMove = (e) => this.handlePointerMove(e);
|
|
25
|
+
this.boundUp = (e) => this.handlePointerUp(e);
|
|
26
|
+
}
|
|
27
|
+
/** Whether a drag is currently in progress */
|
|
28
|
+
get isDragging() {
|
|
29
|
+
return this.dragState?.active ?? false;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Start a drag operation. Call from pointerdown on a handle element.
|
|
33
|
+
* Automatically calls preventDefault/stopPropagation on the event.
|
|
34
|
+
*/
|
|
35
|
+
startDrag(e, handle) {
|
|
36
|
+
e.preventDefault();
|
|
37
|
+
e.stopPropagation();
|
|
38
|
+
this.callbacks.onDragStart?.();
|
|
39
|
+
const rect = this.config.getCurrentRectangle();
|
|
40
|
+
this.dragState = {
|
|
41
|
+
active: true,
|
|
42
|
+
handle,
|
|
43
|
+
startX: e.clientX,
|
|
44
|
+
startY: e.clientY,
|
|
45
|
+
startRect: {
|
|
46
|
+
topLeft: { ...rect.topLeft },
|
|
47
|
+
bottomRight: { ...rect.bottomRight }
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
window.addEventListener('pointermove', this.boundMove);
|
|
51
|
+
window.addEventListener('pointerup', this.boundUp);
|
|
52
|
+
window.addEventListener('pointercancel', this.boundUp);
|
|
53
|
+
}
|
|
54
|
+
handlePointerMove(e) {
|
|
55
|
+
if (!this.dragState?.active)
|
|
56
|
+
return;
|
|
57
|
+
const overlayEl = this.config.getOverlayElement();
|
|
58
|
+
if (!overlayEl)
|
|
59
|
+
return;
|
|
60
|
+
// Get actual rendered dimensions via getBoundingClientRect
|
|
61
|
+
const rect = overlayEl.getBoundingClientRect();
|
|
62
|
+
const actualHeight = rect.height;
|
|
63
|
+
// Use the webcam plane's pixel width for correct UV mapping
|
|
64
|
+
const actualPlaneWidth = actualHeight * this.config.getWebcamAspectRatio();
|
|
65
|
+
// Calculate delta in UV space (0-1) using the plane's actual dimensions
|
|
66
|
+
// UV coordinates are in texture space (not visual/mirrored space)
|
|
67
|
+
// The shader handles visual mirroring separately
|
|
68
|
+
const deltaX = (e.clientX - this.dragState.startX) / actualPlaneWidth;
|
|
69
|
+
const deltaY = (e.clientY - this.dragState.startY) / actualHeight;
|
|
70
|
+
const newRect = this.computeNewRect(this.dragState.handle, this.dragState.startRect, deltaX, deltaY);
|
|
71
|
+
this.callbacks.onRectangleChange(newRect);
|
|
72
|
+
}
|
|
73
|
+
handlePointerUp(e) {
|
|
74
|
+
if (!this.dragState?.active)
|
|
75
|
+
return;
|
|
76
|
+
window.removeEventListener('pointermove', this.boundMove);
|
|
77
|
+
window.removeEventListener('pointerup', this.boundUp);
|
|
78
|
+
window.removeEventListener('pointercancel', this.boundUp);
|
|
79
|
+
if (e.type === 'pointercancel') {
|
|
80
|
+
(this.callbacks.onDragCancel ?? this.callbacks.onDragEnd)?.();
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
this.callbacks.onDragEnd?.();
|
|
84
|
+
}
|
|
85
|
+
this.dragState = null;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Compute new rectangle from drag delta, applying handle-specific constraints.
|
|
89
|
+
* Pure function — no side effects.
|
|
90
|
+
*/
|
|
91
|
+
computeNewRect(handle, startRect, deltaX, deltaY) {
|
|
92
|
+
const newRect = {
|
|
93
|
+
topLeft: { ...startRect.topLeft },
|
|
94
|
+
bottomRight: { ...startRect.bottomRight }
|
|
95
|
+
};
|
|
96
|
+
switch (handle) {
|
|
97
|
+
case 'tl':
|
|
98
|
+
newRect.topLeft = {
|
|
99
|
+
x: Math.max(0, Math.min(newRect.bottomRight.x - MIN_SIZE, startRect.topLeft.x + deltaX)),
|
|
100
|
+
y: Math.max(0, Math.min(newRect.bottomRight.y - MIN_SIZE, startRect.topLeft.y + deltaY))
|
|
101
|
+
};
|
|
102
|
+
break;
|
|
103
|
+
case 'tr':
|
|
104
|
+
newRect.topLeft = {
|
|
105
|
+
...newRect.topLeft,
|
|
106
|
+
y: Math.max(0, Math.min(newRect.bottomRight.y - MIN_SIZE, startRect.topLeft.y + deltaY))
|
|
107
|
+
};
|
|
108
|
+
newRect.bottomRight = {
|
|
109
|
+
...newRect.bottomRight,
|
|
110
|
+
x: Math.max(newRect.topLeft.x + MIN_SIZE, Math.min(1, startRect.bottomRight.x + deltaX))
|
|
111
|
+
};
|
|
112
|
+
break;
|
|
113
|
+
case 'bl':
|
|
114
|
+
newRect.topLeft = {
|
|
115
|
+
...newRect.topLeft,
|
|
116
|
+
x: Math.max(0, Math.min(newRect.bottomRight.x - MIN_SIZE, startRect.topLeft.x + deltaX))
|
|
117
|
+
};
|
|
118
|
+
newRect.bottomRight = {
|
|
119
|
+
...newRect.bottomRight,
|
|
120
|
+
y: Math.max(newRect.topLeft.y + MIN_SIZE, Math.min(1, startRect.bottomRight.y + deltaY))
|
|
121
|
+
};
|
|
122
|
+
break;
|
|
123
|
+
case 'br':
|
|
124
|
+
newRect.bottomRight = {
|
|
125
|
+
x: Math.max(newRect.topLeft.x + MIN_SIZE, Math.min(1, startRect.bottomRight.x + deltaX)),
|
|
126
|
+
y: Math.max(newRect.topLeft.y + MIN_SIZE, Math.min(1, startRect.bottomRight.y + deltaY))
|
|
127
|
+
};
|
|
128
|
+
break;
|
|
129
|
+
case 't':
|
|
130
|
+
newRect.topLeft = {
|
|
131
|
+
...newRect.topLeft,
|
|
132
|
+
y: Math.max(0, Math.min(newRect.bottomRight.y - MIN_SIZE, startRect.topLeft.y + deltaY))
|
|
133
|
+
};
|
|
134
|
+
break;
|
|
135
|
+
case 'r':
|
|
136
|
+
newRect.bottomRight = {
|
|
137
|
+
...newRect.bottomRight,
|
|
138
|
+
x: Math.max(newRect.topLeft.x + MIN_SIZE, Math.min(1, startRect.bottomRight.x + deltaX))
|
|
139
|
+
};
|
|
140
|
+
break;
|
|
141
|
+
case 'b':
|
|
142
|
+
newRect.bottomRight = {
|
|
143
|
+
...newRect.bottomRight,
|
|
144
|
+
y: Math.max(newRect.topLeft.y + MIN_SIZE, Math.min(1, startRect.bottomRight.y + deltaY))
|
|
145
|
+
};
|
|
146
|
+
break;
|
|
147
|
+
case 'l':
|
|
148
|
+
newRect.topLeft = {
|
|
149
|
+
...newRect.topLeft,
|
|
150
|
+
x: Math.max(0, Math.min(newRect.bottomRight.x - MIN_SIZE, startRect.topLeft.x + deltaX))
|
|
151
|
+
};
|
|
152
|
+
break;
|
|
153
|
+
case 'move': {
|
|
154
|
+
const width = startRect.bottomRight.x - startRect.topLeft.x;
|
|
155
|
+
const height = startRect.bottomRight.y - startRect.topLeft.y;
|
|
156
|
+
const newX = Math.max(0, Math.min(1 - width, startRect.topLeft.x + deltaX));
|
|
157
|
+
const newY = Math.max(0, Math.min(1 - height, startRect.topLeft.y + deltaY));
|
|
158
|
+
newRect.topLeft = { x: newX, y: newY };
|
|
159
|
+
newRect.bottomRight = { x: newX + width, y: newY + height };
|
|
160
|
+
break;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return newRect;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Move a handle by a UV-space delta. For keyboard-driven adjustments.
|
|
167
|
+
* Reads the current rectangle, computes the new position, and fires onRectangleChange.
|
|
168
|
+
*/
|
|
169
|
+
moveHandle(handle, deltaX, deltaY) {
|
|
170
|
+
const rect = this.config.getCurrentRectangle();
|
|
171
|
+
const newRect = this.computeNewRect(handle, rect, deltaX, deltaY);
|
|
172
|
+
this.callbacks.onRectangleChange(newRect);
|
|
173
|
+
}
|
|
174
|
+
/** Clean up window listeners if component unmounts during drag */
|
|
175
|
+
destroy() {
|
|
176
|
+
if (this.dragState?.active) {
|
|
177
|
+
window.removeEventListener('pointermove', this.boundMove);
|
|
178
|
+
window.removeEventListener('pointerup', this.boundUp);
|
|
179
|
+
window.removeEventListener('pointercancel', this.boundUp);
|
|
180
|
+
this.dragState = null;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WebcamStreamManager — Framework-agnostic webcam stream management.
|
|
3
|
+
*
|
|
4
|
+
* Extracted from editor/player WebcamCapture.svelte to eliminate code duplication.
|
|
5
|
+
* Both Svelte components become thin wrappers around this class.
|
|
6
|
+
*
|
|
7
|
+
* Handles:
|
|
8
|
+
* - Device enumeration (video + audio, with Windows role-prefix filtering)
|
|
9
|
+
* - getUserMedia with OverconstrainedError fallback
|
|
10
|
+
* - Orientation-aware aspect ratio (always landscape for 3D viewport)
|
|
11
|
+
* - Track death auto-restart (Android Chrome rotation)
|
|
12
|
+
* - devicechange listener for hot-plug
|
|
13
|
+
*/
|
|
14
|
+
export interface WebcamStreamCallbacks {
|
|
15
|
+
onDevicesEnumerated?: (devices: MediaDeviceInfo[]) => void;
|
|
16
|
+
onAudioDevicesEnumerated?: (devices: MediaDeviceInfo[]) => void;
|
|
17
|
+
onStreamStart?: (stream: MediaStream) => void;
|
|
18
|
+
onStreamStop?: () => void;
|
|
19
|
+
onVideoReady?: (video: HTMLVideoElement) => void;
|
|
20
|
+
onDimensionsReady?: (width: number, height: number, aspectRatio: number) => void;
|
|
21
|
+
onError?: (error: string) => void;
|
|
22
|
+
}
|
|
23
|
+
export declare class WebcamStreamManager {
|
|
24
|
+
private callbacks;
|
|
25
|
+
private videoElement;
|
|
26
|
+
private currentStream;
|
|
27
|
+
private isLoading;
|
|
28
|
+
private videoReadyNotified;
|
|
29
|
+
private nativeVideoWidth;
|
|
30
|
+
private nativeVideoHeight;
|
|
31
|
+
private isAutoRestarting;
|
|
32
|
+
private isDestroyed;
|
|
33
|
+
private boundDeviceChange;
|
|
34
|
+
private boundOrientationChange;
|
|
35
|
+
constructor(callbacks?: WebcamStreamCallbacks);
|
|
36
|
+
/** Check if webcam API is available (requires secure context) */
|
|
37
|
+
private isWebcamApiAvailable;
|
|
38
|
+
/** Get current device orientation */
|
|
39
|
+
private getCurrentOrientation;
|
|
40
|
+
/**
|
|
41
|
+
* Calculate effective aspect ratio for the webcam plane.
|
|
42
|
+
* Always returns landscape (>= 1.0) — the 3D viewport maintains
|
|
43
|
+
* the video content's aspect ratio regardless of device orientation.
|
|
44
|
+
*/
|
|
45
|
+
private getEffectiveAspectRatio;
|
|
46
|
+
/** Handle orientation change — recalculate and report new effective aspect ratio */
|
|
47
|
+
private handleOrientationChange;
|
|
48
|
+
/**
|
|
49
|
+
* Wait for video element to be ready for playback.
|
|
50
|
+
* Resolves immediately if already ready, otherwise waits for canplay event.
|
|
51
|
+
*/
|
|
52
|
+
private waitForVideoReady;
|
|
53
|
+
/**
|
|
54
|
+
* Attach a stream to the video element, wait for readiness, and notify callbacks.
|
|
55
|
+
* Shared by the primary path and the OverconstrainedError fallback.
|
|
56
|
+
*/
|
|
57
|
+
private attachStream;
|
|
58
|
+
/**
|
|
59
|
+
* After stream is attached and video is playing, extract dimensions
|
|
60
|
+
* and notify callbacks.
|
|
61
|
+
*/
|
|
62
|
+
private notifyVideoReady;
|
|
63
|
+
/**
|
|
64
|
+
* Enumerate available video and audio devices.
|
|
65
|
+
*
|
|
66
|
+
* Never calls getUserMedia({ audio: true }) — that triggers Windows
|
|
67
|
+
* communication mode. Chrome grants labeled audio devices when camera
|
|
68
|
+
* permission alone is given.
|
|
69
|
+
*/
|
|
70
|
+
enumerateDevices(): Promise<MediaDeviceInfo[]>;
|
|
71
|
+
/**
|
|
72
|
+
* Start the webcam stream.
|
|
73
|
+
* @param deviceId - Specific camera device ID, or undefined for default front camera
|
|
74
|
+
*/
|
|
75
|
+
startStream(deviceId?: string): Promise<void>;
|
|
76
|
+
/** Map DOMException names to user-friendly error messages */
|
|
77
|
+
private getErrorMessage;
|
|
78
|
+
/**
|
|
79
|
+
* Stop the webcam stream.
|
|
80
|
+
* @param silent - If true, don't call onStreamStop callback (used during restart)
|
|
81
|
+
*/
|
|
82
|
+
stopStream(silent?: boolean): void;
|
|
83
|
+
/** Whether a stream is currently active */
|
|
84
|
+
get hasStream(): boolean;
|
|
85
|
+
/** Whether the manager is currently starting a stream */
|
|
86
|
+
get loading(): boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Bind to a video element. Call this once after the element is created.
|
|
89
|
+
* The video element is used as the srcObject target for the stream.
|
|
90
|
+
*/
|
|
91
|
+
setVideoElement(el: HTMLVideoElement): void;
|
|
92
|
+
/**
|
|
93
|
+
* Initialize event listeners. Call on mount.
|
|
94
|
+
* Enumerates devices and starts listening for device/orientation changes.
|
|
95
|
+
*/
|
|
96
|
+
init(): void;
|
|
97
|
+
/**
|
|
98
|
+
* Clean up all resources. Call on unmount.
|
|
99
|
+
* @param persistStream - If true, don't stop the stream (parent will manage it)
|
|
100
|
+
*/
|
|
101
|
+
destroy(persistStream?: boolean): void;
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=WebcamStreamManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebcamStreamManager.d.ts","sourceRoot":"","sources":["../../src/webcam/WebcamStreamManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAkDH,MAAM,WAAW,qBAAqB;IACrC,mBAAmB,CAAC,EAAE,CAAC,OAAO,EAAE,eAAe,EAAE,KAAK,IAAI,CAAC;IAC3D,wBAAwB,CAAC,EAAE,CAAC,OAAO,EAAE,eAAe,EAAE,KAAK,IAAI,CAAC;IAChE,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;IAC9C,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,CAAC;IACjD,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IACjF,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAClC;AAED,qBAAa,mBAAmB;IAcnB,OAAO,CAAC,SAAS;IAb7B,OAAO,CAAC,YAAY,CAAiC;IACrD,OAAO,CAAC,aAAa,CAA4B;IACjD,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,kBAAkB,CAAS;IACnC,OAAO,CAAC,gBAAgB,CAAK;IAC7B,OAAO,CAAC,iBAAiB,CAAK;IAC9B,OAAO,CAAC,gBAAgB,CAAS;IACjC,OAAO,CAAC,WAAW,CAAS;IAG5B,OAAO,CAAC,iBAAiB,CAAa;IACtC,OAAO,CAAC,sBAAsB,CAAa;gBAEvB,SAAS,GAAE,qBAA0B;IAKzD,iEAAiE;IACjE,OAAO,CAAC,oBAAoB;IAI5B,qCAAqC;IACrC,OAAO,CAAC,qBAAqB;IAO7B;;;;OAIG;IACH,OAAO,CAAC,uBAAuB;IAQ/B,oFAAoF;IACpF,OAAO,CAAC,uBAAuB;IAS/B;;;OAGG;IACH,OAAO,CAAC,iBAAiB;IAqBzB;;;OAGG;YACW,YAAY;IA4B1B;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAgBxB;;;;;;OAMG;IACG,gBAAgB,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC;IAqCpD;;;OAGG;IACG,WAAW,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA+DnD,6DAA6D;IAC7D,OAAO,CAAC,eAAe;IAmBvB;;;OAGG;IACH,UAAU,CAAC,MAAM,UAAQ,GAAG,IAAI;IAkBhC,2CAA2C;IAC3C,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED,yDAAyD;IACzD,IAAI,OAAO,IAAI,OAAO,CAErB;IAED;;;OAGG;IACH,eAAe,CAAC,EAAE,EAAE,gBAAgB,GAAG,IAAI;IAI3C;;;OAGG;IACH,IAAI,IAAI,IAAI;IAYZ;;;OAGG;IACH,OAAO,CAAC,aAAa,UAAQ,GAAG,IAAI;CAepC"}
|