Skip to content

Commit f5b8211

Browse files
authored
Merge pull request #1960 from Ishavyas9/main
Audio Injection Beta
2 parents 7773330 + 76d84f3 commit f5b8211

File tree

2 files changed

+127
-0
lines changed

2 files changed

+127
-0
lines changed

docs/audio-injection.md

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
---
2+
id: audio-injection
3+
title: Audio Injection on iOS Real Devices
4+
sidebar_label: Audio Injection
5+
description: Inject audio content in your tests with LambdaTest to simulate microphone inputs for automated testing, enhancing your app's audio capabilities.
6+
7+
keywords:
8+
- audio injection
9+
- app test automation
10+
- microphone input
11+
- voice commands
12+
- audio recording
13+
- lambdatest audio testing
14+
- framework on lambdatest
15+
- app testing appium
16+
- app testing
17+
- real devices
18+
url: https://www.lambdatest.com/support/docs/audio-injection/
19+
site_name: LambdaTest
20+
slug: audio-injection/
21+
---
22+
23+
import CodeBlock from '@theme/CodeBlock';
24+
import {YOUR_LAMBDATEST_USERNAME, YOUR_LAMBDATEST_ACCESS_KEY} from "@site/src/component/keys";
25+
26+
import Tabs from '@theme/Tabs';
27+
import TabItem from '@theme/TabItem';
28+
29+
<script type="application/ld+json"
30+
dangerouslySetInnerHTML={{ __html: JSON.stringify({
31+
"@context": "https://schema.org",
32+
"@type": "BreadcrumbList",
33+
"itemListElement": [{
34+
"@type": "ListItem",
35+
"position": 1,
36+
"name": "Home",
37+
"item": "https://www.lambdatest.com"
38+
},{
39+
"@type": "ListItem",
40+
"position": 2,
41+
"name": "Support",
42+
"item": "https://www.lambdatest.com/support/docs/"
43+
},{
44+
"@type": "ListItem",
45+
"position": 3,
46+
"name": "Audio Injection",
47+
"item": "https://www.lambdatest.com/support/docs/audio-injection/"
48+
}]
49+
})
50+
}}
51+
></script>
52+
53+
54+
55+
# Audio Injection on iOS Real Devices
56+
57+
Audio Injection allows you to inject microphone input on real iOS devices in the LambdaTest Real Device Cloud.
58+
Use it to test audio-driven flows such as audio verification and in-app recording—without manual mic input.
59+
60+
## Key Use Cases
61+
- In-app audio recording
62+
- Audio-based verification/KYC flows
63+
64+
65+
66+
> This feature is currently in Beta. We are actively refining it based on real-world usage and feedback.
67+
---
68+
## Supported APIs & Devices
69+
- **API:** [AVAudioRecorder](https://developer.apple.com/documentation/avfaudio/avaudiorecorder)
70+
- **Supported Devices:** iOS **14 and above**
71+
72+
---
73+
74+
## Step 1: Upload Audio File
75+
**Supported formats:** `.mp3`, `.wav`
76+
**Max size:** 15 MB , 100 MB respectively
77+
78+
```bash
79+
curl -u "LT_USERNAME:LT_ACCESS_KEY" -X POST "https://api.lambdatest.com/mfs/v1.0/media/upload" -F "media_file=@/path/to/test.wav" -F "type=audio" -F "custom_id=SampleAudio"
80+
```
81+
82+
**Response**
83+
```json
84+
{
85+
"media_url": "lt://MEDIAID",
86+
"status": "success"
87+
}
88+
```
89+
90+
---
91+
92+
## Step 2: Enable Audio Injection via Capabilities
93+
94+
`media` can be set here or injected later in the test.
95+
96+
**Python**
97+
```python
98+
desired_caps = {
99+
"enableAudioInjection": True,
100+
"media": "lt://MEDIA123456789" # optional
101+
}
102+
```
103+
104+
---
105+
106+
## Step 3: Control Audio in Test
107+
Inject the uploaded audio file from LambdaTest into the recorder or app when you are at the dedicated space for microphone input.
108+
109+
**Inject / Replace File**
110+
```python
111+
driver.execute_script('lambda-audio: {"action":"inject","arguments":{"media_url":"lt://MEDIA123..."}}')
112+
```
113+
114+
**Start Audio**
115+
```python
116+
driver.execute_script('lambda-audio: {"action":"start"}')
117+
```
118+
119+
**Stop Audio**
120+
```python
121+
driver.execute_script('lambda-audio: {"action":"stop"}')
122+
```
123+
:::note
124+
The injected audio can come from a standalone audio file **or** from the audio track of a recorded video.
125+
:::
126+
---

sidebars.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2810,6 +2810,7 @@ module.exports = {
28102810
"camera-image-injection",
28112811
"video-injection",
28122812
"biometric-authentication",
2813+
"audio-injection",
28132814
"regular-expression-appium",
28142815
"appium-upload-media",
28152816
"app-auto-network-throttling",

0 commit comments

Comments
 (0)