Skip to content

Video Workouts

Video workouts are rendered through WorkoutVideoFragment.

Capabilities

  • Stream workout video content
  • Pause/resume playback
  • Skip forward/backward by 15 seconds

Create the fragment

kotlin
val videoFragment = WorkoutVideoFragment.newInstance(
    workoutContent,   // GraphQL payload
    workoutConfig,    // JSON configuration
    jwtToken          // JWT token
)

Integration notes

  • Use the same GraphQL/JWT preparation flow as classic workouts.
  • Reuse the same text customization keys in the configuration payload.

Handle completion

Video workouts report completion through the WorkoutVideoKitInterface implemented by your host activity.

kotlin
override fun saveWorkout(saveState: SaveWorkoutState): Promise<*, *, *> {
    // The workout completed. Persist saveState before resolving if needed.
    return DeferredObject<SaveWorkoutState, Throwable, Throwable>()
        .resolve(saveState)
}

override fun goToNextScreen() {
    // Continue or dismiss your host flow after the workout screen is done.
    finish()
}

override fun trackEvent(data: TrackingData) {
    // Optional: forward TrainingKit analytics metadata.
}

Use saveWorkout as the source of truth for completed workout results. Resolve its promise when your persistence step is finished. Use goToNextScreen or your close handling for navigation after the workout, and trackEvent for analytics-only events.