Is it possible to tell Amazon Echo (using SSML) to play an mp3 file from a specific offset?
How to play an mp3 file from an offset in Amazon Echo
2.8k views Asked by Ranjit Iyer AtThere are 2 answers
It is not possible to do this using the current APIs. As shown in the documentation for the SSML tag, there is only one possible attribute which can be set on this tag, which is src
. Note that there are also requirements and limitations to the source that can be specified:
src
: Specifies the URL for the MP3 file. Note the following requirements and limitations:
- The MP3 must be hosted at an Internet-accessible HTTPS endpoint. HTTPS is required, and the domain hosting the MP3 file must present a valid, trusted SSL certificate. Self-signed certificates cannot be used.
- The MP3 must not contain any customer-specific or other sensitive information.
- The MP3 must be a valid MP3 file (MPEG version 2).
- The audio file cannot be longer than ninety (90) seconds.
- The bit rate must be 48 kbps. Note that this bit rate gives a good result when used with spoken content, but is generally not a high enough quality for music. You may need to use converter software to convert your MP3 files to the required codec version (MPEG version 2) and bit rate (48 kbps). One option for this is FFmpeg.
It goes on to say this about using the audio tag:
Include the audio tag within your text-to-speech response within the speak tag. Alexa plays the MP3 at the specified point within the text to speech. For example:
<speak> Welcome to Car-Fu. <audio src="https://carfu.com/audio/carfu-welcome.mp3" /> You can order a ride, or request a fare estimate. Which will it be? </speak>
As described in this example, the given mp3 will simply be played in its entirety at the given point in the dialog, with no other configuration available. To accomplish the functionality you're desiring, you would need to dynamically create a new MP3 beginning at your desired timestamp, which complies with the requirements in the first block quote, and serve that file with your response.
I confirm, self-signed certificates cannot be used. I have my skill server accessible in a publicly available address with self-signed certificates. Now I need to ask Amazon to play my mp3 file stored in that same machine and it forces me to change the certificates. I used letsencrypt and it works fine