AVS Device SDK Optional Features

This page provides extra information to help you implement optional AVS features 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.

Alerts

To enable Alerts, you must follow these instructions.

  1. Install SQLite.
  2. Set your device system clock to UTC time. To set UTC time, use Network Time Protocol (NTP).
  3. Install a file system.

Apple Music

Streaming from Apple Music isn't enabled by default. To enable Apple Music, use the following instructions.

Ubuntu / Linux / Raspberry Pi

To enable Apple Music on Unix/Linux systems

  1. Install the required dependencies with the following command.

     sudo apt install libavcodec-dev libavformat-dev libavutil-dev ffmpeg
    
  2. Add the following CMake flags to your build command.

     -DENABLE_SAMPLE_AES=ON
     -DFFMPEG_INCLUDE_DIR=<path to ffmpeg include>
     -DFFMPEG_LIB_PATH=<path to ffmpeg lib>
    
  3. Link the Apple Music account that you are using to the Alexa account that's registered to the SDK through the Apple Music Skill on the companion app.

Example CMake command for Ubuntu/Linux

cmake \
-DGSTREAMER_MEDIA_PLAYER=ON \
-DENABLE_SAMPLE_AES=ON \
-DPORTAUDIO=ON \
-DPORTAUDIO_LIB_PATH=$PORTAUDIO/lib/.libs/libportaudio.a \
-DPORTAUDIO_INCLUDE_DIR=$PORTAUDIO/include \
-DCMAKE_BUILD_TYPE=DEBUG \
-DENABLE_ALL_ENDPOINT_CONTROLLERS=ON \
-DFFMPEG_INCLUDE_DIR=/usr/include/x86_64-linux-gnu/ \
-DFFMPEG_LIB_PATH=/usr/lib/x86_64-linux-gnu
-DCURL_LIBRARY=/usr/local/opt/curl-openssl/lib/libcurl.dylib \
-DCURL_INCLUDE_DIR=/usr/local/opt/curl-openssl/include

Example CMake command for Raspberry Pi

cmake \
-DGSTREAMER_MEDIA_PLAYER=ON \
-DENABLE_SAMPLE_AES=ON \
-DPORTAUDIO=ON \
-DPORTAUDIO_LIB_PATH=$PORTAUDIO/lib/.libs/libportaudio.a \
-DPORTAUDIO_INCLUDE_DIR=$PORTAUDIO/include \
-DCMAKE_BUILD_TYPE=DEBUG \
-DENABLE_ALL_ENDPOINT_CONTROLLERS=ON \
-DFFMPEG_INCLUDE_DIR=/usr/include/arm-linux-gnueabihf / \
-DFFMPEG_LIB_PATH=/usr/lib/arm-linux-gnueabihf \
-DCURL_LIBRARY=/usr/local/opt/curl-openssl/lib/libcurl.dylib \
-DCURL_INCLUDE_DIR=/usr/local/opt/curl-openssl/include

macOS

To enable Apple Music on macOS

  1. Install the required dependencies with the following command.

     brew install ffmpeg
    
  2. Add the following CMake flags to your build command.

     -DENABLE_SAMPLE_AES=ON
     -DFFMPEG_INCLUDE_DIR=<path to ffmpeg include>
     -DFFMPEG_LIB_PATH=<path to ffmpeg lib>
    
  3. Link the Apple Music account that you are using to the Alexa account that's registered to the SDK through the Apple Music Skill on the companion app.

Example CMake command for macOs

cmake
-DGSTREAMER_MEDIA_PLAYER=ON \
-DENABLE_SAMPLE_AES=ON \
-DPORTAUDIO=ON \
-DPORTAUDIO_LIB_PATH=$PORTAUDIO/lib/.libs/libportaudio.a \
-DPORTAUDIO_INCLUDE_DIR=$PORTAUDIO/include \
-DCMAKE_BUILD_TYPE=DEBUG \ -DENABLE_ALL_ENDPOINT_CONTROLLERS=ON \
-DFFMPEG_INCLUDE_DIR=/usr/local/Cellar/ffmpeg/4.3_1/include/ \
-DFFMPEG_LIB_PATH=/usr/local/Cellar/ffmpeg/4.3_1/lib
-DCURL_LIBRARY=/usr/local/opt/curl-openssl/lib/libcurl.dylib \
-DCURL_INCLUDE_DIR=/usr/local/opt/curl-openssl/include

Windows

To enable Apple Music on Windows

  1. Install the required dependencies with the following command.

     pacman -S --noconfirm --needed  mingw-w64-x86_64-ffmpeg
    
  2. Change the mingw.sh file you use to build and install on Windows by adding the following CMake flags after line 23.

     -DENABLE_SAMPLE_AES=ON
     -DFFMPEG_INCLUDE_DIR=/mingw64/include \
     -DFFMPEG_LIB_PATH=/mingw64/lib \
    
  3. Link the Apple Music account that you are using to the Alexa account that's registered to the SDK through the Apple Music Skill on the companion app.

Example CMake command for Windows

  CMAKE_PLATFORM_SPECIFIC=(-G 'MSYS Makefiles' -Dgtest_disable_pthreads=ON \
  -DENABLE_SAMPLE_AES=ON \
  -DFFMPEG_INCLUDE_DIR=/mingw64/include \
  -DFFMPEG_LIB_PATH=/mingw64/lib \
  -DGSTREAMER_MEDIA_PLAYER=ON -DPORTAUDIO=ON \
  -DPORTAUDIO_LIB_PATH="$THIRD_PARTY_PATH/portaudio/lib/.libs/libportaudio.$LIB_SUFFIX" \
  -DPORTAUDIO_INCLUDE_DIR="$THIRD_PARTY_PATH/portaudio/include")

Bluetooth

Building with Bluetooth is optional and is supported on Linux or Raspberry Pi.

Captions

The Alexa Voice Service (AVS) Device SDK 1.17 adds support for captions.

In the SDK, it's disabled by default. You enable through the CMake build option CAPTIONS=ON. You must also install a new dependency – the libwebvtt parsing library. Webvtt is a C/C++ library for interpreting and authoring WebVTT content. WebVTT is a caption and subtitle format designed for use with HTML5 audio and video elements.

By default, captions works with the en-US locale. If you want to support another locale, you must modify the line break logic in the CaptionManager::onParsed() method and use a locale-safe method for determining the break points between words. For example, you can use the ICU BreakIterator to handle the task. The exact method of this implementation is determined by you.

To enable captions to your device

  1. Download and install libwebvtt to a directory of your choice. If there are any additional instructions provided for your OS on the libwebvtt page, make sure you follow them.
  2. Build the AVS Device SDK and configure your CMake command with the following flags

     -DCAPTIONS=ON \
     -DLIBWEBVTT_LIB_PATH=$HOME/captions/webvtt-master/build/src/webvtt/libwebvtt.a \
     -DLIBWEBVTT_INCLUDE_DIR=$HOME/captions/webvtt-master/include
    

Custom media player

For more details about enabling a custom media player, see Media Players.

Endpoints

For more details about enabling endpoints, see Smart Home Endpoints.

SAMPLE-AES decryption

SAMPLE-AES decryption is optional.

To enable SAMPLE-AES decryption for audio streamed to your device

  1. Install the FFMPEG library.
  2. Enable SAMPLE-AES decryption with the following CMake command.

     cmake [absolute path to source] -DENABLE_SAMPLE_AES[ON|OFF]     
                                     -DFFMPEG_LIB_PATH=[absolute path to ffmpeg library]
                                     -DFFMPEG_INCLUDE_DIR=[absolute path to ffmpeg include directory]