Simplest example for streaming audio with Alexa

后端 未结 3 1850
夕颜
夕颜 2021-01-01 23:26

I\'m trying to get the new streaming audio API going. Is the following response valid? I\'m getting a \"there was a problem with the skill\" error when I test it on my devic

3条回答
  •  清酒与你
    2021-01-01 23:58

    The following code worked for me:

    def lambda_handler(event, context):
        return {
            "response": {
                "directives": [
                    {
                        "type": "AudioPlayer.Play",
                        "playBehavior": "REPLACE_ALL",
                        "audioItem": {
                            "stream": {
                                "token": "12345",
                                "url": "https://emit-media-production.s3.amazonaws.com/pbs/the-afterglow/2016/08/24/1700/201608241700_the-afterglow_64.m4a",
                                "offsetInMilliseconds": 0
                            }
                        }
                    }
                ],
                "shouldEndSession": True
            }
        }
    ]
    

    The only difference is that the URL is https rather than http.

    Don't be put off if it doesn't work in the skill simulator. That hasn't been upgraded yet to work with streaming audio. You won't even see your directives there. But it should work when used with your device.

提交回复
热议问题