Last active
November 25, 2020 16:08
-
-
Save arunjeetsingh/999e966b5e83b91d5bbe6d8ffbf8aba6 to your computer and use it in GitHub Desktop.
An example of a skill response that plays some preamble speech and then pages through slides in a pager one at a time while synchronizing speech to the content of each slide. Could be used to tell a story with voice/sound effects, describe a set of pictures, or even a weather forecast accompanied by multiple visuals.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"directives": [{ | |
"type": "Alexa.Presentation.APL.RenderDocument", | |
"document": { | |
"type": "APL", | |
"version": "1.5", | |
"onMount": [ | |
{ | |
"type": "Sequential", | |
"commands": [ | |
{ | |
"type": "SpeakItem", | |
"componentId": "cardSlideshowContainer" | |
}, | |
{ | |
"type": "SpeakItem", | |
"componentId": "One" | |
}, | |
{ | |
"type": "SetPage", | |
"componentId": "cardSlideshow", | |
"position": "relative", | |
"delay": 1000, | |
"value": 1 | |
}, | |
{ | |
"type": "SpeakItem", | |
"componentId": "Two" | |
}, | |
{ | |
"type": "SetPage", | |
"componentId": "cardSlideshow", | |
"position": "relative", | |
"delay": 1000, | |
"value": 1 | |
}, | |
{ | |
"type": "SpeakItem", | |
"componentId": "Three" | |
} | |
] | |
} | |
], | |
"mainTemplate": { | |
"parameters": [ | |
"card" | |
], | |
"item": { | |
"type": "Container", | |
"id": "cardSlideshowContainer", | |
"width": "100%", | |
"height": "100%", | |
"speech": "${card.properties.preambleSpeech}", | |
"items": [{ | |
"type": "Pager", | |
"navigation": "wrap", | |
"id": "cardSlideshow", | |
"numbered": true, | |
"height": "100%", | |
"width": "100%", | |
"data": "${card.properties.pagerData}", | |
"items": { | |
"type": "Container", | |
"direction": "row", | |
"id": "slideContainer", | |
"shrink": 0, | |
"width": "100%", | |
"height": "100%", | |
"alignItems": "center", | |
"items": [{ | |
"type": "Image", | |
"source": "${data.backgroundImage}", | |
"position": "absolute", | |
"overlayColor": "#40000000", | |
"width": "100%", | |
"height": "100%", | |
"scale": "best-fill" | |
}, | |
{ | |
"type": "Text", | |
"id": "${data.id}", | |
"text": "${data.text}", | |
"speech": "${data.textSpeech}", | |
"color": "#ffffff", | |
"width": "100%", | |
"fontSize": 60, | |
"textAlign": "center", | |
"fontWeight": "100", | |
"paddingLeft": 10, | |
"paddingRight": 10 | |
} | |
] | |
} | |
}] | |
} | |
} | |
}, | |
"datasources": { | |
"card": { | |
"type": "object", | |
"properties": { | |
"pagerData": [ | |
{ | |
"text": "One", | |
"id": "One", | |
"pageText": "<speak>This is slide one.</speak>", | |
"backgroundImage": "https://m.media-amazon.com/images/G/01/alexa-blueprints/backgrounds/greeting-cards/birthday_balloons._CB1533933823_.png" | |
}, | |
{ | |
"text": "Two", | |
"id": "Two", | |
"pageText": "<speak>This is slide two.</speak>", | |
"backgroundImage": "https://m.media-amazon.com/images/G/01/alexa-blueprints/backgrounds/greeting-cards/pattern_balloons_01._CB471614930_.png" | |
}, | |
{ | |
"text": "Three", | |
"id": "Three", | |
"pageText": "<speak>This is slide three.</speak>", | |
"backgroundImage": "https://m.media-amazon.com/images/G/01/alexa-blueprints/backgrounds/greeting-cards/pattern_charms_01._CB471614893_.png" | |
} | |
], | |
"preambleSsml": "<speak>Here's a preamble to what you're about to hear. Get ready!</speak>" | |
}, | |
"transformers": [ | |
{ | |
"inputPath": "pagerData[*].pageText", | |
"outputName": "textSpeech", | |
"transformer": "ssmlToSpeech" | |
}, | |
{ | |
"inputPath": "preambleSsml", | |
"outputName": "preambleSpeech", | |
"transformer": "ssmlToSpeech" | |
} | |
] | |
} | |
} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment