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).
| Value | Extra keys | Works in | What it does | Reply |
| start | none | Custom Workout | Starts the workout built from customWorkoutExercises. Send it after all_resources_loaded (and after workout_committed with showCommitScreen). Ignored elsewhere | The workout's own events (workout_started, ...) |
| pause_workout | none | Workout player, Challenge, Gym Log | Pauses the exercise (video, timer and tracking). Sent before the exercise screen opens, it applies when it opens | pause_workout echo, only when the state changes |
| resume_workout | none | Workout player, Challenge, Gym Log | Resumes a paused exercise | resume_workout echo, only when the state changes |
| mute_workout | none | Workout player, Challenge, Gym Log, Camera | Mutes all sound (speech, sound effects, music) for this session; not saved | mute_workout echo |
| unmute_workout | none | Workout player, Challenge, Gym Log, Camera | Unmutes. The workout player also turns coach speech back on; in the Camera component a "Pause Audio" stays in place | unmute_workout echo |
| mute_speech | none | Workout player, Challenge, Gym Log | Mutes spoken feedback only; sound effects still play | mute_speech echo |
| unmute_speech | none | Workout player, Challenge, Gym Log | Turns spoken feedback back on | unmute_speech echo |
| log | none | Workout player, Challenge, Gym Log | Asks for the latest progress now | workout_progress, or error_occurred (warning, "log: no active workout") when no workout is loaded, e.g. in the Camera component. See Workout Events |
| load_models | exercises: string[], optional exerciseFetchType | Camera | Fetches and caches more exercise models without reloading; the ids that load can then become currentExercise | models_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_setup | exercises: string[] | Camera | Describes how to set up each exercise (start position, camera view and side) from the models already loaded, with no network request. Guide | One 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_camera | none | Camera | Turns the camera off; models, settings and progress stay. Sent before the camera opens, it keeps it off. Guide | pause_camera echo. Other integrations: error_occurred (warning, "pause_camera: only supported in the camera component") |
| resume_camera | none | Camera | Turns the camera back on | resume_camera echo, then camera_selected when the camera opens. Other integrations: error_occurred (warning) |
| reset_progress | none | Camera (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_progress | none | Camera (open) | Clears every exercise tracked this session and restarts the current one | reset_all_progress; error_occurred (warning) when the camera is not open |
| reset_check_frame | none | Camera (open) | Shows the positioning check again (also with showSilhouette: false); the rep in progress restarts | reset_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:
| Message | Works in | What it does | Reply |
{ currentExercise: "<id>" } | Camera | Switches tracking to that exercise, which must be in exercises or loaded with load_models. Sending the active value again does nothing | exercise_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" } | Camera | Stops tracking; the camera stays on | none |
{ currentExercise: "Stop Camera" } | Camera | Stops the camera and pose tracking. Send an exercise id to start again | stop_camera |
{ currentExercise: "Pause Audio" } / "Resume Audio" | Camera | Turns coach cues and rest speech off or on (the rep sound still plays) | none |
{ currentExercise: "Workout Overview" } | Camera | Sends 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 id | exercise_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 once | none |
{ type: "update_trainer_profile", ... } | AI Trainer | Updates 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 open | trainer_profile_updated (source: "host") after a save; error_occurred (critical) if the save fails; nothing when nothing changed |
{ subscription_result: "purchased" } or "dismissed" | AI Trainer | Your answer to open_subscription_flow. purchased unlocks the user and resumes the generation that was waiting; dismissed drops it | The trainer continues |
How each SDK sends these:
| SDK | Commands | Camera exercise switch | Multi-key messages (load_models, get_exercise_setup, update_trainer_profile) |
| Swift | webViewState.sendMessage([...]), with a WebViewState passed as webViewState: to the create call. Custom workouts can also set the workoutAction binding | The currentExercise binding of createCameraView (and its currentRestSpeech binding) | Yes |
| Kotlin | KinesteXSDK.sendMessage(mapOf(...)) | KinesteXSDK.updateCurrentExercise(id) | Yes |
| Flutter | KinesteXAIFramework.sendAction(action, value) | sendAction("currentExercise", id) | No: sendAction sends a single key |
| React Native | ref.current?.sendAction(action, value, extras?) | ref.current?.changeExercise(id) or sendAction("currentExercise", id) | Yes, through extras |
| React | ref.current?.sendAction(action, value) | ref.current?.changeExercise(id) | No: sendAction sends a single key |
| HTML/JS | iframe.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"])