From 5893141aa2bc5d568fc748bbb0a2487fb14f4d5e Mon Sep 17 00:00:00 2001 From: akshayverma Date: Thu, 14 Aug 2025 21:46:03 +0530 Subject: [PATCH 1/2] Audio Injection Beta --- docs/audio-injection.md | 126 ++++++++++++++++++++++++++++++++++++++++ sidebars.js | 1 + 2 files changed, 127 insertions(+) create mode 100644 docs/audio-injection.md diff --git a/docs/audio-injection.md b/docs/audio-injection.md new file mode 100644 index 000000000..7b378af1c --- /dev/null +++ b/docs/audio-injection.md @@ -0,0 +1,126 @@ +--- +id: audio-injection +title: Audio Injection on iOS Real Devices +sidebar_label: Video Injection +description: Inject audio content in your tests with LambdaTest to simulate microphone inputs for automated testing, enhancing your app's audio capabilities. + +keywords: + - audio injection + - app test automation + - microphone input + - voice commands + - audio recording + - lambdatest audio testing + - framework on lambdatest + - app testing appium + - app testing + - real devices +url: https://www.lambdatest.com/support/docs/audio-injection/ +site_name: LambdaTest +slug: audio-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'; + + + + + +# Audio Injection on iOS Real Devices + +Audio Injection allows you to inject microphone input on real iOS devices in the LambdaTest Real Device Cloud. +Use it to test audio-driven flows such as audio verification and in-app recording—without manual mic input. + +## Key Use Cases +- In-app audio recording +- Audio-based verification/KYC flows + + + +> This feature is currently in Beta. We are actively refining it based on real-world usage and feedback. +--- +## Supported APIs & Devices +- **API:** [AVAudioRecorder](https://developer.apple.com/documentation/avfaudio/avaudiorecorder) +- **Supported Devices:** iOS **14 and above** + +--- + +## Step 1: Upload Audio File +**Supported formats:** `.mp3`, `.wav` +**Max size:** 15 MB + +```bash +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" +``` + +**Response** +```json +{ + "media_url": "lt://MEDIAID", + "status": "success" +} +``` + +--- + +## Step 2: Enable Audio Injection via Capabilities + +`media` can be set here or injected later in the test. + +**Python** +```python +desired_caps = { + "enableAudioInjection": True, + "media": "lt://MEDIA123456789" # optional +} +``` + +--- + +## Step 3: Control Audio in Test +Inject the uploaded audio file from LambdaTest into the recorder or app when you are at the dedicated space for microphone input. + +**Inject / Replace File** +```python +driver.execute_script('lambda-audio: {"action":"inject","arguments":{"media_url":"lt://MEDIA123..."}}') +``` + +**Start Audio** +```python +driver.execute_script('lambda-audio: {"action":"start"}') +``` + +**Stop Audio** +```python +driver.execute_script('lambda-audio: {"action":"stop"}') +``` +:::note +The injected audio can come from a standalone audio file **or** from the audio track of a recorded video. +::: +--- diff --git a/sidebars.js b/sidebars.js index 7cd245c6a..f02930a11 100644 --- a/sidebars.js +++ b/sidebars.js @@ -2810,6 +2810,7 @@ module.exports = { "camera-image-injection", "video-injection", "biometric-authentication", + "audio-injection", "regular-expression-appium", "appium-upload-media", "app-auto-network-throttling", From 76d84f318daff2c3e60dac0b88b6ba722d4c0b3c Mon Sep 17 00:00:00 2001 From: akshayverma Date: Thu, 14 Aug 2025 21:51:48 +0530 Subject: [PATCH 2/2] additions --- docs/audio-injection.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/audio-injection.md b/docs/audio-injection.md index 7b378af1c..616e3580b 100644 --- a/docs/audio-injection.md +++ b/docs/audio-injection.md @@ -1,7 +1,7 @@ --- id: audio-injection title: Audio Injection on iOS Real Devices -sidebar_label: Video Injection +sidebar_label: Audio Injection description: Inject audio content in your tests with LambdaTest to simulate microphone inputs for automated testing, enhancing your app's audio capabilities. keywords: @@ -73,7 +73,7 @@ Use it to test audio-driven flows such as audio verification and in-app recordin ## Step 1: Upload Audio File **Supported formats:** `.mp3`, `.wav` -**Max size:** 15 MB +**Max size:** 15 MB , 100 MB respectively ```bash 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"