Declaring Supported Capabilities
The directives Alexa sends depends on the capabilities you declare in the Alexa Client Library configuration and your Lambda code. In this example, Alexa would send all directives:| Alexa Client Library Capability | Directive Capability | Directives |
|---|---|---|
CAPABILITY_CHANNEL_CONTROLLER | Alexa.ChannelController | ChangeChannel |
CAPABILITY_REMOTE_VIDEO_PLAYER | Alexa.RemoteVideoPlayer | SearchAndDisplayResultsSearchAndPlay |
CAPABILITY_PLAY_BACK_CONTROLLER | Alexa.PlaybackController | PausePlayStopResumeNextPreviousFastForwardRewindStartOver |
CAPABILITY_SEEK_CONTROLLER | Alexa.SeekController | AdjustSeekPosition |
CAPABILITY_KEYPAD_CONTROLLER | Alexa.KeypadController | SendKeystroke |
Discover directive, your Lambda must send a Discover.Response back to indicate which capabilities your skill supports. For example, here’s a sample response to a Discover directive:
Discovery interface for more details. In short, discovery about your skill’s capabilities occurs both through your app and Lambda.
The details for implementing and handling each of the previous directives are detailed in the API reference documentation. Alexa expects a specific response and action for each incoming directive.
Note that most apps don’t implement every capability within the Video Skill API. For example, changing channels might not be relevant if your app does not have channels. Recording might not be relevant if your app does not have recording capabilities, and so on.
Customize Your Handling of Directives
Open theindex.js file from the firetv-lambda project again (as explained in Step 6: Create and Deploy a Lambda Package ). In this index.js file, you will see placeholders for custom logic that you must write yourself. For example, you’ll see inline comments such as these:
TenFootApp.java and browse to line 119, you’ll see the following code that handles the incoming directives ADM sends to the app:
entities array and plays it if available; otherwise, it searches for the content. The index.js file has other inline comments that provide tips and instructions for customizing your Lambda function.
As you update the Lambda code, note that responses back to Alexa should not be modified, only code to process/send directives. Also note that you should send directives from your Lambda function to your app, but you should not try to send messages from your app back to the Lambda function beyond the simple success response. Success responses from your Lambda function are only meant to indicate that the message was received by Lambda, not your app.
Uploading the Finalized Lambda
After you finish writing the logic to handle the directives specified in the previous section, repeat the steps in Create a Lambda Deployment Package (runningzip -r firetv-lambda.zip .) and upload the generated zip into file into your Lambda in AWS. Make sure you test and validate any code before using it in production.

