question

Skoopix avatar image
Skoopix asked ·

Creating Amazon Music Catalog - Details for Tracks

I'm an individual developer wanting to create a skill for playing my personal music collection. I've been studying the catalog reference and feel that there are some details missing that make it hard for me to understand how a catalog will be used. I'm assuming, though i could be wrong, that once i upload my catalog objects (Albums, Artists, Playlists, and Tracks), i will be able to program the skill to stream songs from my personal server. Since Tracks seems to be the lowest level for a song, it would seem that the track needs to have a link to the location of the song/file. Please see the section in the following link:

https://developer.amazon.com/docs/music-skills/catalog-reference.html#track-catalog-example

This includes artist and song, but there is no mention of any url. On the other hand, the link below shows the response of a skill request and it has a url for the mp3. I don’t understand how a skill can generate a response with an mp3 url if there is not a way to put the mp3 url in the catalog.

https://developer.amazon.com/docs/music-skills/api-getview.html#example-getview-response

Would you please explain how a catalog will reference an actual file and provide any example code that could be helpful. I may be completely off on how i am looking at this, so if there is some documentation you can suggest i read that would help me understand precisely how an Alexa skill will know what sound file to play, i would very much appreciate it.

music skill api
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

newuser-23e2c11f-1bbf-4747-b182-811e834e20fc avatar image
newuser-23e2c11f-1bbf-4747-b182-811e834e20fc answered ·

Hi - You return the mp3 url in response to the Initiate request. I recommend focusing on the GetPlayableContent and Initiate APIs to get started, and add support for other APIs once basic playback is working for your skill.

The docs for these APIs include example responses.

https://developer.amazon.com/docs/music-skills/api-getplayablecontent.html

https://developer.amazon.com/docs/music-skills/api-initiate.html

Here is an extremely simplistic "getting started" template (node.js) for a music skill lambda.

// very simple lambda template 
exports.handler=(event, context, callback)=>{ 
        console.log(JSON.stringify(event));
        var jsonStr=null;
        if(event.header !== undefined && event.header.name=="GetPlayableContent") {
            jsonStr=`{ form your response to GetPlayableContent here }`;
            }
        else if(event.header !== undefined && event.header.name=="Initiate"){
            jsonStr=`{ form your response to Initiate here }`;
            }
    callback(null, JSON.parse(jsonStr));
    };

Hope this helps!

10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.