@pose-tracker/react-native-pose-estimation-light 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,9 +5,9 @@
5
5
  * MoveNet SinglePose Lightning hosted at app.posetracker.com (same URL as
6
6
  * `usePoseDetection` / tracking WebView `modelUrl`).
7
7
  *
8
- * BlazePose is accepted as a `model` alias for API parity but is not wired
9
- * in the RN WebView yet (needs MediaPipe). Pass a TF.js `modelUrl` for any
10
- * custom graph model.
8
+ * BlazePose loads via CDN `@tensorflow-models/pose-detection` inside the
9
+ * WebView (no graph `modelUrl`). Pass a TF.js `modelUrl` for any custom
10
+ * graph model.
11
11
  */
12
12
 
13
13
  /** Production MoveNet SinglePose Lightning topology (Front default). */
@@ -32,17 +32,20 @@ export interface ResolvePoseModelOptions {
32
32
  modelUrl?: string;
33
33
  }
34
34
 
35
+ export type PoseModelKind = 'movenet-graph' | 'blazepose' | 'custom-graph' | 'unsupported';
36
+
35
37
  export interface ResolvedPoseModel {
36
38
  /** Stable id reported in diagnostics / track params. */
37
39
  modelId: string;
38
- /** TF.js `loadGraphModel` URL, or null when unsupported without override. */
40
+ kind: PoseModelKind;
41
+ /** TF.js `loadGraphModel` URL when kind is movenet-graph or custom-graph. */
39
42
  modelUrl: string | null;
40
- /** Human-readable reason when {@link modelUrl} is null. */
43
+ /** Human-readable reason when kind is unsupported. */
41
44
  unsupportedReason?: string;
42
45
  }
43
46
 
44
47
  /**
45
- * Resolve which TF.js graph model the light WebView should fetch.
48
+ * Resolve which online pose model the light WebView should run.
46
49
  * Default: MoveNet SinglePose Lightning (product URL).
47
50
  */
48
51
  export function resolvePoseModel(options: ResolvePoseModelOptions = {}): ResolvedPoseModel {
@@ -55,30 +58,30 @@ export function resolvePoseModel(options: ResolvePoseModelOptions = {}): Resolve
55
58
  typeof options.model === 'string' && options.model.trim().length > 0
56
59
  ? options.model.trim()
57
60
  : 'custom';
58
- return { modelId: alias, modelUrl: explicit };
61
+ return { modelId: alias, kind: 'custom-graph', modelUrl: explicit };
59
62
  }
60
63
 
61
64
  const key = (options.model ?? 'movenet').trim().toLowerCase();
62
65
  if (key === 'movenet' || key === 'movenet-singlepose-lightning' || key === 'lightning') {
63
66
  return {
64
67
  modelId: 'movenet-singlepose-lightning',
68
+ kind: 'movenet-graph',
65
69
  modelUrl: DEFAULT_MOVENET_LIGHTNING_URL,
66
70
  };
67
71
  }
68
72
  if (key === 'blazepose') {
69
73
  return {
70
74
  modelId: 'blazepose',
75
+ kind: 'blazepose',
71
76
  modelUrl: null,
72
- unsupportedReason:
73
- 'BlazePose is not wired in the light RN WebView yet (needs MediaPipe). ' +
74
- 'Use model="movenet" or pass a TF.js graph modelUrl.',
75
77
  };
76
78
  }
77
79
  return {
78
80
  modelId: key,
81
+ kind: 'unsupported',
79
82
  modelUrl: null,
80
83
  unsupportedReason:
81
- `Unknown model "${options.model}". Use "movenet" (default) or pass modelUrl.`,
84
+ `Unknown model "${options.model}". Use "movenet" (default), "blazepose", or pass modelUrl.`,
82
85
  };
83
86
  }
84
87
 
package/src/sdkVersion.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  /** AUTO-GENERATED by scripts/sync-sdk-version.mjs — do not edit. */
2
- export const SDK_VERSION = '0.1.0';
2
+ export const SDK_VERSION = '0.2.0';
@@ -38,6 +38,7 @@ export type InitializationStep =
38
38
  | 'downloading'
39
39
  | 'warming'
40
40
  | 'accessing_webcam'
41
+ | 'loading_media'
41
42
  | 'loading_pose_model'
42
43
  | 'ready';
43
44
 
@@ -11,8 +11,8 @@
11
11
  * - `keypoints` DURING an exercise session requires a paid plan too
12
12
  * (free may stream keypoints only in pose-only mode, i.e. no exercise).
13
13
  * - `blazepose` / `poseEngine` / `mediapipeModel` / `poseBackend` /
14
- * `runInWorker` are NOT part of this SDK (MoveNet Lightning only) and are
15
- * rejected with a clear error.
14
+ * `runInWorker` are NOT feature flags here — select BlazePose with
15
+ * `options.model = 'blazepose'` instead of `{ features: { blazepose: true } }`.
16
16
  */
17
17
 
18
18
  import type { MinGrade } from './events';
@@ -75,12 +75,12 @@ const KNOWN_FEATURE_KEYS = new Set<string>([
75
75
  ]);
76
76
 
77
77
  /**
78
- * WebView params that this SDK deliberately does NOT ship (one SDK, one
79
- * model: MoveNet Lightning). Passing them (possible from untyped JS hosts)
80
- * produces a clear `feature_not_supported` error.
78
+ * WebView params that are NOT feature flags in this SDK.
79
+ * Note: `options.model = 'blazepose'` is supported on light; passing
80
+ * `{ blazepose: true }` inside `features` is rejected (WebView query parity).
81
81
  */
82
82
  const UNSUPPORTED_FEATURE_HINTS: Record<string, string> = {
83
- blazepose: 'BlazePose',
83
+ blazepose: 'BlazePose as a features flag (use options.model = "blazepose" instead)',
84
84
  poseEngine: 'pose engine selection (MediaPipe/PoseLandmarker)',
85
85
  mediapipeModel: 'MediaPipe model selection',
86
86
  poseBackend: 'pose backend selection',
@@ -108,9 +108,8 @@ export const COMBINED_REFERENCE_EXERCISE_MESSAGE =
108
108
  export function featureNotSupportedMessage(key: string): string {
109
109
  const hint = UNSUPPORTED_FEATURE_HINTS[key] ?? `'${key}'`;
110
110
  return (
111
- `The '${key}' option (${hint}) is not available in this SDK. ` +
112
- 'This SDK ships MoveNet Lightning only — pose engine and model cannot be changed. ' +
113
- 'Remove the option, or use the PoseTracker WebView product if you need it. ' +
111
+ `The '${key}' option (${hint}) is not available as a features flag. ` +
112
+ 'Remove the option, or use options.model / modelUrl for model selection. ' +
114
113
  '(visit: https://posetracker.gitbook.io/posetracker-api/tracking-endpoint)'
115
114
  );
116
115
  }