KinesteX

Workout Activity Actions

Control a running session by posting { workout_activity_action: "<value>" } to the KinesteX view, after kinestex_launched. Echo replies have the shape { type: "<value>", date }. Errors arrive as error_occurred (Error & Status Events).


ValueExtra keysWorks inWhat it doesReply
startnoneCustom WorkoutStarts the workout built from customWorkoutExercises. Send it after all_resources_loaded (and after workout_committed with showCommitScreen). Ignored elsewhereThe workout's own events (workout_started, ...)
pause_workoutnoneWorkout player, Challenge, Gym LogPauses the exercise (video, timer and tracking). Sent before the exercise screen opens, it applies when it openspause_workout echo, only when the state changes
resume_workoutnoneWorkout player, Challenge, Gym LogResumes a paused exerciseresume_workout echo, only when the state changes
mute_workoutnoneWorkout player, Challenge, Gym Log, CameraMutes all sound (speech, sound effects, music) for this session; not savedmute_workout echo
unmute_workoutnoneWorkout player, Challenge, Gym Log, CameraUnmutes. The workout player also turns coach speech back on; in the Camera component a "Pause Audio" stays in placeunmute_workout echo
mute_speechnoneWorkout player, Challenge, Gym LogMutes spoken feedback only; sound effects still playmute_speech echo
unmute_speechnoneWorkout player, Challenge, Gym LogTurns spoken feedback back onunmute_speech echo
lognoneWorkout player, Challenge, Gym LogAsks for the latest progress nowworkout_progress, or error_occurred (warning, "log: no active workout") when no workout is loaded, e.g. in the Camera component. See Workout Events
load_modelsexercises: string[], optional exerciseFetchTypeCameraFetches and caches more exercise models without reloading; the ids that load can then become currentExercisemodels_loaded (modelIds), error_occurred (critical) for ids that fail, then speech_fetch_complete; error_occurred (warning, "load_models: no exercises provided") for an empty list
get_exercise_setupexercises: string[]CameraDescribes how to set up each exercise (start position, camera view and side) from the models already loaded, with no network request. GuideOne exercise_setup per id (ids still loading are answered when they finish); error_occurred (warning) for ids never sent in exercises or load_models, or for an empty list
pause_cameranoneCameraTurns the camera off; models, settings and progress stay. Sent before the camera opens, it keeps it off. Guidepause_camera echo. Other integrations: error_occurred (warning, "pause_camera: only supported in the camera component")
resume_cameranoneCameraTurns the camera back onresume_camera echo, then camera_selected when the camera opens. Other integrations: error_occurred (warning)
reset_progressnoneCamera (open)Restarts the current exercise from rep 1 (reps, accuracy, mistakes, time)reset_progress with exerciseId; error_occurred (warning) when no exercise is set or the camera is not open
reset_all_progressnoneCamera (open)Clears every exercise tracked this session and restarts the current onereset_all_progress; error_occurred (warning) when the camera is not open
reset_check_framenoneCamera (open)Shows the positioning check again (also with showSilhouette: false); the rep in progress restartsreset_check_frame, then person_in_frame when the user is in position; error_occurred (warning) when the camera is not open

Scope note: the Camera component does not use pause_workout, resume_workout, mute_speech or unmute_speech: use pause_camera / resume_camera and the currentExercise commands below. Games and assessments react to none of these actions. For camera sound and camera-off control, see Camera Component: camera and audio.


Other messages you can send:


MessageWorks inWhat it doesReply
{ currentExercise: "<id>" }CameraSwitches tracking to that exercise, which must be in exercises or loaded with load_models. Sending the active value again does nothingexercise_change (summary of the previous exercise) and exercise_setup; error_occurred (critical, "currentExercise is not included in exercises list") for an unknown id
{ currentExercise: "Pause Exercise" }CameraStops tracking; the camera stays onnone
{ currentExercise: "Stop Camera" }CameraStops the camera and pose tracking. Send an exercise id to start againstop_camera
{ currentExercise: "Pause Audio" } / "Resume Audio"CameraTurns coach cues and rest speech off or on (the rep sound still plays)none
{ currentExercise: "Workout Overview" }CameraSends the session summary so far. Reps on the current exercise keep counting (successful_repeat / action kind rep); presence, hold, form-state and idle events stop until you send an exercise idexercise_overview, workout_overview
{ currentRestSpeech: "<phrase>" }Camera (with restSpeeches)Plays that downloaded rest speech; "Stop audio" stops the current sound. The same phrase twice in a row plays oncenone
{ type: "update_trainer_profile", ... }AI TrainerUpdates the trainer profile from your own UI. Fields: age, weight, height (JSON numbers), gender (male, female, other), date_of_birth, fitness_goals, injuries, health_conditions, fitness_level_pushups, fitness_level_squats, fitness_level_cardio, other_preferences (values as in AI Trainer parameters). Partial updates merge; held until the trainer screen is opentrainer_profile_updated (source: "host") after a save; error_occurred (critical) if the save fails; nothing when nothing changed
{ subscription_result: "purchased" } or "dismissed"AI TrainerYour answer to open_subscription_flow. purchased unlocks the user and resumes the generation that was waiting; dismissed drops itThe trainer continues

How each SDK sends these:


SDKCommandsCamera exercise switchMulti-key messages (load_models, get_exercise_setup, update_trainer_profile)
SwiftwebViewState.sendMessage([...]), with a WebViewState passed as webViewState: to the create call. Custom workouts can also set the workoutAction bindingThe currentExercise binding of createCameraView (and its currentRestSpeech binding)Yes
KotlinKinesteXSDK.sendMessage(mapOf(...))KinesteXSDK.updateCurrentExercise(id)Yes
FlutterKinesteXAIFramework.sendAction(action, value)sendAction("currentExercise", id)No: sendAction sends a single key
React Nativeref.current?.sendAction(action, value, extras?)ref.current?.changeExercise(id) or sendAction("currentExercise", id)Yes, through extras
Reactref.current?.sendAction(action, value)ref.current?.changeExercise(id)No: sendAction sends a single key
HTML/JSiframe.contentWindow.postMessage({...}, "https://ai.kinestex.com")postMessage({ currentExercise: id }, ...)Yes
Workout Activity Actions
Swift example:
1// Pass a WebViewState to the create call, then post commands through it:
2// @StateObject private var webViewState = WebViewState()
3// kinestex.createWorkoutView(..., onMessageReceived: { ... }, webViewState: webViewState)
4
5// Workout player
6webViewState.sendMessage(["workout_activity_action": "pause_workout"])
7webViewState.sendMessage(["workout_activity_action": "resume_workout"])
8webViewState.sendMessage(["workout_activity_action": "mute_speech"])
9webViewState.sendMessage(["workout_activity_action": "log"]) // replies with workout_progress
10
11// Camera component
12webViewState.sendMessage(["workout_activity_action": "load_models", "exercises": ["model-id-3"]])
13webViewState.sendMessage(["workout_activity_action": "get_exercise_setup", "exercises": ["model-id-3"]])
14webViewState.sendMessage(["workout_activity_action": "pause_camera"])
15webViewState.sendMessage(["workout_activity_action": "reset_progress"])
16currentExercise = "model-id-3" // the createCameraView binding posts { currentExercise }
17
18// AI Trainer
19webViewState.sendMessage(["type": "update_trainer_profile", "age": 32, "weight": 70])
20webViewState.sendMessage(["subscription_result": "purchased"])