android-video-capture

Capture video and photos in Android CameraX apps with Compose.

8|1|Updated Mar 30, 2026
One-click install
npx skills add https://github.com/drewid74/ai_skills --skill android-video-capture
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: android-video-capture
Source: https://github.com/drewid74/ai_skills/tree/main/android-video-capture
Command: npx skills add https://github.com/drewid74/ai_skills --skill android-video-capture

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Building a reliable camera screen is hard because lifecycles, permissions, and recording/capture flows easily break across devices, orientations, and UI recompositions.

Core Features & Use Cases

  • Lifecycle-aware CameraX setup in Android apps using ProcessCameraProvider so preview and capture start/stop safely with the UI lifecycle.
  • Video recording to MediaStore with VideoCapture and MediaStoreOutputOptions, including optional audio support for MP4 gallery-ready videos.
  • Photo capture to MediaStore with ImageCapture and correct ContentValues for gallery placement.
  • Simultaneous preview + video + photo, with runtime capability checks via CameraInfo.isUseCaseCombinationSupported() for older devices.
  • Camera controls including dynamic front/back selection and torch/flashlight control with state observation.
  • Safety and quality guardrails like explicit QualitySelector, strong references to active recordings, and anti-pattern fixes for common IllegalStateException and finalize issues.

Quick Start

Use the android-video-capture skill to implement a Compose camera preview that records an audio-enabled video to the gallery and captures photos with torch support.

Frequently Asked Questions about android-video-capture

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I capture video and photos simultaneously using CameraX in Android Compose?

To capture video and photos using CameraX in Android Compose, bind Preview, VideoCapture, and ImageCapture use cases together via ProcessCameraProvider, checking CameraInfo.isUseCaseCombinationSupported() for older device compatibility.

How do I save CameraX video recordings to the Android MediaStore?

Save CameraX video recordings to the Android MediaStore by configuring VideoCapture with MediaStoreOutputOptions, enabling optional audio support to produce gallery-ready MP4 files managed by the system.

Why does my CameraX recording fail with IllegalStateException on recomposition?

CameraX recording fails with IllegalStateException on recomposition due to improper lifecycle management or lost references. Maintain strong references to active recordings and implement anti-pattern-safe unbind and rebind logic tied to the UI lifecycle.

Can I toggle the torch and switch cameras while using CameraX in a Compose app?

Yes, you can toggle the torch and switch cameras in a Compose app using CameraX by observing camera state and dynamically applying camera selectors and torch control updates to the bound camera instance.

What permissions do I need to record video with audio using CameraX?

To record video with audio using CameraX, you need camera and audio recording permissions configured in your Android manifest, enabling the microphone for VideoCapture alongside the standard camera access.

How do I ensure CameraX preview starts and stops safely with the Compose lifecycle?

Ensure CameraX preview starts and stops safely with the Compose lifecycle by binding use cases through ProcessCameraProvider within a lifecycle-aware Compose setup, preventing crashes across orientations and recompositions.