Play Audio¶
The following steps start and stop audio playback on phones supporting intaQt Audio Services.
Start Audio Playback ¶
This step starts the playback of an audio file on a specific phone:
-
If the file is present on the configured Raspberry Pi Audio Service device, audio playback is started and the test case execution continues normally.
-
intaQt searches the configured Reference Directory. Once an audio file is located, it is uploaded to the Audio Service device, and playback starts.
-
If the file is not present on the Audio Service device, nor in the configured directory, an exception is thrown and the test case execution fails.
The audio playback lasts:
-
As long as the duration of the audio file or
-
Until it is explicitly stopped
If the looped
version of the step is used, the audio file is played in a loop until an explicit stop is issued or the playbackTimeout
is exceeded. Trying to start playback on a phone that is already playing an audio file leads to an error and the failure of the test case.
Syntax
1 2 3 | And start audio playback of <fileName String> on <phoneId Identifier> And start looped audio playback of <fileName String> on <phoneId Identifier> |
Parameters
-
fileName - The name of the audio file to be played, not including the
.wav
extension- The Quotation marks (
""
) around the name are not necessary
- The Quotation marks (
-
phoneId - The identifier of the phone that will start the audio playback
Example
1 2 | Given an Android phone as A And start audio playback of REF-1100 on A |
Stop Audio Playback ¶
This step stops the current audio playback on the specified phone. If there is no current audio playback on the specified phone, the execution of the step fails.
Syntax
1 | And stop audio playback on <phoneId Identifier> |
Parameter
- phoneId - The identifier assigned to the phone that will stop the audio playback
Example
1 2 3 4 5 | Given a phone as A And start audio playback of 3_6MB on A And wait for 10 seconds And stop audio playback on A |
The example test case above will first query the Audio Service device to see if the playback file 3_6MB
has already been uploaded. If not, it will attempt to upload it. If the upload fails or the file can not be found, an error occurs and test execution fails; otherwise the Audio Service playback will begin.
Example 1
1 2 3 | Given an Android phone as A And start audio playback of REF-800 on A And after 5 seconds, stop audio playback on A |
Example 2
1 2 3 | Given an Android phone as A And start looped audio playback of REF-1100 on A And after 180 seconds, stop audio playback on A |