Advertisement
Guest User

Untitled

a guest
Apr 16th, 2019
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JSON 6.79 KB | None | 0 0
  1. {
  2.     "type": "APL",
  3.     "version": "1.0",
  4.     "theme": "dark",
  5.     "import": [{
  6.         "name": "alexa-viewport-profiles",
  7.         "version": "1.0.0"
  8.     }],
  9.     "resources": [{
  10.         "description": "Icon asset URLs for transport control icon buttons",
  11.         "strings": {
  12.             "urlPlayIcon": "https://s3.us-east-2.amazonaws.com/ryanwagn-fluid-assets/ic_transport_play_default_72dp.png",
  13.             "urlPlayIconFocused": "https://s3.us-east-2.amazonaws.com/ryanwagn-fluid-assets/ic_transport_play_focused_72dp.png",
  14.             "urlPauseIcon": "https://s3.us-east-2.amazonaws.com/ryanwagn-fluid-assets/ic_transport_pause_default_72dp.png",
  15.             "urlPauseIconFocused": "https://s3.us-east-2.amazonaws.com/ryanwagn-fluid-assets/ic_transport_pause_focused_72dp.png"
  16.         }
  17.     }],
  18.     "styles": {
  19.         "highEmphasisIconButton": {
  20.             "description": "voice optimized icon button style - contained",
  21.             "values": [{
  22.                     "when": "${!state.checked}",
  23.                     "backgroundColor": "transparent"
  24.                 },
  25.                 {
  26.                     "when": "${state.checked}",
  27.                     "backgroundColor": "rgba(#FAFAFA, .20)"
  28.                 },
  29.                 {
  30.                     "when": "${state.pressed}",
  31.                     "backgroundColor": "rgba(#FAFAFA, .30)"
  32.                 }
  33.             ]
  34.         },
  35.         "lowEmphasisIconButton": {
  36.             "description": "voice optimized icon button style - image",
  37.             "values": [{
  38.                     "backgroundColor": "rgba(#EBEDED, .17)"
  39.                 },
  40.                 {
  41.                     "when": "${state.pressed}",
  42.                     "backgroundColor": "rgba(#FAFAFA, .50)"
  43.                 },
  44.                 {
  45.                     "when": "${state.focused}",
  46.                     "backgroundColor": "#EBEDED"
  47.                 },
  48.                 {
  49.                     "when": "${state.disabled}",
  50.                     "backgroundColor": "transparent"
  51.                 }
  52.             ]
  53.         },
  54.  
  55.         "playPauseToggleButtonPauseImage": {
  56.             "description": "style for pause Image in the PlayPauseToggleButton layout",
  57.             "values": [{
  58.                     "when": "${state.checked}",
  59.                     "opacity": "0"
  60.                 },
  61.                 {
  62.                     "when": "${!state.checked}",
  63.                     "opacity": "1"
  64.                 }
  65.             ]
  66.         },
  67.         "playPauseToggleButtonPlayImage": {
  68.             "description": "style for play Image in the PlayPauseToggleButton layout",
  69.             "values": [{
  70.                     "when": "${state.checked}",
  71.                     "opacity": "1"
  72.                 },
  73.                 {
  74.                     "when": "${!state.checked}",
  75.                     "opacity": "0"
  76.                 }
  77.             ]
  78.         },
  79.         "playPauseToggleButtonContainer": {
  80.             "description": "style for the PlayPauseToggleButton",
  81.             "values": [{
  82.                     "when": "${state.focused}",
  83.                     "opacity": "0"
  84.                 },
  85.                 {
  86.                     "when": "${!state.focused}",
  87.                     "opacity": "1"
  88.                 }
  89.             ]
  90.         },
  91.         "playPauseToggleButtonContainerFocused": {
  92.             "description": "style for the PlayPauseToggleButton - focused mode",
  93.             "values": [{
  94.                     "when": "${state.focused}",
  95.                     "opacity": "1"
  96.                 },
  97.                 {
  98.                     "when": "${!state.focused}",
  99.                     "opacity": "0"
  100.                 }
  101.             ]
  102.         }
  103.     },
  104.     "layouts": {
  105.         "PlayPauseToggleButton": {
  106.             "parameters": [
  107.                 "buttonSize",
  108.                 "componentId",
  109.                 "autoplay"
  110.             ],
  111.             "item": {
  112.                 "type": "TouchWrapper",
  113.                 "id": "alexaPlayPauseToggleButton",
  114.                 "position": "absolute",
  115.                 "height": "${buttonSize}",
  116.                 "width": "${buttonSize}",
  117.                 "onPress": {
  118.                     "type": "Parallel",
  119.                     "commands": [{
  120.                             "type": "SetState",
  121.                             "componentId": "alexaPlayPauseToggleButton",
  122.                             "state": "checked",
  123.                             "value": "${!event.source.value}"
  124.                         },
  125.                         {
  126.                             "when": "${event.source.value}",
  127.                             "type": "ControlMedia",
  128.                             "componentId": "${componentId}",
  129.                             "command": "play"
  130.                         },
  131.                         {
  132.                             "when": "${!event.source.value}",
  133.                             "type": "ControlMedia",
  134.                             "componentId": "${componentId}",
  135.                             "command": "pause"
  136.                         }
  137.                     ]
  138.                 },
  139.                 "item": {
  140.                     "type": "Frame",
  141.                     "height": "${buttonSize}",
  142.                     "width": "${buttonSize}",
  143.                     "style": "highEmphasisIconButton",
  144.                     "borderRadius": "100vw",
  145.                     "inheritParentState": true,
  146.                     "item": {
  147.                         "type": "Container",
  148.                         "height": "${buttonSize}",
  149.                         "width": "${buttonSize}",
  150.                         "inheritParentState": true,
  151.                         "items": [{
  152.                                 "type": "Container",
  153.                                 "height": "${buttonSize}",
  154.                                 "width": "${buttonSize}",
  155.                                 "inheritParentState": true,
  156.                                 "style": "playPauseToggleButtonContainer",
  157.                                 "id": "toggleButtonImages",
  158.                                 "position": "absolute",
  159.                                 "items": [{
  160.                                     "type": "Image",
  161.                                     "id": "toggleButtonPlayImage",
  162.                                     "position": "absolute",
  163.                                     "width": "${buttonSize}",
  164.                                     "height": "${buttonSize}",
  165.                                     "source": "@urlPlayIcon",
  166.                                     "scale": "best-fit",
  167.                                     "align": "center",
  168.                                     "style": "playPauseToggleButtonPlayImage",
  169.                                     "inheritParentState": true
  170.                                 }]
  171.                             },
  172.                             {
  173.                                 "type": "Container",
  174.                                 "height": "${buttonSize}",
  175.                                 "width": "${buttonSize}",
  176.                                 "inheritParentState": true,
  177.                                 "style": "playPauseToggleButtonContainerFocused",
  178.                                 "id": "toggleButtonImagesFocused",
  179.                                 "position": "absolute",
  180.                                 "items": [{
  181.                                     "type": "Image",
  182.                                     "id": "toggleButtonPlayImageFocused",
  183.                                     "position": "absolute",
  184.                                     "width": "${buttonSize}",
  185.                                     "height": "${buttonSize}",
  186.                                     "source": "@urlPlayIconFocused",
  187.                                     "scale": "best-fit",
  188.                                     "align": "center",
  189.                                     "style": "playPauseToggleButtonPlayImage",
  190.                                     "inheritParentState": true
  191.                                 }]
  192.                             }
  193.                         ]
  194.                     }
  195.                 }
  196.             }
  197.         }
  198.     },
  199.     "mainTemplate": {
  200.         "parameters": [
  201.             "datasource"
  202.         ],
  203.         "items": [{
  204.             "type": "Container",
  205.             "width": "100vw",
  206.             "height": "100vh",
  207.             "justifyContent": "center",
  208.             "items": [{
  209.                     "type": "TouchWrapper",
  210.                     "id": "videoWideToggleButton",
  211.                     "width": "100vw",
  212.                     "height": "100vh",
  213.                     "onPress": {
  214.                         "type": "Parallel",
  215.                         "commands": [{
  216.                                 "type": "SetState",
  217.                                 "componentId": "videoWideToggleButton",
  218.                                 "state": "checked",
  219.                                 "value": "${!event.source.value}"
  220.                             },
  221.                             {
  222.                                 "when": "${event.source.value}",
  223.                                 "type": "ControlMedia",
  224.                                 "componentId": "myVideoPlayer",
  225.                                 "command": "play"
  226.                             },
  227.                             {
  228.                                 "when": "${!event.source.value}",
  229.                                 "type": "ControlMedia",
  230.                                 "componentId": "myVideoPlayer",
  231.                                 "command": "pause"
  232.                             }
  233.                         ]
  234.                     },
  235.                     "items": [{
  236.                         "type": "Video",
  237.                         "position": "absolute",
  238.                         "height": "100vh",
  239.                         "width": "100vw",
  240.                         "id": "myVideoPlayer",
  241.                         "source": "https://yourServer/video.mp4",
  242.                         "onPlay": {
  243.                             "type": "SetState",
  244.                             "componentId": "alexaPlayPauseToggleButton",
  245.                             "state": "checked",
  246.                             "value": false
  247.                         },
  248.                         "onPause": {
  249.                             "type": "SetState",
  250.                             "componentId": "alexaPlayPauseToggleButton",
  251.                             "state": "checked",
  252.                             "value": true
  253.                         }
  254.                     }]
  255.                 },
  256.                 {
  257.                     "type": "PlayPauseToggleButton",
  258.                     "buttonSize": "30vh",
  259.                     "alignSelf": "center",
  260.                     "componentId": "myVideoPlayer",
  261.                     "autoplay": true
  262.                 }
  263.             ]
  264.         }]
  265.     }
  266. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement