Skip to content

Commit b36f345

Browse files
authored
Merge pull request #1541 from shreybansal-lambdatest/stage
video injection update
2 parents 6e48074 + 70a27fa commit b36f345

File tree

9 files changed

+198
-23
lines changed

9 files changed

+198
-23
lines changed
Loading
Loading
Loading
Loading
Loading

docs/camera-image-injection-on-real-devices.md

+21-22
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
id: camera-image-injection-on-real-devices
3-
title: Camera Image Injection on Real Devices
4-
sidebar_label: Camera Image Injection
3+
title: Media Injection on Real Devices
4+
sidebar_label: Media Injection
55
description: Test camera features on real devices with LambdaTest's Image Injection. Easily inject custom images for QR codes, photos, and more.
66
keywords:
77
- image injection
@@ -49,26 +49,26 @@ import TabItem from '@theme/TabItem';
4949
}}
5050
></script>
5151

52-
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.
52+
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.
5353

5454
## Use Cases
5555

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

6161
## How It Works
6262

63-
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
63+
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
6464

6565
### Key Features
6666

67-
- Extensive device compatibility (3000+ real devices)
68-
- Comprehensive support for image-based functionalities
67+
- Extensive device compatibility (10000+ real devices)
68+
- Comprehensive support for image and video based functionalities
6969
- Effortless integration with existing test environments
70+
7071
:::warning note
71-
- Video capture and other media types are not currently supported.
7272
- For iOS apps signed with Enterprise Certificates, app resigning (a prerequisite for using the Image Injection tool) is not available.
7373
:::
7474

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

106-
## Image Injection in Real Device App Testing
106+
## Image and Video Injection in Real Device App Testing
107107

108-
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:
108+
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:
109109

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

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

114-
**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.
114+
**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.
115115

116+
<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"/>
116117

117-
**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.
118+
**Step 4:** You can see the video and image preview in the Media Injection section. You can
119+
**delete**, **reupload** and **inject** the image or video from here.
118120

119-
**Step 5:** You can see the image preview in the Image Injection section. You can **delete** or **reupload** the image from here.
121+
<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"/>
120122

121-
**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**.
123+
**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.
122124

123-
**Step 7:** The black image is now replaced with an injected image.
125+
<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"/>
126+
124127

125-
<div className="storylane-iframe">
126-
<script async src="https://js.storylane.io/js/v2/storylane.js"></script>
127-
<div className="sl-embed">
128-
<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>
129-
</div>
130-
</div>
128+
**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**.
131129

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

133132
:::info
134133

docs/camera-image-injection.md

-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ LambdaTest utilizes **Sensor Instrumentation** to integrate with various mobile
6767
- Seamless integration with your existing app testing workflow
6868

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

docs/video-injection.md

+176
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
---
2+
id: video-injection
3+
title: Video Injection
4+
sidebar_label: Video Injection
5+
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.
6+
keywords:
7+
- image injection
8+
- app test automation
9+
- camera image
10+
- QR code scanning
11+
- Barcode scanning
12+
- lambdatest capture code
13+
- framework on lambdatest
14+
- app testing appium
15+
- app testing
16+
- real devices
17+
url: https://www.lambdatest.com/support/docs/video-injection/
18+
site_name: LambdaTest
19+
slug: video-injection/
20+
---
21+
22+
import CodeBlock from '@theme/CodeBlock';
23+
import {YOUR_LAMBDATEST_USERNAME, YOUR_LAMBDATEST_ACCESS_KEY} from "@site/src/component/keys";
24+
25+
import Tabs from '@theme/Tabs';
26+
import TabItem from '@theme/TabItem';
27+
28+
<script type="application/ld+json"
29+
dangerouslySetInnerHTML={{ __html: JSON.stringify({
30+
"@context": "https://schema.org",
31+
"@type": "BreadcrumbList",
32+
"itemListElement": [{
33+
"@type": "ListItem",
34+
"position": 1,
35+
"name": "Home",
36+
"item": "https://www.lambdatest.com"
37+
},{
38+
"@type": "ListItem",
39+
"position": 2,
40+
"name": "Support",
41+
"item": "https://www.lambdatest.com/support/docs/"
42+
},{
43+
"@type": "ListItem",
44+
"position": 3,
45+
"name": "Camera Image Injection",
46+
"item": "https://www.lambdatest.com/support/docs/camera-image-injection/"
47+
}]
48+
})
49+
}}
50+
></script>
51+
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.
52+
53+
This tool is ideal for testing features such as:
54+
55+
- Real-time video streaming and playback
56+
- Video-based verification (e.g., identity verification using live video)
57+
- Video capture and upload workflows
58+
- In-app video recording features
59+
60+
## How It Works
61+
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.
62+
63+
:::warning note
64+
- This feature is currently available on iOS only. Support for Android will be available soon.
65+
:::
66+
67+
68+
## Video Injection in App Automation
69+
70+
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.
71+
72+
### Step 1: Upload video to LambdaTest
73+
74+
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**.
75+
76+
<div className="lambdatest__codeblock">
77+
<CodeBlock className="language-bash">
78+
{`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""`}
79+
</CodeBlock>
80+
</div>
81+
82+
Response of above cURL will be a JSON object containing the `media_url` of the format - lt://MEDIA123456789123456789 as shown below.
83+
84+
```js
85+
{
86+
"media_url":"lt://MEDIA123456789123456789",
87+
"name":"Video_123.mp4",
88+
"status":"success",
89+
"custom_id":"SampleVideo"
90+
}
91+
```
92+
93+
### Step 2: Enable Video injection in the Appium Session
94+
95+
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.
96+
97+
<Tabs className="docs__val">
98+
99+
<TabItem value="python" label="Python" default>
100+
<div className="lambdatest__codeblock">
101+
<CodeBlock className="language-python">
102+
{`desired_capabilities = {
103+
"enableVideoInjection": True,
104+
"media": "lt://MEDIAf446d4170cd946aa9ec307d10cb679b9", #Add media_url here (optional)
105+
}`}
106+
</CodeBlock>
107+
</div>
108+
</TabItem>
109+
110+
111+
<TabItem value="JavaScript" label="JavaScript" default>
112+
<div className="lambdatest__codeblock">
113+
<CodeBlock className="language-javascript">
114+
{`DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
115+
desiredCapabilities.setCapability("enableVideoInjection", "true");`}
116+
</CodeBlock>
117+
</div>
118+
</TabItem>
119+
</Tabs>
120+
121+
### Step 3: Inject the video
122+
123+
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.
124+
125+
<Tabs className="docs__val">
126+
127+
<TabItem value="python" label="Python" default>
128+
<div className="lambdatest__codeblock">
129+
<CodeBlock className="language-python">
130+
{`driver.execute_script("lambda-video-injection=media_url") #Add media_url here`}
131+
</CodeBlock>
132+
</div>
133+
</TabItem>
134+
135+
136+
<TabItem value="JavaScript" label="JavaScript" default>
137+
<div className="lambdatest__codeblock">
138+
<CodeBlock className="language-javascript">
139+
{`driver.execute_script("lambda-video-injection=media_url") //Add media_url here`}
140+
</CodeBlock>
141+
</div>
142+
</TabItem>
143+
</Tabs>
144+
145+
:::info
146+
147+
**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.
148+
149+
:::
150+
151+
### Step 4: Capture the desired video through camera
152+
153+
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.
154+
155+
> 📕 Check the [documentation for Media Injection](/support/docs/camera-image-injection-on-real-devices/) feature in Manual App Testing on Real devices
156+
157+
158+
<nav aria-label="breadcrumbs">
159+
<ul className="breadcrumbs">
160+
<li className="breadcrumbs__item">
161+
<a className="breadcrumbs__link" target="_self" href="https://www.lambdatest.com">
162+
Home
163+
</a>
164+
</li>
165+
<li className="breadcrumbs__item">
166+
<a className="breadcrumbs__link" target="_self" href="https://www.lambdatest.com/support/docs/">
167+
Support
168+
</a>
169+
</li>
170+
<li className="breadcrumbs__item breadcrumbs__item--active">
171+
<span className="breadcrumbs__link">
172+
Camera Image Injection
173+
</span>
174+
</li>
175+
</ul>
176+
</nav>

sidebars.js

+1
Original file line numberDiff line numberDiff line change
@@ -2578,6 +2578,7 @@ module.exports = {
25782578
label: "Features",
25792579
items: [
25802580
"camera-image-injection",
2581+
"video-injection",
25812582
"biometric-authentication",
25822583
"regular-expression-appium",
25832584
"appium-upload-media",

0 commit comments

Comments
 (0)