question

Starfish Mint avatar image
Starfish Mint asked ·

APL video Player broken

We have an existing skill with skill id: amzn1.ask.skill.5a307715-1de0-4c58-9615-20a2eb038913

This playes videos for users but it broken on it's own complaining about datasource is not a correct json. The skill uses java skill kit. This was all working until yesterday and users are complaining. Here is the response we send:



{

"version":"1.0",

"userAgent":"ask-java/2.27.2 Java/1.8.0_201 templateResolver",

"response":{

"directives":[

{

"type":"Alexa.Presentation.APL.RenderDocument",

"token":"videoPlayer",

"document":{

"import":[

{

"name":"alexa-viewport-profiles",

"version":"1.0.0"

}

],

"mainTemplate":{

"parameters":[

"payload"

],

"items":[

{

"video":"${payload.video}",

"type":"VideoPlayer"

}

]

},

"resources":[

{

"strings":{

"urlPauseIcon":"https://s3.us-east-2.amazonaws.com/ryanwagn-fluid-assets/ic_transport_pause_default_48dp.png",

"urlPlayIcon":"https://s3.us-east-2.amazonaws.com/ryanwagn-fluid-assets/ic_transport_play_default_48dp.png",

"urlPlayIconFocused":"https://s3.us-east-2.amazonaws.com/ryanwagn-fluid-assets/ic_transport_play_focused_48dp.png",

"urlPauseIconFocused":"https://s3.us-east-2.amazonaws.com/ryanwagn-fluid-assets/ic_transport_pause_focused_48dp.png"

},

"description":"Icon asset URLs for transport control icon buttons",

"when":"${@viewportProfile == @hubRoundSmall}"

},

{

"strings":{

"urlPauseIcon":"https://s3.us-east-2.amazonaws.com/ryanwagn-fluid-assets/ic_transport_pause_default_72dp.png",

"urlPlayIcon":"https://s3.us-east-2.amazonaws.com/ryanwagn-fluid-assets/ic_transport_play_default_72dp.png",

"urlPlayIconFocused":"https://s3.us-east-2.amazonaws.com/ryanwagn-fluid-assets/ic_transport_play_focused_72dp.png",

"urlPauseIconFocused":"https://s3.us-east-2.amazonaws.com/ryanwagn-fluid-assets/ic_transport_pause_focused_72dp.png"

},

"description":"Icon asset URLs for transport control icon buttons"

}

],

"theme":"dark",

"styles":{

"playPauseToggleButtonContainerFocused":{

"values":[

{

"opacity":"1",

"when":"${state.focused}"

},

{

"opacity":"0",

"when":"${!state.focused}"

}

],

"description":"style for the PlayPauseToggleButton - focused mode"

},

"highEmphasisIconButton":{

"values":[

{

"backgroundColor":"rgba(#FAFAFA, .20)"

},

{

"backgroundColor":"rgba(#FAFAFA, .30)",

"when":"${state.pressed}"

},

{

"backgroundColor":"#EBEDED",

"when":"${state.focused}"

},

{

"backgroundColor":"rgba(#FAFAFA, .20)",

"when":"${state.disabled}"

}

],

"description":"voice optimized icon button style - contained"

},

"lowEmphasisIconButton":{

"values":[

{

"backgroundColor":"rgba(#EBEDED, 0.17)"

},

{

"backgroundColor":"rgba(#FAFAFA, .50)",

"when":"${state.pressed}"

},

{

"backgroundColor":"#EBEDED",

"when":"${state.focused}"

},

{

"backgroundColor":"transparent",

"when":"${state.disabled}"

}

],

"description":"voice optimized icon button style - image"

},

"playPauseToggleButtonPauseImage":{

"values":[

{

"opacity":"0",

"when":"${state.checked}"

},

{

"opacity":"1",

"when":"${!state.checked}"

}

],

"description":"style for pause Image in the PlayPauseToggleButton layout"

},

"playPauseToggleButtonPlayImage":{

"values":[

{

"opacity":"1",

"when":"${state.checked}"

},

{

"opacity":"0",

"when":"${!state.checked}"

}

],

"description":"style for play Image in the PlayPauseToggleButton layout"

},

"playPauseToggleButtonContainer":{

"values":[

{

"opacity":"0",

"when":"${state.focused}"

},

{

"opacity":"1",

"when":"${!state.focused}"

}

],

"description":"style for the PlayPauseToggleButton"

}

},

"type":"APL",

"version":"1.0",

"layouts":{

"VideoPlayer":{

"item":[

{

"type":"Container",

"items":[

{

"alignItems":"center",

"width":"100vw",

"type":"Container",

"when":"${@viewportProfile == @hubRoundSmall}",

"items":[

{

"onPress":[

{

"arguments":[

"PreviousVideo"

],

"type":"SendEvent"

}

],

"item":[

{

"color":"#FFFFFF",

"width":"10vw",

"fontSize":"25dp",

"text":"<",

"type":"Text",

"height":"5vh"

}

],

"type":"TouchWrapper"

},

{

"componentId":"videoPlayer",

"type":"PlayPauseToggleButton",

"buttonSize":"5vh",

"autoplay":true

},

{

"onPress":[

{

"arguments":[

"NextVideo"

],

"type":"SendEvent"

}

],

"item":[

{

"color":"#FFFFFF",

"width":"10vw",

"fontSize":"25dp",

"text":">",

"type":"Text",

"paddingLeft":"7vw",

"height":"5vh"

}

],

"type":"TouchWrapper"

}

],

"justifyContent":"center",

"height":"10vh",

"direction":"row"

},

{

"onEnd":[

{

"arguments":[

"NextVideo"

],

"type":"SendEvent"

}

],

"width":"100vw",

"onPause":[

{

"componentId":"alexaPlayPauseToggleButton",

"state":"checked",

"type":"SetState",

"value":true

}

],

"id":"videoPlayer",

"source":"${video.source}",

"paddingTop":"2.5vh",

"type":"Video",

"when":"${@viewportProfile == @hubRoundSmall}",

"onPlay":[

{

"componentId":"alexaPlayPauseToggleButton",

"state":"checked",

"type":"SetState",

"value":false

}

],

"autoplay":true,

"height":"80vh"

},

{

"alignItems":"center",

"width":"100vw",

"type":"Container",

"when":"${@viewportProfile == @hubLandscapeMedium || @viewportProfile == @hubLandscapeSmall || @viewportProfile == @hubLandscapeLarge || @viewportProfile == @tvLandscapeXLarge}",

"items":[

{

"onPress":[

{

"arguments":[

"PreviousVideo"

],

"type":"SendEvent"

}

],

"item":[

{

"color":"#FFFFFF",

"width":"10vw",

"text":"<",

"type":"Text"

}

],

"type":"TouchWrapper",

"paddingLeft":"3vw"

},

{

"componentId":"videoPlayer",

"type":"PlayPauseToggleButton",

"buttonSize":"5vh",

"autoplay":true

},

{

"alignSelf":"center",

"paddingBottom":"1vh",

"textAlignVertical":"center",

"color":"#FFFFFF",

"textAlign":"center",

"width":"70vw",

"fontSize":"4vh",

"id":"videoPlayerTitle",

"text":"${video.title ?? state.title}",

"type":"Text",

"fontWeight":"100",

"height":"5vh"

},

{

"onPress":[

{

"arguments":[

"NextVideo"

],

"type":"SendEvent"

}

],

"item":[

{

"color":"#FFFFFF",

"text":">",

"type":"Text"

}

],

"type":"TouchWrapper",

"paddingLeft":"5vw"

}

],

"justifyContent":"start",

"height":"5vh",

"direction":"row"

},

{

"onEnd":[

{

"arguments":[

"NextVideo"

],

"type":"SendEvent"

}

],

"width":"100vw",

"onPause":[

{

"componentId":"alexaPlayPauseToggleButton",

"state":"checked",

"type":"SetState",

"value":true

}

],

"id":"videoPlayer",

"source":"${video.source}",

"paddingTop":"2.5vh",

"type":"Video",

"when":"${@viewportProfile == @hubLandscapeMedium || @viewportProfile == @hubLandscapeSmall || @viewportProfile == @hubLandscapeLarge || @viewportProfile == @tvLandscapeXLarge}",

"onPlay":[

{

"componentId":"alexaPlayPauseToggleButton",

"state":"checked",

"type":"SetState",

"value":false

}

],

"autoplay":true,

"height":"90vh"

}

]

}

],

"parameters":[

{

"name":"video",

"type":"any"

}

]

},

"PlayPauseToggleButton":{

"item":[

{

"onPress":[

{

"type":"Parallel",

"commands":[

{

"componentId":"alexaPlayPauseToggleButton",

"state":"checked",

"type":"SetState",

"value":"${!event.source.value}"

},

{

"componentId":"${componentId}",

"type":"ControlMedia",

"when":"${event.source.value}",

"command":"play"

},

{

"componentId":"${componentId}",

"type":"ControlMedia",

"when":"${!event.source.value}",

"command":"pause"

}

]

}

],

"item":[

{

"item":[

{

"inheritParentState":true,

"width":"${buttonSize}",

"type":"Container",

"items":[

{

"inheritParentState":true,

"width":"${buttonSize}",

"style":"playPauseToggleButtonContainer",

"id":"toggleButtonImages",

"position":"absolute",

"type":"Container",

"items":[

{

"inheritParentState":true,

"width":"${buttonSize}",

"scale":"best-fit",

"style":"playPauseToggleButtonPauseImage",

"id":"toggleButtonPauseImage",

"position":"absolute",

"source":"@urlPauseIcon",

"type":"Image",

"align":"center",

"height":"${buttonSize}"

},

{

"inheritParentState":true,

"width":"${buttonSize}",

"scale":"best-fit",

"style":"playPauseToggleButtonPlayImage",

"id":"toggleButtonPlayImage",

"position":"absolute",

"source":"@urlPlayIcon",

"type":"Image",

"align":"center",

"height":"${buttonSize}"

}

],

"height":"${buttonSize}"

},

{

"inheritParentState":true,

"width":"${buttonSize}",

"style":"playPauseToggleButtonContainerFocused",

"id":"toggleButtonImagesFocused",

"position":"absolute",

"type":"Container",

"items":[

{

"inheritParentState":true,

"width":"${buttonSize}",

"scale":"best-fit",

"style":"playPauseToggleButtonPauseImage",

"id":"toggleButtonPauseImageFocused",

"position":"absolute",

"source":"@urlPauseIconFocused",

"type":"Image",

"align":"center",

"height":"${buttonSize}"

},

{

"inheritParentState":true,

"width":"${buttonSize}",

"scale":"best-fit",

"style":"playPauseToggleButtonPlayImage",

"id":"toggleButtonPlayImageFocused",

"position":"absolute",

"source":"@urlPlayIconFocused",

"type":"Image",

"align":"center",

"height":"${buttonSize}"

}

],

"height":"${buttonSize}"

}

],

"height":"${buttonSize}"

}

],

"borderRadius":"100vw",

"inheritParentState":true,

"width":"${buttonSize}",

"style":"highEmphasisIconButton",

"type":"Frame",

"height":"${buttonSize}"

}

],

"width":"${buttonSize}",

"id":"alexaPlayPauseToggleButton",

"type":"TouchWrapper",

"height":"${buttonSize}"

}

],

"parameters":[

"buttonSize",

"componentId",

"autoplay"

]

}

}

},

"datasources":{

"video":{

"image":{

"url":"https://somewebsite.com/y4mrjzPATq0eoxSE6DfUTPmFJwBnPJrqY8IwcgGRT25BKafuZ4wsOp6bVxGDt9hnzUxNY0fxFPCryy6j8uU53UFZaFumxfr8Lz_7Q8kYDpr6NouCNjgS-vNaB67-Dn4lXkA09QKHKbBDKdhO3RJCg4IU8cjxEu2ltOFhr6u4vn0wlQEfGZu4PfSzM1wHQlYWCm5YNaz-zQa15NOmyXZivhbDDOX3VURHZJy1vFQHK0y2GuYa3TmrRaKZSQBXib_esB6?width=800&height=450&cropmode=none"

},

"source":{

"url":"https://somewebsite.com/y4mPgwMTOB-uw4KRYScH9mMfgvxSRYb_PFblAEdatMghnEp21n_g5YLQj3pjk6sjTCbyUOGUJqAgT2SusvZAshnpEHHBmmXglqw7bV-INu12h-N_W0Yvyeclq_fqbHxdtznsHlgIqOFLVLPSRNSzsrlkdntOBMNUw7EoDjnTvUIgpuhM-AFURiqY9zuqJnZKPsj4j5vJMSOI-XBtSPnrw8qqwGnk0NtH9lZtrvz1BaAVI0n4KmgrfxqbbawrZ6--ikBY7LYFQhF3v9foyyOSG3s5g"

},

"id":0,

"title":"cats_in_white",

"ordinal":1

}

}

},

{

"type":"Alexa.Presentation.APL.ExecuteCommands",

"commands":[

{

"type":"ControlMedia",

"command":"play",

"componentId":"videoPlayer"

}

],

"token":"videoPlayer"

}

],

"shouldEndSession":false

}

}

The error we get in session ended request is as below:


{
        "type": "SessionEndedRequest",
        "requestId": "amzn1.echo-api.request.a9e84f3a-aeb0-4687-b602-ccd54b75dd8f",
        "timestamp": "2020-11-23T19:22:55Z",
        "locale": "en-GB",
        "reason": "ERROR",
        "error": {
            "type": "INVALID_RESPONSE",
            "message": "Each datasource must be a JSON object. Invalid datasource: video."
        }


aplvideo skill apiask sdk
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.

Gaetano@Amazon avatar image
Gaetano@Amazon answered ·

Hello and thanks for reporting this

To fix the issue, please add a "wrapper object" around "video" within your datasources, example:

            {
                "data":
                {
                    "properties":{
                            "video": {
                            "image": {
                                "url": "https://example.com"
                            },
                            "source": {
                                "url": "https://example.com"
                            },
                            "id": 0,
                            "title": "cats_in_white",
                            "ordinal": 1
                }
                }
                    
                }
            }

And then modify the data-binding reference for the VideoPlayer component as follows:

{
      "video": "${payload.data.properties.video}",
      "type": "VideoPlayer"
}

Please let me know the outcome.

Kind regards,
Gaetano

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.

Starfish Mint avatar image
Starfish Mint answered ·

Thanks that worked but why I had to make code changes without my fault?

Amazon breaks the code and then start chasing developers that your skill is not working and it will be removed. I have to then raise a ticket with Amazon to understand what they have broken and then fix code.

And cherry on the pie is I don't get paid nothing for all these.

1 comment
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.

Hi,

We are currently working on the issue to understand the root cause.

Meanwhile, please consider accepting the workaround provided.

Thanks,
Gaetano

0 Likes 0 ·