Legacy | Inject audio
-
Command: audio
-
Subcommand: inject
-
Supported Platforms: Native (legacy), UFT (legacy), Selenium, Appium
All commands must be executed using the same framework. Sharing the execution ID between different frameworks is not possible. This means that if you work with a Selenium/Appium driver, you need to call the commands using the Selenium/Appium driver (or, in the case of Reporting commands, through the Reporting SDK that works with the driver) and not as part of a UFT test or another framework.
-
Supported OS: Android, iOS
Description
Plays an audio file into the device audio-in. Supported file types: MP3 and WAV. When using the Text to Speech command with audio injection, the audio file should be in the .wav format.
When selecting Wait, the audio file cannot exceed 4 minutes. For audio files longer than 4 minutes, select No wait and follow with a Wait command.
The quality of sound (sample rate) needs to be 16000 Hz or above.
Limitations
Audio injection is not supported on devices with a USB-C port.
In addition, for calls, audio injection is not supported on devices running iOS 17 or later.
For calls, audio injection can also be supported through Bluetooth. This implementation is only available in hybrid clouds and only to select customers. For more information, see Bluetooth audio connectivity.
If your application allows voice control or dictation without the option to select the source of the audio input, install the .ipa
file with sensor instrumentation enabled. This automatically moves the audio source from the built-in microphone to the connected audio cable (handset mic).
Parameters
Name | Value | Default | Description |
---|---|---|---|
deviceId* | The device for this command. | ||
key* | |||
wait |
nowait (No wait) wait (Wait) |
No wait |
The execution mode. No wait - continue to the next line in the script immediately Wait - wait for the audio file to complete before continuing to the next line in the script |
* Mandatory
Request & Response
Request
https://mycloud.perfectomobile.com/services/executions/john@perfectomobile.com_controller_16-11-10_12_43_16_28?operation=command&securityToken=<your_token>&command=audio&subcommand=inject¶m.deviceId=HT5BAJT00574¶m.key=PUBLIC:SampleAudio_0.7mb.mp3
JSON response
{
"executionId":"john@perfectomobile.com_controller_16-11-10_12_43_16_28",
"reason":"Success",
"timer.elapsed":"5742",
"testGridReportUrl":"https://mycloud.reporting-01.perfectomobile.com?externalId[0]=john@perfectomobile.com_controller_16-11-10_12_43_16_28",
"timer.ux":"5733",
"singleTestReportUrl":"https://mycloud.perfectomobile.com/nexperience/singletest/report/?reportRepositoryKey=PRIVATE:controller/161110/controller_16-11-10_12_43_16_28.xml&ownerId=john@perfectomobile.com&sharingCode=4b5a4717-6e56-45e2-868e-8ee64285468b",
"description":"Success",
"timer.system":"9",
"reportKey":"PRIVATE:controller/161110/controller_16-11-10_12_43_16_28.xml",
"completed":"true",
"flowEndCode":"SUCCEEDED",
"timer.device":"5733"}