@touchcastllc/napster-companion-api-dev 2.1.0-alpha.4 → 2.1.0-alpha.5
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/lib/index.d.ts +0 -7
- package/lib/index.esm.js +1 -1
- package/lib/index.js +1 -1
- package/lib/index.standalone.js +1 -1
- package/lib/stores/index.d.ts +1 -1
- package/lib/stores/selectors.d.ts +0 -1
- package/lib/stores/slices/avatarSlice.d.ts +1 -2
- package/lib/types/errors.d.ts +1 -18
- package/lib/types/index.d.ts +0 -77
- package/package.json +2 -12
- package/lib/services/faceTracking.d.ts +0 -13
- package/lib/utils/mouthDetection.d.ts +0 -24
package/lib/stores/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { store } from "./store";
|
|
|
2
2
|
export type { RootState } from "./store";
|
|
3
3
|
export { setOnFeaturesUpdateCallback } from "./middleware/featuresUpdateMiddleware";
|
|
4
4
|
export * from "./selectors";
|
|
5
|
-
export { setSessionId, setTransport, setStopInteraction, setMuted, setMicUnavailable, setMicRecoveryOpen, setMicSourceMuted,
|
|
5
|
+
export { setSessionId, setTransport, setStopInteraction, setMuted, setMicUnavailable, setMicRecoveryOpen, setMicSourceMuted, setVolume, setAvatarSpeaking, setScreenSharing, setUserTalking, setConnectionToken, setCloseConnectionHandler, setSessionTerminatedByServer, resetAvatar, } from "./slices/avatarSlice";
|
|
6
6
|
export { setSessionStatus, resetSession } from "./slices/sessionSlice";
|
|
7
7
|
export type { SessionStatus } from "./slices/sessionSlice";
|
|
8
8
|
export { setFeatures, resetFeatures, setDebugMode } from "./slices/appSlice";
|
|
@@ -11,7 +11,6 @@ export declare const selectMuted: (state: RootState) => boolean;
|
|
|
11
11
|
export declare const selectMicUnavailable: (state: RootState) => boolean;
|
|
12
12
|
export declare const selectMicRecoveryOpen: (state: RootState) => boolean;
|
|
13
13
|
export declare const selectMicSourceMuted: (state: RootState) => boolean;
|
|
14
|
-
export declare const selectAutoMicActive: (state: RootState) => boolean;
|
|
15
14
|
export declare const selectAvatarSpeaking: (state: RootState) => boolean;
|
|
16
15
|
export declare const selectUserTalking: (state: RootState) => boolean;
|
|
17
16
|
export declare const selectConnectionToken: (state: RootState) => string | undefined;
|
|
@@ -7,7 +7,6 @@ export interface AvatarState {
|
|
|
7
7
|
micUnavailable: boolean;
|
|
8
8
|
micRecoveryOpen: boolean;
|
|
9
9
|
micSourceMuted: boolean;
|
|
10
|
-
autoMicActive: boolean;
|
|
11
10
|
volume: number;
|
|
12
11
|
avatarSpeaking: boolean;
|
|
13
12
|
isScreenSharing: boolean;
|
|
@@ -16,5 +15,5 @@ export interface AvatarState {
|
|
|
16
15
|
closeConnectionHandler?: () => void;
|
|
17
16
|
sessionTerminatedByServer: boolean;
|
|
18
17
|
}
|
|
19
|
-
export declare const setSessionId: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<string | undefined, "avatar/setSessionId">, setTransport: import("@reduxjs/toolkit").ActionCreatorWithPayload<Transport | null, "avatar/setTransport">, setStopInteraction: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "avatar/setStopInteraction">, setMuted: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "avatar/setMuted">, setMicUnavailable: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "avatar/setMicUnavailable">, setMicRecoveryOpen: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "avatar/setMicRecoveryOpen">, setMicSourceMuted: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "avatar/setMicSourceMuted">,
|
|
18
|
+
export declare const setSessionId: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<string | undefined, "avatar/setSessionId">, setTransport: import("@reduxjs/toolkit").ActionCreatorWithPayload<Transport | null, "avatar/setTransport">, setStopInteraction: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "avatar/setStopInteraction">, setMuted: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "avatar/setMuted">, setMicUnavailable: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "avatar/setMicUnavailable">, setMicRecoveryOpen: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "avatar/setMicRecoveryOpen">, setMicSourceMuted: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "avatar/setMicSourceMuted">, setVolume: import("@reduxjs/toolkit").ActionCreatorWithPayload<number, "avatar/setVolume">, setAvatarSpeaking: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "avatar/setAvatarSpeaking">, setScreenSharing: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "avatar/setScreenSharing">, setUserTalking: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "avatar/setUserTalking">, setConnectionToken: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<string | undefined, "avatar/setConnectionToken">, setCloseConnectionHandler: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<(() => void) | undefined, "avatar/setCloseConnectionHandler">, setSessionTerminatedByServer: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "avatar/setSessionTerminatedByServer">, resetAvatar: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"avatar/resetAvatar">;
|
|
20
19
|
export declare const avatarReducer: import("redux").Reducer<AvatarState>;
|
package/lib/types/errors.d.ts
CHANGED
|
@@ -42,24 +42,12 @@ export declare class ConnectionError extends SDKError {
|
|
|
42
42
|
export declare class WebRTCError extends SDKError {
|
|
43
43
|
constructor(message: string, context?: Record<string, unknown>);
|
|
44
44
|
}
|
|
45
|
-
/**
|
|
46
|
-
* Feature related errors
|
|
47
|
-
*/
|
|
48
|
-
export declare class FeatureError extends SDKError {
|
|
49
|
-
constructor(message: string, context?: Record<string, unknown>);
|
|
50
|
-
}
|
|
51
45
|
/**
|
|
52
46
|
* Media related errors (video, audio)
|
|
53
47
|
*/
|
|
54
48
|
export declare class MediaError extends SDKError {
|
|
55
49
|
constructor(message: string, context?: Record<string, unknown>);
|
|
56
50
|
}
|
|
57
|
-
/**
|
|
58
|
-
* Face tracking related errors
|
|
59
|
-
*/
|
|
60
|
-
export declare class FaceTrackingError extends SDKError {
|
|
61
|
-
constructor(message: string, code: string, context?: Record<string, unknown>);
|
|
62
|
-
}
|
|
63
51
|
/**
|
|
64
52
|
* Error codes enum for consistent error identification
|
|
65
53
|
*/
|
|
@@ -80,14 +68,9 @@ export declare enum ErrorCodes {
|
|
|
80
68
|
INVALID_CONFIGURATION = "INVALID_CONFIGURATION",
|
|
81
69
|
MISSING_REQUIRED_CONFIG = "MISSING_REQUIRED_CONFIG",
|
|
82
70
|
FEATURE_NOT_SUPPORTED = "FEATURE_NOT_SUPPORTED",
|
|
83
|
-
FEATURE_DISABLED = "FEATURE_DISABLED",
|
|
84
71
|
MEDIA_ACCESS_DENIED = "MEDIA_ACCESS_DENIED",
|
|
85
72
|
MEDIA_DEVICE_ERROR = "MEDIA_DEVICE_ERROR",
|
|
86
|
-
VIDEO_LOAD_ERROR = "VIDEO_LOAD_ERROR"
|
|
87
|
-
CAMERA_PERMISSION_DENIED = "CAMERA_PERMISSION_DENIED",
|
|
88
|
-
CAMERA_NOT_FOUND = "CAMERA_NOT_FOUND",
|
|
89
|
-
MODEL_LOAD_FAILED = "MODEL_LOAD_FAILED",
|
|
90
|
-
DETECTION_FAILED = "DETECTION_FAILED"
|
|
73
|
+
VIDEO_LOAD_ERROR = "VIDEO_LOAD_ERROR"
|
|
91
74
|
}
|
|
92
75
|
/**
|
|
93
76
|
* Type guard to check if an error is an SDK error
|
package/lib/types/index.d.ts
CHANGED
|
@@ -232,83 +232,6 @@ export interface FeatureConfig {
|
|
|
232
232
|
enabled: boolean;
|
|
233
233
|
};
|
|
234
234
|
}
|
|
235
|
-
/**
|
|
236
|
-
* Face tracking is not part of the public API (CA-1149): nothing here is
|
|
237
|
-
* exported from the package, `FeatureConfig` has no `faceTracking` key and
|
|
238
|
-
* the instance has no start/stop methods. The service stays in the source
|
|
239
|
-
* tree, reachable only from the SDK's own private methods.
|
|
240
|
-
*/
|
|
241
|
-
export interface FaceTrackingFeatureConfig {
|
|
242
|
-
enabled: boolean;
|
|
243
|
-
/** Detection rate in FPS. Default 15, max 30. */
|
|
244
|
-
fps?: number;
|
|
245
|
-
/** Mouth opening ratio threshold. Default 0.015. */
|
|
246
|
-
talkingThreshold?: number;
|
|
247
|
-
}
|
|
248
|
-
/**
|
|
249
|
-
* Configuration for the face tracking service.
|
|
250
|
-
*/
|
|
251
|
-
export interface FaceTrackingConfig {
|
|
252
|
-
/** Detection rate in frames per second. Default 15, max 30. */
|
|
253
|
-
fps?: number;
|
|
254
|
-
/** Mouth opening ratio threshold to determine talking state. Default 0.015. */
|
|
255
|
-
talkingThreshold?: number;
|
|
256
|
-
/** Number of frames for rolling average smoothing. Default 5. */
|
|
257
|
-
smoothingFrames?: number;
|
|
258
|
-
/** Camera video width. Default 640. */
|
|
259
|
-
videoWidth?: number;
|
|
260
|
-
/** Camera video height. Default 480. */
|
|
261
|
-
videoHeight?: number;
|
|
262
|
-
}
|
|
263
|
-
/**
|
|
264
|
-
* Normalized mouth landmark positions (0–1 range).
|
|
265
|
-
*/
|
|
266
|
-
export interface MouthLandmarks {
|
|
267
|
-
topLip: {
|
|
268
|
-
x: number;
|
|
269
|
-
y: number;
|
|
270
|
-
};
|
|
271
|
-
bottomLip: {
|
|
272
|
-
x: number;
|
|
273
|
-
y: number;
|
|
274
|
-
};
|
|
275
|
-
leftCorner: {
|
|
276
|
-
x: number;
|
|
277
|
-
y: number;
|
|
278
|
-
};
|
|
279
|
-
rightCorner: {
|
|
280
|
-
x: number;
|
|
281
|
-
y: number;
|
|
282
|
-
};
|
|
283
|
-
}
|
|
284
|
-
/**
|
|
285
|
-
* Face tracking data emitted on each detection frame.
|
|
286
|
-
*/
|
|
287
|
-
export interface FaceTrackingData {
|
|
288
|
-
/** 468 normalized face landmarks (x, y, z in 0–1 range). */
|
|
289
|
-
landmarks: Array<{
|
|
290
|
-
x: number;
|
|
291
|
-
y: number;
|
|
292
|
-
z: number;
|
|
293
|
-
}>;
|
|
294
|
-
/** Normalized mouth landmark positions, or null if not detected. */
|
|
295
|
-
mouthLandmarks: MouthLandmarks | null;
|
|
296
|
-
/** Whether the user is currently talking based on smoothed mouth-opening ratio. */
|
|
297
|
-
isTalking: boolean;
|
|
298
|
-
}
|
|
299
|
-
/**
|
|
300
|
-
* Controller returned by createFaceTrackingService for managing the detection lifecycle.
|
|
301
|
-
*/
|
|
302
|
-
export interface FaceTrackingController {
|
|
303
|
-
/** Initialize camera + model and start the detection loop. */
|
|
304
|
-
start(): Promise<void>;
|
|
305
|
-
/** Pause detection and stop camera, but keep the model loaded for fast restart. */
|
|
306
|
-
stop(): void;
|
|
307
|
-
/** Whether the detection loop is currently running. */
|
|
308
|
-
isActive(): boolean;
|
|
309
|
-
/** Full teardown: stop + dispose model + null all refs. */
|
|
310
|
-
destroy(): void;
|
|
311
|
-
}
|
|
312
235
|
export interface StyleConfig {
|
|
313
236
|
/** Avatar visual style: "round" | "rectangle" | "silhouette" (Default: "round").
|
|
314
237
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@touchcastllc/napster-companion-api-dev",
|
|
3
|
-
"version": "2.1.0-alpha.
|
|
3
|
+
"version": "2.1.0-alpha.5",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"napster",
|
|
6
6
|
"companion-api",
|
|
@@ -38,17 +38,7 @@
|
|
|
38
38
|
"!lib/**/*.spec.*"
|
|
39
39
|
],
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"@reduxjs/toolkit": "^2.0.0"
|
|
42
|
-
"@tensorflow-models/face-landmarks-detection": "^1.0.0",
|
|
43
|
-
"@tensorflow/tfjs": "^4.0.0"
|
|
44
|
-
},
|
|
45
|
-
"peerDependenciesMeta": {
|
|
46
|
-
"@tensorflow/tfjs": {
|
|
47
|
-
"optional": true
|
|
48
|
-
},
|
|
49
|
-
"@tensorflow-models/face-landmarks-detection": {
|
|
50
|
-
"optional": true
|
|
51
|
-
}
|
|
41
|
+
"@reduxjs/toolkit": "^2.0.0"
|
|
52
42
|
},
|
|
53
43
|
"publishConfig": {
|
|
54
44
|
"access": "public"
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { FaceTrackingConfig, FaceTrackingData, FaceTrackingController } from "../types";
|
|
2
|
-
interface FaceTrackingCallbacks {
|
|
3
|
-
onData?: (data: FaceTrackingData | null) => void;
|
|
4
|
-
onError?: (error: Error) => void;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Creates a vanilla-JS face tracking service using TensorFlow.js + MediaPipe Face Mesh.
|
|
8
|
-
*
|
|
9
|
-
* Lazy-loads @tensorflow/tfjs and @tensorflow-models/face-landmarks-detection
|
|
10
|
-
* only when start() is called, keeping the main bundle small (~2MB deferred).
|
|
11
|
-
*/
|
|
12
|
-
export declare function createFaceTrackingService(config?: FaceTrackingConfig, callbacks?: FaceTrackingCallbacks): FaceTrackingController;
|
|
13
|
-
export {};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { MouthLandmarks } from "../types";
|
|
2
|
-
/**
|
|
3
|
-
* Creates a rolling average smoother for mouth-opening ratios.
|
|
4
|
-
*/
|
|
5
|
-
export declare function createMouthOpeningSmoothing(windowSize?: number): {
|
|
6
|
-
push(value: number): number;
|
|
7
|
-
reset(): void;
|
|
8
|
-
};
|
|
9
|
-
/**
|
|
10
|
-
* Calculates mouth opening ratio and normalized mouth landmarks from raw keypoints.
|
|
11
|
-
*
|
|
12
|
-
* @param keypoints - Raw face mesh keypoints (pixel coordinates)
|
|
13
|
-
* @param videoWidth - Video width for normalization
|
|
14
|
-
* @param videoHeight - Video height for normalization
|
|
15
|
-
* @returns Mouth landmarks (normalized 0–1) and raw opening ratio, or null if landmarks are missing
|
|
16
|
-
*/
|
|
17
|
-
export declare function calculateMouthOpening(keypoints: Array<{
|
|
18
|
-
x: number;
|
|
19
|
-
y: number;
|
|
20
|
-
z?: number;
|
|
21
|
-
}>, videoWidth: number, videoHeight: number): {
|
|
22
|
-
mouthLandmarks: MouthLandmarks;
|
|
23
|
-
openingRatio: number;
|
|
24
|
-
} | null;
|