Camera Component Parameters
Parameters that are only read by the Camera component (createCameraComponent, Swift createCameraView, IntegrationOption.CAMERA, route /camera). Other integration options ignore them. For the full guide, see Camera Component.
| Parameter | Type | Default | What it does internally |
| exercises | string[] | required | The exercise models to download at launch, in the form set by exerciseFetchType. Only these (plus any added later with load_models) can become currentExercise. Replies: models_loaded (modelIds), and error_occurred (critical, "Failed to fetch N model(s): ...") for ids that fail. In the URL: a JSON array |
| currentExercise | string | none | The exercise to track, from exercises. Change it at runtime to switch tracking; it also takes the commands "Pause Exercise", "Stop Camera", "Pause Audio", "Resume Audio" and "Workout Overview". See Workout Activity Actions |
| exerciseFetchType | string | "model_id" | How each value in exercises (and in load_models) is looked up: "model_id", "exercise_id" or "exercise_title". An invalid value falls back to the backend default |
| restSpeeches | string[] | none | Rest-speech phrases (each exercise's rest_speech from the Content API) to download at launch, so currentRestSpeech can play them at once. In the URL: a JSON array |
| currentRestSpeech | string | none | Plays one of the restSpeeches (only when restSpeeches was sent at launch). Send "Stop audio" to stop the current sound. Change it at runtime like currentExercise; sending the same phrase twice in a row plays it once |
| pauseCamera | boolean | false | Opens with the camera off, as if pause_camera had been sent: models still load and model_warmedup still fires. Send resume_camera to turn the camera on. No echo for the launch value. Accepts true or "true" |
| muteWorkout | boolean | false | Starts the session muted, as if mute_workout had been sent (for this session only, not saved). Send unmute_workout to unmute. No echo for the launch value. Accepts true or "true" |
Runtime control (all through workout_activity_action, see Workout Activity Actions):
load_modelsfetches and caches more models without reloading; the ids that load can then becomecurrentExercise(guide).get_exercise_setupanswers with oneexercise_setupper exercise: start position, camera view and side (guide).pause_camera/resume_cameraandmute_workout/unmute_workoutturn the camera and the sound off and on (guide).reset_progress,reset_all_progressandreset_check_framerestart the current exercise, the whole session or the positioning check without reloading.
Real-time events: the Camera component sends reps, form state, presence, framing and gesture events as they happen. Their launch options are in Real-Time Motion Events.
Related parameters that also work here: videoURL (Testing & Simulation); landmarkColor, showSilhouette, videoFit, isDrawingPose, includePoseBorders, showFormGuidance, streamFormGuidance, cameraLabel, shouldShowCameraSelector (Camera & Pose Detection); hideConnectTvButton, checkFrameText (UI Controls).
1@State private var currentExercise = "model-id-1"
2@State private var currentRestSpeech: String? = nil
3
4kinestex.createCameraView(
5 exercises: ["model-id-1", "model-id-2"],
6 currentExercise: $currentExercise, // change it to switch exercises
7 currentRestSpeech: $currentRestSpeech, // set it to play a rest speech
8 user: nil,
9 style: nil,
10 isLoading: $isLoading,
11 customParams: [
12 "exerciseFetchType": "model_id",
13 "restSpeeches": ["Get ready for squats"],
14 "pauseCamera": true, // camera off until resume_camera
15 "muteWorkout": true // muted until unmute_workout
16 ],
17 onMessageReceived: { message in /* ... */ }
18)