Inject Audio (FR)
Perfecto Command
mobile:audio:inject
Purpose
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 | Type | Possible Values | Description |
---|---|---|---|
key | Multimedia |
|
(Required) The full repository path, including directory and file name, where to locate the audio file. Example: Click browse and navigate to the file. The file must first be uploaded to the Perfecto Repository. To view or modify your private repository, see Manage the repository. |
wait | String | nowait | wait |
The execution mode. No wait: (Default) 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 |
Return Value
None
Exceptions
None
Examples
Java samples
Map<String, Object> params = new HashMap<>();
params.put("key", "PUBLIC:InjectionApps/promptTts.wav");
Object res = driver.executeScript("mobile:audio:inject", params);
C# sample
Dictionary<String, Object> pars = new Dictionary<String, Object>();
pars.Add("key", "PUBLIC:InjectionApps/promptTts.wav");
driver.ExecuteScript("mobile:audio:inject", pars);