मुख्य सामग्री पर जाएँ
Skillpedia
मोबाइल ऐप10k · #11908

camerax

यह क्या करती है

यह स्किल CameraX लाइब्रेरी से Android ऐप में कैमरा फ़ीचर बनाने के लिए मार्गदर्शन और पैटर्न देती है। यह उन Android डेवलपरों के लिए है जो ऐप में फ़ोटो, वीडियो या इफ़ेक्ट जोड़ रहे हैं।

कब इस्तेमाल करें

  • ✓जब आप Android ऐप में कैमरा या वीडियो रिकॉर्डिंग स्क्रीन जोड़ना चाहते हैं।
  • ✓जब आपको पुराने Android कैमरा कोड को CameraX पर ले जाना हो।
  • ✓जब आप कैमरा फ़ीड पर ML Kit या Media3 इफ़ेक्ट जोड़ना चाहते हैं।

Skill का लिंक

https://github.com/android/skills/blob/main/camera/camerax/SKILL.md

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/android/skills/blob/main/camera/camerax/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“मेरे Android ऐप में CameraX का इस्तेमाल करके ऑडियो के साथ वीडियो रिकॉर्डिंग जोड़िए।”

हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।

यह कैसे काम करती है

स्किल CameraX लाइब्रेरी के लिए चरण-दर-चरण पैटर्न देती है। वह उन builder कॉल की ओर इशारा करती है जिनका नतीजा वापस सेव करना ज़रूरी है, ताकि वे असर करें, और हार्डवेयर इंटरऑप व इफ़ेक्ट इंटीग्रेशन भी कवर करती है।

तकनीकी सामग्री (मूल SKILL.md)

लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।

This skill provides procedural guidance and standard patterns for building camera applications on Android, with a focus on CameraX, including its Camera2Interop utilities, and Media3 integrations.

Core workflows

Handling immutable API patterns

Various Android camera and media APIs, especially CameraX VideoCapture, use a fluent, immutable builder-like pattern where methods return a new instance. Failing to reassign these results in settings, such as audio, being ignored.

Pattern: Reassignment is required

// WRONG
run {
  val pending = recorder.prepareRecording(context, opts)
  pending.withAudioEnabled() // This returns a new instance which is ignored
  val active = pending.start(exec, listener)
}

// CORRECT
run {
  val pending = recorder.prepareRecording(context, opts)
      .withAudioEnabled() // Chaining works
  val active = pending.start(exec, listener)
}

// ALSO CORRECT
run {
  var pending = recorder.prepareRecording(context, opts)
  pending = pending.withAudioEnabled() // Reassignment
  val active = pending.start(exec, listener)
}
<br />

See immutability for a list of affected classes.

Migrating to CameraX

When migrating legacy camera codebases to the CameraX Jetpack library:

  • Camera1 to CameraX : For migrating legacy android.hardware.Camera implementations, surface handling, and manual lifecycles, see the Camera1 migration guide.
  • Camera2 to CameraX : For migrating more recent but verbose android.hardware.camera2 implementations, session state callbacks, and interop patterns, see the Camera2 migration guide.

Comprehensive feature blueprinting

For multi-step features that involve multiple files and hardware-level wiring, follow the Structural Blueprinting approach to avoid system timeouts. Such complex features include:

  • Manual controls : Break down into the ViewModel state, the controller layer, and the Camera2Interop wiring in the session.
  • RAW capture: Separate JPEG and RAW output configurations into discrete build steps.
  • Custom effects : Prefer Media3Effect or SurfaceProcessor over manual OpenGL pipelines unless absolute performance is required.
  • Low-light : See low-light for Night Mode and LLB guidance.
  • Foldables : See foldables for handling dynamic postures and hinge states.
  • XR, AR, and VR : See xr for spatial tracking, passthrough synchronization, and latency guardrails.
  • Thermals and power : See thermals for managing StreamUseCase optimizations and PowerManager thermal states.
  • Testing and mocking : See testing for using FakeCameraConfig, handling asynchronous lifecycles, and validating analysis pipelines.
  • ML Kit spatial analysis : See mlkit-spatial for coordinate mapping, rotation logic, and mirrored lens handling.
  • Wear OS camera remote : See wear-os for circular UI constraints, Data Layer API syncing, and remote trigger logic.

See expert-blueprints for step-by-step guides.

API discovery

Always use higher-level abstractions instead of low-level manual wiring:

  • Analysis : Use MlKitAnalyzer instead of manual ImageAnalysis.Analyzer.
  • Filters and effects : Use Media3Effect for standard post-processing.
  • Multi-camera : Use ConcurrentCamera APIs for dual-stream setups.

See modern-apis for current recommendations.

Code quality and architectural rules

Adhere to the following Android ecosystem standard patterns when building your camera implementations:

  • Testing, fakes over mocks : Avoid mocking libraries like Mockito, especially for multi-step CameraX interfaces like ImageProxy. Build "Fakes" to verify state rather than unreliable implementation details.
  • Google Truth assertions : Use assertThat over standard JUnit assertions like assertEquals for improved readability.
  • Explicit test runners : Always define an explicit @RunWith for test classes to ensure the CI environment executes them correctly.
  • Semantic UI merging : When building custom camera controls in Compose, such as a button with an Icon and Text, use `semantics {
अक्सर पूछे जाने वाले सवाल

मेरी ऑडियो सेटिंग क्यों नज़रअंदाज़ हो रही है?

CameraX के कुछ builder तरीके नई ऑब्जेक्ट लौटाते हैं, इसलिए नतीजा वापस सेव करना होता है। स्किल इस बात की ओर ध्यान दिलाती है।

क्या यह पुराने Camera API से माइग्रेट करने में मदद करती है?

हाँ। इसमें पुराने Camera कोड को CameraX पर ले जाने का मार्गदर्शन है।

क्या यह ML Kit को कवर करती है?

हाँ। यह CameraX सेटअप में ML Kit या Media3 इफ़ेक्ट जोड़ने को कवर करती है।

जानकारी

लेखक का मूल विवरण

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.

repo: android/skills

लोकप्रियता

GitHub स्टार
10k
रैंकिंग में स्थान
#11908
लाइसेंस
Apache-2.0
अपडेट की गई
29/10/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

मिलती-जुलती skills