javascript 来自https://forums.developer.amazon.com/questions/75835/can-you-please-provide-a-video-skil
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了javascript 来自https://forums.developer.amazon.com/questions/75835/can-you-please-provide-a-video-skil相关的知识,希望对你有一定的参考价值。
'use strict'; exports.handler = function(event, context, callback) { if (isDiscovery(event)) { callback(null, devices(event)); } else if (isChannelController(event)) { callback(null, handleChannelControl(event)); } else { callback(null, "some success message"); }} function isDiscovery(event) { return event['directive']['header']['namespace'] == 'Alexa.Discovery';} function isChannelController(event) { return event['directive']['header']['namespace'] == 'Alexa.ChannelController';} function isChangingChannel(event) { return event['directive']['header']['name'] == 'ChangeChannel';} function devices(event) { var messageId = event['directive']['header']['messageId']; var header = { "namespace": "Alexa.Discovery", "name": "Discover.Response", "payloadVersion": "3", "messageId": messageId } var payload = { "endpoints": [{ "capabilities": [ { "interface": "Alexa.RemoteVideoPlayer", "type": "AlexaInterface", "version": "1.0" }, { "interface": "Alexa.ChannelController", "type": "AlexaInterface", "version": "1.0" }, { "interface": "Alexa.PlaybackController", "version": "1.0", "type": "AlexaInterface" }], "endpointId": "videoDevice-001", "description": "Device description that's shown to the customer", "displayCategories": [], "friendlyName": "Upstairs Amazon Player", "manufacturerName": "Amazon" }] } var response = { 'header': header, 'payload': payload } return {'event': response}} function handleChannelControl(event) { var payload = {}; var header = {}; var messageId = event['directive']['header']['messageId']; if (isChangingChannel(event)) { header = { "namespace":"Alexa.ChannelController", "name":"ChannelChanged", "payloadVersion":"3", "messageId": messageId } } var response = { 'header': header, 'payload': payload } return { 'event': response }}
以上是关于javascript 来自https://forums.developer.amazon.com/questions/75835/can-you-please-provide-a-video-skil的主要内容,如果未能解决你的问题,请参考以下文章
将javascript注入dom,来自javascript [重复]
javascript ui选择器来自javascript中的list元素
JavaScript 在javascript中仅接受来自键盘的数字数据
获取来自 WKWebView 的 JavaScript 错误
Python string.replace 等效项(来自 Javascript)
来自 appDelegate 的 javascript 调用:phonegap iOS