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.

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: PRIVATE:dir1/dir2/name.mp3

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

Copy

Java samples

 Map<String, Object> params = new HashMap<>();
 params.put("key", "PUBLIC:InjectionApps/promptTts.wav");
 Object res = driver.executeScript("mobile:audio:inject", params)
Copy

C# sample

Dictionary<String, Object> pars = new Dictionary<String, Object>();
pars.Add("key", "PUBLIC:InjectionApps/promptTts.wav");
driver.ExecuteScript("mobile:audio:inject", pars);