Alexa オーサリング ツールを使用してスライド ショー (2 ~ 3 枚の画像) を作成しようとしています。画像 A から画像 B に切り替えるには、CI は画面に触れて左右にスワイプする必要があります。これを自動的に実現し、一定時間内にアレクサに画像を切り替えさせたいのですが、これはAPL autopageを使用して達成できるようですが、何らかの理由でこれが機能していません
私がしたこと
- APL ページャーを使用して APL を設定する
- 自動ページを APL ドキュメントに追加しました
- コンポーネント ID
- 間隔
- 遅れ
シミュレーションを試行し、エコー ショー 5 で直接実行した後も、ディスプレイがタッチされたときにのみトリガーされます。
また試しました:
- alexa のハンドラーに標準コマンド (自動ページャー) を直接追加しますが、応答は同じです。
いくつかの疑問
コマンドをAPLdocument.json [1]ファイルに配置するか、.addDirective [2]を呼び出すときにハンドラーに直接配置するかは問題ですか..コンテンツまたは期間を動的にしたい場合に表示される唯一の違いは、配置する必要があることですバックエンドコード(index.js)に直接入れますよね?
[1]
{
"type": "APL",
"version": "1.4",
"settings": {},
"theme": "light",
"import": [],
"resources": [],
"styles": {},
"onMount": [],
"graphics": {},
"commands": [
{
"type": "AutoPage",
"componentId": "fisrtpager",
"duration": 1000,
"delay": 500
}
],
[2]
handlerInput.responseBuilder.addDirective({
type: 'Alexa.Presentation.APL.RenderDocument',
token:'arrugas',
document: physiolift,
commands: [{
"type": "AutoPage",
"componentId": "fisrtpager",
"duration": 1000,
"delay": 500
}]
});
}
期待アウトプット
Alexa (echo show 5) を使用して、カルーセルのように一連の画像を表示します (画面に触れる必要はありません)。
私のコード
APL ドキュメント
{
"type":"APL",
"version":"1.4",
"settings":{
},
"theme":"light",
"import":[
],
"resources":[
],
"styles":{
},
"onMount":[
],
"graphics":{
},
"commands":[
{
"type":"AutoPage",
"componentId":"fisrtpager",
"duration":1000,
"delay":500
}
],
"layouts":{
},
"mainTemplate":{
"parameters":[
"payload"
],
"items":[
{
"type":"Pager",
"id":"fisrtpager",
"width":"100%",
"height":"100%",
"items":[
{
"type":"Image",
"width":"100%",
"height":"100%",
"scale":"best-fill",
"source":"https://dyl80ryjxr1ke.cloudfront.net/external_assets/hero_examples/hair_beach_v1785392215/original.jpeg",
"align":"center"
},
{
"type":"Image",
"width":"100%",
"height":"100%",
"source":"https://interactive-examples.mdn.mozilla.net/media/cc0-images/grapefruit-slice-332-332.jpg",
"scale":"best-fill"
},
{
"type":"Text",
"text":"Just text content shown on page #3",
"textAlign":"center"
}
],
"navigation":"wrap"
}
]
}
}
index.js
// somewhere inside the intent im invoking
if (Alexa.getSupportedInterfaces(handlerInput.requestEnvelope)['Alexa.Presentation.APL']) {
// Create Render Directive.
handlerInput.responseBuilder.addDirective({
type: 'Alexa.Presentation.APL.RenderDocument',
token:'arrugas',
document: require('./documents/ImageTest.json')
});
}
speakOutput += ' just saying somthing'
return handlerInput.responseBuilder
.speak(speakOutput)
.reprompt('just saying something else')
.getResponse();