# Audio player

**Detailed Description**

This section contains audio player APIs.

- *group* Telematics\_audio\_player

    - Enums

- enum RepeatType

    - Defines whether to play or skip this file.

*Values:*

- enumerator COUNT

    - Play the file for given number of times

- enumerator INDEFINITELY

    - Play the file indefinitely

- enumerator SKIP

    - Do not play the file

- struct RepeatInfo

    - Defines number of times a file should be played.

Public Members

- [RepeatType](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux5audio10RepeatTypeE) type

    - Please refer [RepeatType](https://docs.qualcomm.com/doc/80-PF458-10/topic/enum_a00031_1ga0ba8e3340900f127bb709e7cb05a6f95.html#a00031_1ga0ba8e3340900f127bb709e7cb05a6f95) for details

- uint32\_t count

    - When using RepeatType::COUNT, defines number of times a file should be played

- struct PlaybackConfig

    - Specifies files to play and how to play.

Public Members

- std::string absoluteFilePath

    - Absolute path of the audio file. Supports playback of audio files with the following standard header lengths:

1. AudioFormat::PCM\_16BIT\_SIGNED: Raw PCM files with no header or PCM files which follow RIFF format

    - Only RIFF WAVE files containing a single, continuous data chunk are supported.
    - Fragmented or multiple data chunks are not supported.
    - In RIFF WAVE files, only chunks that adhere to the standard RIFF chunk structure are supported. This includes structures such as the LIST/INFO chunk, which adhere to the standard RIFF format of a 4-byte data, that is associated with the chunk.
2. AudioFormat::AMRWB\_PLUS: 2 bytes (ETSI TS 126 290 V8.0.0 (2009-01) section 8.3)
3. AudioFormat::AMRWB: 9 bytes (RFC4867)
4. AudioFormat::AMRNB: 6 bytes (RFC4867)

- [RepeatInfo](https://docs.qualcomm.com/doc/80-PF458-10/topic/struct_a00273.html#_CPPv4N5telux5audio10RepeatInfoE) repeatInfo

    - Defines how a file should be played

- [StreamConfig](https://docs.qualcomm.com/doc/80-PF458-10/topic/struct_a00252.html#_CPPv4N5telux5audio12StreamConfigE) streamConfig

    - Defines how an audio stream should be configured to play this file

- class IPlayListListener

    - Receives status of the playback.

Public Functions

- inline virtual void onPlaybackStarted()

    - Invoked when playback is started as a response to explicitly calling [IAudioPlayer::startPlayback()](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#a00276_1a79b5ca8524d79efce5dbab88860320b2).

- inline virtual void onPlaybackStopped()

    - Invoked whenever playback is stopped as a response to explicitly calling [IAudioPlayer::stopPlayback()](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#a00276_1a98ace86ae12c1ba5c121fb087fd14141) or when playback is stopped due to an error for example audio can not be played or volume/mute can not be set.

This API will not be invoked if all the files in the playback list are successfully played to completion. In such a scenario, [onPlaybackFinished](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#a00275_1af14978c684e99b3cb7eb894ef1c2f3a9) will be invoked on completion.

- inline virtual void onError([telux](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[common](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6commonE)::[ErrorCode](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6common9ErrorCodeE) error, std::string file)

    - Invoked whenever an error occurs.

- Parameters:

    - - **error** – **[in]** Appropriate error code [telux::common::ErrorCode](https://docs.qualcomm.com/doc/80-PF458-10/topic/enum_a00023_1ga84acdb74b7d34616b1ca497c7369810d.html#a00023_1ga84acdb74b7d34616b1ca497c7369810d)
- **file** – **[in]** File which was getting played when this error occurred. It can be empty if an error occurred before opening any file.

- inline virtual void onFilePlayed(std::string file)

    - Invoked whenever each file has been played from the playlist. If a file is played repeatedly, it will be called that many times. If a file is played indefinitely, it is called every time file is played completely. If an error occurs or playback is stopped, this callback is not called.

- Parameters:

    - **file** – **[in]** File played successfully

- inline virtual void onPlaybackFinished()

    - Invoked to confirm all files have been played gracefully as specified by [IAudioPlayer::startPlayback()](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#a00276_1a79b5ca8524d79efce5dbab88860320b2).

- inline virtual ~IPlayListListener()

    - Destructor of [IPlayListListener](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#a00275).

- class IAudioPlayer

    - [IAudioPlayer](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#a00276) manages playback of a playlist of audio files. The playlist could contain one or more files. Clients can also specify how many times the file should be played, in case repetition is required.

Public Functions

- virtual [telux](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[common](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6commonE)::[ErrorCode](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6common9ErrorCodeE) startPlayback(std::vector&lt;[PlaybackConfig](https://docs.qualcomm.com/doc/80-PF458-10/topic/struct_a00274.html#_CPPv4N5telux5audio14PlaybackConfigE)&gt; &playbackConfigs, std::weak\_ptr&lt;[IPlayListListener](https://docs.qualcomm.com/doc/80-PF458-10/topic/class_a00275.html#_CPPv4N5telux5audio17IPlayListListenerE)&gt; statusListener) = 0

    - Plays audio files in the manner as specified by the `playbackConfigs`. Files can have same or different audio format. Multiple files can be specified in one call to this method.

On platforms with access control enabled, the caller must have TELUX\_AUDIO\_PLAY, permission to invoke this method successfully.

Note

Eval: This is a new API and is being evaluated. It is subject to change and could break backwards compatibility.

- Parameters:

    - - **playbackConfigs** – **[in]** List of files to play and the manner in which to play
- **statusListener** – **[in]** Receives various status updates in [IPlayListListener](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#a00275)

- Returns:

    - telux::common::ErrorCode::SUCCESS, if the playback is started, telux::common::ErrorCode::ACCESS\_DENIED, if the caller doesn’t have permission to call this API, telux::common::ErrorCode::INVALID\_STATE, if a playback is already in progress, telux::common::ErrorCode::INVALID\_ARGUMENTS, if no files are given, an appropriate error code in all other cases.

- virtual [telux](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[common](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6commonE)::[ErrorCode](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6common9ErrorCodeE) stopPlayback() = 0

    - Stops the playback started with [startPlayback()](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#a00276_1a79b5ca8524d79efce5dbab88860320b2).

If the file is configured with RepeatType::COUNT, there is no need to call this method as playback will stop automatically after file has been played successfully. However, client can call this method anytime to stop playback explicitly.

If the file is configured with RepeatType::INDEFINITELY, calling this method is the only way to stop playback.

On platforms with access control enabled, the caller must have TELUX\_AUDIO\_PLAY, permission to invoke this method successfully.

Note

Eval: This is a new API and is being evaluated. It is subject to change and could break backwards compatibility.

- Returns:

    - telux::common::ErrorCode::SUCCESS, if the playback is stopped, telux::common::ErrorCode::INVALID\_STATE, if there is no playback in-progress, telux::common::ErrorCode::ACCESS\_DENIED, if the caller doesn’t have permission to call this API, an appropriate error code in all other cases.

- virtual [telux](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[common](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6commonE)::[ErrorCode](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6common9ErrorCodeE) setVolume(float volumeLevel) = 0

    - Sets the volume level of the audio stream.

- Parameters:

    - **volumeLevel** – **[in]** Specifies the volume level (0.0 to 1.0) to set

- Returns:

    - telux::common::ErrorCode::SUCCESS if the given volume is set, otherwise, an appropriate error code.

- virtual [telux](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[common](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6commonE)::[ErrorCode](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6common9ErrorCodeE) getVolume(float &volumeLevel) = 0

    - Retrieves the current volume level of the audio stream.

- Parameters:

    - **volumeLevel, Current** – **[out]** volume level (0.0 to 1.0)

- Returns:

    - telux::common::ErrorCode::SUCCESS if the volume is retrieved, otherwise, an appropriate error code.

- virtual [telux](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[common](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6commonE)::[ErrorCode](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6common9ErrorCodeE) setMute(bool enable) = 0

    - Mutes or unmutes the audio.

- Parameters:

    - **enable** – **[in]** True to mute the audio, false to unmute the audio

- Returns:

    - telux::common::ErrorCode::SUCCESS if the playback is muted/unmuted as specified otherwise, an appropriate error code.

- virtual [telux](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[common](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6commonE)::[ErrorCode](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6common9ErrorCodeE) getMute(bool &enable) = 0

    - Retrieves the current mute state of the audio stream.

- Parameters:

    - **enable** – **[out]** True if the audio is muted currently otherwise false

- Returns:

    - telux::common::ErrorCode::SUCCESS if the mute state is retrieved, otherwise, an appropriate error code.

- virtual [telux](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[common](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6commonE)::[ErrorCode](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6common9ErrorCodeE) setDevice(std::vector&lt;[DeviceType](https://docs.qualcomm.com/doc/80-PF458-10/topic/enum_a00001_1ga8f8ad92263d7024623b1c50df54582dc.html#_CPPv4N5telux5audio10DeviceTypeE)&gt; devices) = 0

    - Associates the given audio devices with the audio stream.

- Parameters:

    - **devices** – **[in]** List of the audio devices

- Returns:

    - telux::common::ErrorCode::SUCCESS if the device is set, otherwise, an appropriate error code.

- virtual [telux](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv45telux)::[common](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6commonE)::[ErrorCode](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#_CPPv4N5telux6common9ErrorCodeE) getDevice(std::vector&lt;[DeviceType](https://docs.qualcomm.com/doc/80-PF458-10/topic/enum_a00001_1ga8f8ad92263d7024623b1c50df54582dc.html#_CPPv4N5telux5audio10DeviceTypeE)&gt; &devices) = 0

    - Retrieves list of the audio devices associated with the audio stream.

- Parameters:

    - **devices** – **[out]** List of the audio devices

- Returns:

    - telux::common::ErrorCode::SUCCESS if the list is retrieved, otherwise, an appropriate error code.

- inline virtual ~IAudioPlayer()

    - Destructor of the [IAudioPlayer](https://docs.qualcomm.com/doc/80-PF458-10/topic/common.html#a00276).

Last Published: Mar 31, 2026

[Previous Topic
telux::audio::ITranscoder](https://docs.qualcomm.com/bundle/publicresource/80-PF458-10/topics/transcoder.md) [Next Topic
AudioFactory](https://docs.qualcomm.com/bundle/publicresource/80-PF458-10/topics/audio_factory.md)