AVS Device SDK Custom Media Player


This page provides information required to implement and use a custom media player with the Alexa Voice Service (AVS) Device SDK. For code samples and full implementation details, see the AVS Device SDK on GitHub or the AVS Device SDK API references.

Support a custom media player

To support a custom media player, you use the following ApplicationMediaInterfaces classes to encapsulate the media player, speaker, equalizer, and shutdown fields.

Enable a custom media player

In the SDK, custom media players are disabled by default. You enable a custom media player by using the CMake build option CUSTOM_MEDIA_PLAYER=ON.

For example:

To build the GStreamer based MediaPlayer, run the following command

cmake <path-to-source> -DGSTREAMER_MEDIA_PLAYER=ON

To build with a custom media player, run the following command

cmake <path-to-source> -DCUSTOM_MEDIA_PLAYER=ON

Here is an example of a full CMake command with the custom media player enabled. Note that the GSTREAMER_MEDIA_PLAYER and the CUSTOM_MEDIA_PLAYER commands are mutually exclusive. Don't include a GSTREAMER_MEDIA_PLAYER= flag if you use a CUSTOM_MEDIA_PLAYER flag.

cmake $HOME/my_project/source/avs-device-sdk \
-DCUSTOM_MEDIA_PLAYER=ON \
-DPORTAUDIO=ON \
-DPORTAUDIO_LIB_PATH=$HOME/my_project/third-party/portaudio/lib/.libs/libportaudio.a \
-DPORTAUDIO_INCLUDE_DIR=$HOME/my_project/third-party/portaudio/include \
-DCMAKE_BUILD_TYPE=DEBUG \
-DEXTENSION_PATH=<Path to custom media player>

Implementation details

Each custom media player must declare their own dependencies in its own module. You can add these options to your top-level CMake build and the options filter down to your custom media player.

A custom media player should define a CMakeLists.txt file in the EXTENSION_PATH location with a variable called CUSTOM_MEDIA_PLAYER_TARGETS. This variable defines the CMake targets to link against.


Was this page helpful?

Last updated: Sep 28, 2021