# Workout Activity Actions

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

| Action | Description |
|--------|-------------|
| pause_workout | Pauses the workout (video, timer, and tracking) |
| resume_workout | Resumes a paused workout |
| mute_workout | Mutes all audio (speech, sounds, and music) |
| unmute_workout | Unmutes all audio |
| mute_speech | Mutes only speech feedback (sounds still play) |
| unmute_speech | Unmutes speech feedback |

**Note:** These actions are sent via postMessage to the KinesteX iframe/webview after the workout has started.

**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://kinestex.com/docs/customization-parameters/workout-activity-actions · Index: https://kinestex.com/llms.txt
