Skip to main content

Media Injection

Overview

The Media Injection feature lets you feed images or videos directly into the camera stream of browser sessions or Android mobile applications (APKs) during an AstroFarm session. This enables seamless testing of camera-dependent workflows like QR code scanning or facial recognition without requiring physical devices or a live camera feed.

Use Cases

Many applications rely on real-time camera input for workflows like KYC verification, barcode scanning, or document uploads. Testing these scenarios traditionally requires physical device setup, repeated manual effort, and inconsistent conditions.

With Media Injection, you can simulate camera input by injecting predefined media directly into a browser session or a selected app. This ensures:

  • Consistent test conditions across all environments
  • Faster execution of camera-dependent test cases
  • Repeatable and automation-friendly workflows with no manual camera handling

One-Time Setup

Before using Media Injection, complete the one-time setup for your preferred injection mode.

Browser-Based Injection

You need to enable a Chrome flag on your device. This is required only once.

  1. Open Chrome in your AstroFarm session.

  2. Navigate to:

    chrome://flags/#enable-command-line-on-non-rooted-devices

alt text

  1. Set the flag to Enabled.

  2. Click Relaunch. Chrome will restart — this is expected.

Application-Based Injection

Image Injection must be enabled for each APK. You can do this during upload or for existing apps.

Option A — During App Upload

  1. Navigate to App Store → Upload App.
  2. Upload your APK.
  3. Toggle Image Injection ON in the upload modal.
  4. Complete the upload

alt text

Option B — For Existing Apps

  1. Navigate to the App Store and locate your app.
  2. Click the Settings (⚙️) icon next to the app.
  3. Enable Image Injection and save the configuration.

Injecting Media

Once setup is complete, follow these steps from the AstroFarm Dashboard:

  1. Open the AstroFarm Dashboard and locate the Media Injection panel.
  2. Toggle Media Injection ON.
  3. Select your injection mode: Browser-Based or Application-Based.
  4. Upload your media using Browse from Computer (drag & drop or select a file) or choose an asset from Media Store.
  5. Click Inject.

For Application-Based Sessions:

  • Select the target application from the dropdown.
  • Launch the app and trigger the camera flow.

For Browser-Based sessions:

  • Open your web application and trigger the camera flow.

✅ Result: The uploaded media appears as the live camera input in the selected browser session or application, based on the chosen mode.

Supported Formats & Browsers

TypeFormatsMax SizeBrowserApplication
Image.jpg, .jpeg, .png10 MBSupportedSupported
Video.mp4, .mov50 MBSupportedNot Supported
Y4M.y4m300 MBSupportedNot Supported
  • Supported browsers: Chrome, Edge, Brave, and Opera (Android). All Chromium-based browsers are supported.
  • Supported Android camera APIs: camera, camera2, CameraX, and ImageReader. If your APK uses a different camera implementation, media injection may not work as expected. Important Notes

Important Notes

  • Injection is mode-specific; browser and application flows are fully isolated from each other.
  • Application-based injection requires that the APK has Image Injection enabled.
  • Browser-based injection does not affect native applications.
  • Application-based injection does not affect browser sessions. Apps must actively use camera functionality for injection to work.