# Workout Activity Actions

Control workout state programmatically at runtime via postMessage using the `workout_activity_action` property.

| Action | Applies to | What it does internally |
|--------|------------|-------------------------|
| pause_workout | Workout player | Pauses the workout (video, timer, and tracking) and echoes a `pause_workout` confirmation message back |
| resume_workout | Workout player | Resumes a paused workout (echoes `resume_workout`) |
| mute_workout | Workout player | Mutes ALL audio — speech, sounds, and background music (echoes `mute_workout`) |
| unmute_workout | Workout player | Unmutes all audio (echoes `unmute_workout`) |
| mute_speech | Workout player | Mutes only spoken feedback; sound effects still play (echoes `mute_speech`) |
| unmute_speech | Workout player | Unmutes spoken feedback (echoes `unmute_speech`) |
| start | Custom Workout only | Starts the workout built from `customWorkoutExercises` — send it after `all_resources_loaded` arrives. Ignored on other integration options |
| load_models | Camera only | Fetches and caches additional exercise models mid-session: `{ workout_activity_action: "load_models", exercises: ["id1", "id2"], exerciseFetchType?: "model_id" }`. Replies with `models_loaded` / `error_occurred`; loaded IDs become switchable via `currentExercise` |

**Scope note:** the pause/mute family only affects the standard workout player (Main, Workout, Plan, Personalized Plan, Custom Workout while an exercise is running). The Camera component, games, and assessments do not react to these actions — the Camera component has its own control commands sent through `currentExercise` (see [Camera Component](/docs/customization-parameters/camera-component-params)).

**Note:** These actions are sent via postMessage to the KinesteX iframe/webview after the initial verification.

**Workout Activity Actions**

_Swift (iOS)_
```swift
// Send workout activity action using @State binding
// First, declare the state variable and pass it to the view:
// @State var workoutAction: [String: Any]? = nil
// kinestex.createWorkoutView(..., workoutAction: $workoutAction, ...)

// Pause the workout
workoutAction = ["workout_activity_action": "pause_workout"]

// Resume the workout
workoutAction = ["workout_activity_action": "resume_workout"]

// Mute all audio
workoutAction = ["workout_activity_action": "mute_workout"]

// Unmute all audio
workoutAction = ["workout_activity_action": "unmute_workout"]

// Mute only speech (sounds still play)
workoutAction = ["workout_activity_action": "mute_speech"]

// Unmute speech
workoutAction = ["workout_activity_action": "unmute_speech"]
```

_Kotlin (Android)_
```kotlin
// Send workout activity action
// Pause the workout
KinesteXSDK.sendAction("workout_activity_action", "pause_workout")

// Resume the workout
KinesteXSDK.sendAction("workout_activity_action", "resume_workout")

// Mute all audio
KinesteXSDK.sendAction("workout_activity_action", "mute_workout")

// Unmute all audio
KinesteXSDK.sendAction("workout_activity_action", "unmute_workout")

// Mute only speech (sounds still play)
KinesteXSDK.sendAction("workout_activity_action", "mute_speech")

// Unmute speech
KinesteXSDK.sendAction("workout_activity_action", "unmute_speech")
```

_React Native_
```jsx
// Send workout activity action
const kinestexSDKRef = useRef<KinesteXSDKCamera>(null);

// Pause the workout
kinestexSDKRef.current?.sendAction("workout_activity_action", "pause_workout");

// Resume the workout
kinestexSDKRef.current?.sendAction("workout_activity_action", "resume_workout");

// Mute all audio
kinestexSDKRef.current?.sendAction("workout_activity_action", "mute_workout");

// Unmute all audio
kinestexSDKRef.current?.sendAction("workout_activity_action", "unmute_workout");

// Mute only speech (sounds still play)
kinestexSDKRef.current?.sendAction("workout_activity_action", "mute_speech");

// Unmute speech
kinestexSDKRef.current?.sendAction("workout_activity_action", "unmute_speech");
```

_Flutter_
```dart
// Send workout activity action
// Pause the workout
KinesteXAIFramework.sendAction("workout_activity_action", "pause_workout");

// Resume the workout
KinesteXAIFramework.sendAction("workout_activity_action", "resume_workout");

// Mute all audio
KinesteXAIFramework.sendAction("workout_activity_action", "mute_workout");

// Unmute all audio
KinesteXAIFramework.sendAction("workout_activity_action", "unmute_workout");

// Mute only speech (sounds still play)
KinesteXAIFramework.sendAction("workout_activity_action", "mute_speech");

// Unmute speech
KinesteXAIFramework.sendAction("workout_activity_action", "unmute_speech");
```

_HTML / JavaScript_
```html
// Send workout activity action via postMessage
const iframe = document.getElementById('kinestex-iframe');

// Pause the workout
iframe.contentWindow.postMessage({
  workout_activity_action: "pause_workout"
}, "*");

// Resume the workout
iframe.contentWindow.postMessage({
  workout_activity_action: "resume_workout"
}, "*");

// Mute all audio
iframe.contentWindow.postMessage({
  workout_activity_action: "mute_workout"
}, "*");

// Unmute all audio
iframe.contentWindow.postMessage({
  workout_activity_action: "unmute_workout"
}, "*");

// Mute only speech (sounds still play)
iframe.contentWindow.postMessage({
  workout_activity_action: "mute_speech"
}, "*");

// Unmute speech
iframe.contentWindow.postMessage({
  workout_activity_action: "unmute_speech"
}, "*");
```

_React (TypeScript)_
```tsx
// Send workout activity action
import { useRef } from 'react';
import { type KinesteXSDKCamera } from 'kinestex-sdk-react-ts';

const ref = useRef<KinesteXSDKCamera>(null);

// Pause the workout
ref.current?.sendAction("workout_activity_action", "pause_workout");

// Resume the workout
ref.current?.sendAction("workout_activity_action", "resume_workout");

// Mute all audio
ref.current?.sendAction("workout_activity_action", "mute_workout");

// Unmute all audio
ref.current?.sendAction("workout_activity_action", "unmute_workout");

// Mute only speech (sounds still play)
ref.current?.sendAction("workout_activity_action", "mute_speech");

// Unmute speech
ref.current?.sendAction("workout_activity_action", "unmute_speech");
```

---
Source: https://www.kinestex.com/docs/customization-parameters/workout-activity-actions · Index: https://www.kinestex.com/llms.txt
