我正在开发一个用于音频流的应用程序。如果我说 alexa 为这位艺术家播放歌曲,则 alexa 正在播放所有歌曲。但不是在听之间切换到另一个艺术家。Alexa 正在为该艺术家完成所有歌曲,然后停止,然后我需要再次启动该应用程序以收听另一位艺术家的歌曲。我如何在歌曲之间呼叫另一位艺术家?
这是我第一首歌的编码
$speech = "playing songs of $artistName";
$card = '"card": {
"type": "Simple",
"title": "Play Audio",
"content": ""
}';
$response = '{
"version" : "1.0",
"response" : {
"outputSpeech": {
"type": "PlainText",
"text": "'.$speech.'"
},
'.$card.',
"directives": [
{
"type": "AudioPlayer.Play",
"playBehavior": "REPLACE_ALL",
"audioItem": {
"stream": {
"token": "FirstSong",
"url": "myUrl",
"offsetInMilliseconds": 0
}
}
}
],
"shouldEndSession" : true
}
}';
echo $response;
然后通过将 playBehaviour 替换为 ENQUEUE 来添加音频。歌曲正在添加,每首歌都可以正常播放,但在任何时候,如果我说与我的应用程序相关的任何命令.. alexa 没有响应,实际上就像退出我的应用程序一样,因为我必须启动应用程序再次播放歌曲以使 Alexa 与我的应用程序一起工作。