window.parent.postMessage(JSON.stringify(data), "*"). iOS uses webkit.messageHandlers.iosListener. Android uses window.webViewCallback. Same type field in all three.
SDK apps should prefer typed callbacks (onCounter, onKeypoints, …). onMessage on the SDK is this classic shape. Full SDK catalog: Events.
Transport
Real-time boot
Live camera is
type: "initialization" with ready: true and message: "running".
Pose and exercise
Outside an exercise (pose-only URL), keypoints stream without extra flags. During an exercise, keypoints need
keypoints=true + a paid plan.
Switch exercise in the same session
Host → PoseTracker, optional. If you never send it, nothing changes: the URL loads, places, counts and is billed exactly as before. While the tracking page is open (/pose_tracker/tracking with exercise= or userExercise=), the host can switch the exercise without reloading:
What happens:
- The camera and pose model keep running. Placement, the countdown (
timer=) and the counter restart for the new exercise, like a first entry in the frame. - PoseTracker replies
{ type: "exercise_changed", exercise, userExercise }(userExerciseisnullfor catalog ids), then the usual flow:posture, thencounterfrom 0. - No new tracking call is billed. The whole page load counts as one call, so squat then plank then lunge in the same open iframe = 1 call.
- Send exactly one of
exerciseoruserExercise. Not available withreference=or in pose-only mode (no exercise in the URL). - Unknown id, both fields, or not allowed in this mode →
{ type: "error", error: "invalid_exercise", message }, and the current exercise keeps running. Sending the id already running is ignored.
Jumps
jump_analysis and air_time_jump:
jump_analysis requires userHeightCm. Missing → error jump_analysis_missing_height.
Upload extras
On upload tracking only:
Upload init messages differ (
loading video, % progress, Analysis completed).
Reference extras
Whenreference= is set, counter may include reference_score: { overallScore, nccScore, dtwScore, timingScore, distScore?, grade }. See Reference movement.
Related
For LLMs: WebView events are JSON with
type. Counter field is current_count. SDK typed callback uses count / formScore. To chain exercises in one billed call, post { type: "set_exercise", exercise } (or userExercise) to the open iframe; changing the iframe URL or closing it starts a new call. https://docs.posetracker.com/webview/messages