Skip to main content

Audio Recording

Description

To record audio, use startAudioRecording. To stop recording, use stopAudioRecording.

Audio recording automatically stops if the test run completes even if stopAudioRecording is not called.

startAudioRecording  Parameter

NameValueDescription
Audio FileStringRequired. Full path to local Audio file (Appium Grid only)







In Appium Server (Appium Open Source) the unique file name can be provided in this format:



cloud:file_unique_name



For more information, see Using the File Repository.

stopAudioRecording does not need a parameter.

Usage

The audio is recorded inline from the device to a file. The recorded files are saved in *.wav or  *.flac formats, according to your preference.

Use sleep if needed to wait until performing the next command. For more information, see sleep.

info

Replace <server> with the appropriate URL.

Audio Recording - Using file repository

// File with unique name my_audio_recording must NOT exist in file repository
driver.executeScript("seetest:client.startAudioRecording", "cloud:my_audio_recording");
// Commands that play audio on device
driver.executeScript("seetest:client.stopAudioRecording");
// Download file with unique name my_audio_recording from file repository using Rest API

startAudioRecording

DesiredCapabilities dc = new DesiredCapabilities();
driver = new AndroidDriver(new URL("<server>"), dc);
seetest = new SeeTestClient(driver);
dc.setCapability(MobileCapabilityType.UDID, "deviceid");

...
...
// Records the Audio file
seetest.startAudioRecording("C:\\AudioFilesToPlay\\OpeningWaze.wav");
seetest.stopAudioRecording();