Index of every page on this site: llms.txt
All skills
android avatar

/camerax

@7f7b217
by androidandroid/skills11k stars
703
Run it yourself

Provide technical guidance for Android camera development with CameraX. Use when implementing camera features, handling asynchronous recording lifecycles, wiring low-level hardware interop using CameraX, or integrating ML Kit or Media3 effects.

Use this Skill: https://skilld.dev/gh/android/skills/camerax

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencesxr.md

≈614 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Developing camera features for XR devices, headsets, and AR glasses requires a shift from 2D pixel-pushing to 3D spatial awareness.

Understand the XR development mindset

Concept Mobile focus XR focus
Input Raw camera stream Spatial tracking (visual-inertial odometry (VIO) or simultaneous localization and mapping (SLAM))
Output Screen viewfinder Stereo passthrough and occlusion
Constraint Battery life Motion-to-photon latency (less than 20 ms)

Follow the implementation guide

API selection

On XR devices, standard CameraX implementations are often restricted or insufficient. Always use spatial software development kits (SDKs):

  • ARCore: Use ARCore for plane detection, depth sensing, and motion tracking.
  • OpenXR: Use OpenXR as the cross-platform standard for VR and AR rendering and input.
  • OEM SDKs: Use manufacturer-specific libraries for hardware-accelerated passthrough.

Handle spatial passthrough

Unlike a 2D viewport, XR passthrough is often system-managed.

[Key requirement] Frame synchronization: Synchronize your application's frame clock with the headset's head-mounted display (HMD) pose.

// Example: Querying the spatial pose for the current camera frame
val headPose = xrSession.getHeadPose(frameTime)
val projectionMatrix = headPose.getProjectionMatrix(eyeIndex)
<br />

Manage depth and occlusion

Digital content must respect real-world depth to ensure accurate occlusion.

  • Depth map : Access raw depth data using ARCore or SurfaceProcessor to create an occlusion mask.
  • Hardware buffers : Use HardwareBuffer to share camera frames directly with the GPU without CPU-side copies to minimize latency.

XR pitfalls

  • The nausea limit: Any processing that delays the viewfinder by more than 20 ms causes user sickness. Don't perform image processing on the main thread.
  • Privacy restrictions : Some XR devices return a black frame if you attempt to record the "Passthrough" layer. Check Session.isRecordingSupported.
  • Field of view (FOV): The camera FOV possibly doesn't match the display FOV. Use the SDK's projection matrixes instead of calculating aspect ratios manually.
  • Front buffer rendering : If the device supports it, use FrontBufferRenderer for real-time overlays to bypass standard double-buffering latency.

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts6d3 checks · Risk SAFE
  • Gen Agent Trust Hub7d

    The skill provides technical guidance for Android CameraX development, covering migration from legacy APIs, handling device diversity (foldables, Wear OS, XR), and integrating with ML Kit and Media3. No security issues were detected; all code snippets and external references originate from trusted sources and follow standard platform patterns.

  • Socket6d

    No alerts

  • Snyk7d

    Risk: LOW · No issues

Signed by skilld at 7f7b217. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 1 hour ago.

Activeupdated last week
Other metadata
metadata
{
  "author": "Google LLC",
  "last-updated": "2026-11-10",
  "keywords": [
    "recipe",
    "Android",
    "Camera",
    "Camera1",
    "Camera2",
    "CameraX",
    "migration",
    "Compose",
    "guide",
    "dependencies",
    "PreviewView",
    "CameraXViewfinder",
    "ImageCapture",
    "VideoCapture",
    "ImageAnalysis."
  ]
}

README badge

README badge for android/skills/camerax