Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 21 additions & 22 deletions docs/camera-image-injection-on-real-devices.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
id: camera-image-injection-on-real-devices
title: Camera Image Injection on Real Devices
sidebar_label: Camera Image Injection
title: Media Injection on Real Devices
sidebar_label: Media Injection
description: Test camera features on real devices with LambdaTest's Image Injection. Easily inject custom images for QR codes, photos, and more.
keywords:
- image injection
Expand Down Expand Up @@ -49,26 +49,26 @@ import TabItem from '@theme/TabItem';
}}
></script>

LambdaTest's Camera Image Injection empowers you to test various camera-related functionalities of your app across a vast array of real mobile devices. This innovative feature supports image capture testing, QR code scanning verification and Barcode scanning assessment.
LambdaTest's Media Injection empowers you to test various camera-related functionalities (Image Injection and Video Injection) of your app across a vast array of real mobile devices. This innovative feature supports image capture testing, QR code scanning verification and Barcode scanning assessment.

## Use Cases

- URL-embedded QR code scans
- Digital check processing
- Profile photo capture
- In-app image upload functionality
- Real-time video streaming and playback
- Video capture and upload workflows

## How It Works

The Image Injection process leverages **Sensor Instrumentation** technology. When activated for a test session, it injects LambdaTest's proprietary camera module into your application and emulates or supersedes the native Android/iOS camera SDK
The Image and Video Injection processes leverages **Sensor Instrumentation** technology. When activated for a test session, it injects LambdaTest's proprietary camera module into your application and emulates or supersedes the native Android/iOS camera SDK

### Key Features

- Extensive device compatibility (3000+ real devices)
- Comprehensive support for image-based functionalities
- Extensive device compatibility (10000+ real devices)
- Comprehensive support for image and video based functionalities
- Effortless integration with existing test environments

:::warning note
- Video capture and other media types are not currently supported.
- For iOS apps signed with Enterprise Certificates, app resigning (a prerequisite for using the Image Injection tool) is not available.
:::

Expand Down Expand Up @@ -103,32 +103,31 @@ Below given is the list of Camera APIs which are supported by LambdaTest Image I
</TabItem>
</Tabs>

## Image Injection in Real Device App Testing
## Image and Video Injection in Real Device App Testing

This feature helps you inject any image which you want your app to click or scan through the device camera. You just need to follow the steps given below:
This feature helps you inject any video or image which you want your app to click or scan through the device camera. You just need to follow the steps given below:

**Step 1:** Click on the **Real Devices** > **App Testing**

**Step 2:** Select your required device and upload your application which supports the camera APIs listed above.

**Step 3:** Now, hover over your app and click on the **Settings** icon. Toggle the **Image Injection** option and click on **Save Changes** button. Click on **Start** to run your app on the selected device.
**Step 3:** Now, hover over your app and click on the **Settings** icon. Toggle the **Image Injection** and **Video Injection** option and click on **Save Changes** button. Click on **Start** to run your app on the selected device.

<img loading="lazy" src={require('../assets/images/mobile-app-testing/media-injection/Step3.png').default} alt="Native Mobile App Testing" className="doc_img" width="1366" height="629"/>

**Step 4:** After the above config, click on the **Start** button to start the session. Now, go to **Device Controls** in the toolbar as shown below. Select Image Injection and click **Upload Image** to inject the desired image from your computer to the app.
**Step 4:** You can see the video and image preview in the Media Injection section. You can
**delete**, **reupload** and **inject** the image or video from here.

**Step 5:** You can see the image preview in the Image Injection section. You can **delete** or **reupload** the image from here.
<img loading="lazy" src={require('../assets/images/mobile-app-testing/media-injection/Stepfinal.png').default} alt="Native Mobile App Testing" className="doc_img" width="1366" height="629"/>

**Step 6:** Now go to camera feature in your app, the camera pops up. When you click the image from your app, you will see a black image. Please proceed with the same by clicking on **Use Photo**.
**Step 5:** After the above config, click on the **Start** button to start the session. Now, go to **Device Controls** in the toolbar as shown below. Select Media Injection and click **Inject** to upload the desired video or image from your computer to the app.

**Step 7:** The black image is now replaced with an injected image.
<img loading="lazy" src={require('../assets/images/mobile-app-testing/media-injection/Stepfinalx.png').default} alt="Native Mobile App Testing" className="doc_img" width="1366" height="629"/>


<div className="storylane-iframe">
<script async src="https://js.storylane.io/js/v2/storylane.js"></script>
<div className="sl-embed">
<iframe loading="lazy" className="sl-demo" src="https://app.storylane.io/demo/scecvtiqzhju?embed=inline" name="sl-embed" name="sl-embed" allow="fullscreen" allowfullscreen></iframe>
</div>
</div>
**Step 6:** Now go to camera feature in your app, the camera pops up. When you click the image from your app, you will see a black image. Please proceed with the same by clicking on **Use Photo**.

**Step 7:** The black image is now replaced with an injected image or video.

:::info

Expand Down
1 change: 0 additions & 1 deletion docs/camera-image-injection.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ LambdaTest utilizes **Sensor Instrumentation** to integrate with various mobile
- Seamless integration with your existing app testing workflow

:::warning note
- Video capture and other media types are not currently supported.
- For iOS apps signed with Enterprise Certificates, app resigning (a prerequisite for using the Image Injection tool) is not available.
:::

Expand Down
176 changes: 176 additions & 0 deletions docs/video-injection.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
---
id: video-injection
title: Video Injection
sidebar_label: Video Injection
description: Now you can test image capturing and QR code or Barcode scanning in your app on LambdaTest Real Device Cloud Platform with 3000+ real mobile devices.
keywords:
- image injection
- app test automation
- camera image
- QR code scanning
- Barcode scanning
- lambdatest capture code
- framework on lambdatest
- app testing appium
- app testing
- real devices
url: https://www.lambdatest.com/support/docs/video-injection/
site_name: LambdaTest
slug: video-injection/
---

import CodeBlock from '@theme/CodeBlock';
import {YOUR_LAMBDATEST_USERNAME, YOUR_LAMBDATEST_ACCESS_KEY} from "@site/src/component/keys";

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

<script type="application/ld+json"
dangerouslySetInnerHTML={{ __html: JSON.stringify({
"@context": "https://schema.org",
"@type": "BreadcrumbList",
"itemListElement": [{
"@type": "ListItem",
"position": 1,
"name": "Home",
"item": "https://www.lambdatest.com"
},{
"@type": "ListItem",
"position": 2,
"name": "Support",
"item": "https://www.lambdatest.com/support/docs/"
},{
"@type": "ListItem",
"position": 3,
"name": "Camera Image Injection",
"item": "https://www.lambdatest.com/support/docs/camera-image-injection/"
}]
})
}}
></script>
Video Injection feature enables you to test video-based functionalities such as **live streaming, real-time video capture,** and **video processing** in your app across 10000+ real devices on the LambdaTest Real Device Cloud platform.

This tool is ideal for testing features such as:

- Real-time video streaming and playback
- Video-based verification (e.g., identity verification using live video)
- Video capture and upload workflows
- In-app video recording features

## How It Works
LambdaTest utilizes **Sensor Instrumentation** to integrate with various mobile sensors, including the camera. When you enable Video Injection for a session, LambdaTest injects its camera code module into your app through Sensor Instrumentation. This module then mocks or overrides the iOS SDK used in your app.

:::warning note
- This feature is currently available on iOS only. Support for Android will be available soon.
:::


## Video Injection in App Automation

This section explains how to use Video Injection with App automation. This section will also teach you how to use video injection for all the possible test cases for your app along with other useful information.

### Step 1: Upload video to LambdaTest

You can use the following curl command to upload any video of your choice to the LambdaTest cloud. Please note that we support only **MP4 format is only supported and the video can be 50 MB or less**.

<div className="lambdatest__codeblock">
<CodeBlock className="language-bash">
{`curl -u "${ YOUR_LAMBDATEST_USERNAME()}:${ YOUR_LAMBDATEST_ACCESS_KEY()}" -X POST "https://mobile-mgm.lambdatest.com/mfs/v1.0/media/upload" -F "media_file=@"/Users/macuser/Downloads/video.mp4"" -F "type="video"" -F "custom_id="SampleVideo""`}
</CodeBlock>
</div>

Response of above cURL will be a JSON object containing the `media_url` of the format - lt://MEDIA123456789123456789 as shown below.

```js
{
"media_url":"lt://MEDIA123456789123456789",
"name":"Video_123.mp4",
"status":"success",
"custom_id":"SampleVideo"
}
```

### Step 2: Enable Video injection in the Appium Session

You can use the appium capability to turn the video injection on in your application. Just add `"enableVideoInjection": True` in the desired capabilities while writing the automation script. By adding this capability the app undergoes Sensor Instrumentation, which was described earlier in the documentation. Also adding media url `"media": "lt://MEDIA123456789123456789"` in the capabilities to inject the video is now optional and can be passed in LambdaHook as mentioned in step 3.

<Tabs className="docs__val">

<TabItem value="python" label="Python" default>
<div className="lambdatest__codeblock">
<CodeBlock className="language-python">
{`desired_capabilities = {
"enableVideoInjection": True,
"media": "lt://MEDIAf446d4170cd946aa9ec307d10cb679b9", #Add media_url here (optional)
}`}
</CodeBlock>
</div>
</TabItem>


<TabItem value="JavaScript" label="JavaScript" default>
<div className="lambdatest__codeblock">
<CodeBlock className="language-javascript">
{`DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
desiredCapabilities.setCapability("enableVideoInjection", "true");`}
</CodeBlock>
</div>
</TabItem>
</Tabs>

### Step 3: Inject the video

Refer to the code snippets given below to upload the video with the action `VideoInjection`. Please make sure that the video needs to be injected before the camera is triggered in your application. This is due to the fact that the camera only captures the video injected at the last.

<Tabs className="docs__val">

<TabItem value="python" label="Python" default>
<div className="lambdatest__codeblock">
<CodeBlock className="language-python">
{`driver.execute_script("lambda-video-injection=media_url") #Add media_url here`}
</CodeBlock>
</div>
</TabItem>


<TabItem value="JavaScript" label="JavaScript" default>
<div className="lambdatest__codeblock">
<CodeBlock className="language-javascript">
{`driver.execute_script("lambda-video-injection=media_url") //Add media_url here`}
</CodeBlock>
</div>
</TabItem>
</Tabs>

:::info

**Use Case**: This feature can be used when you want to test injecting more than one video in single test at different instances. The video injected through above process will replace the video which you put in previous steps.

:::

### Step 4: Capture the desired video through camera

You need to first add a logic to inject the uploaded video in the script. Thereafter add the logic to click the camera button in the mobile app. This will show you the last injected video on your mobile app screen.

> 📕 Check the [documentation for Media Injection](/support/docs/camera-image-injection-on-real-devices/) feature in Manual App Testing on Real devices


<nav aria-label="breadcrumbs">
<ul className="breadcrumbs">
<li className="breadcrumbs__item">
<a className="breadcrumbs__link" target="_self" href="https://www.lambdatest.com">
Home
</a>
</li>
<li className="breadcrumbs__item">
<a className="breadcrumbs__link" target="_self" href="https://www.lambdatest.com/support/docs/">
Support
</a>
</li>
<li className="breadcrumbs__item breadcrumbs__item--active">
<span className="breadcrumbs__link">
Camera Image Injection
</span>
</li>
</ul>
</nav>
1 change: 1 addition & 0 deletions sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -2577,6 +2577,7 @@ module.exports = {
label: "Features",
items: [
"camera-image-injection",
"video-injection",
"biometric-authentication",
"regular-expression-appium",
"appium-upload-media",
Expand Down
Loading