Reputation: 396
I'm trying to setup a video skill for alexa, however I don't know how to play a video using the video api.
I've tried searching "alexa skill python video api" but I just get links to alexa skills kit. I've also tried reading the python sdk documentation but that didn't help. It seems like you have to send a directive or something.
Currently I have
class PlayHandler(AbstractRequestHandler):
def can_handle(self, handler_input):
return is_intent_name("PlayVidIntent")(handler_input)
def handle(self, handler_input):
speech_text = "Playing video"
# Get the video url
handler_input.response_builder.speak(speech_text).set_card(SimpleCard("Video started", speech_text)).set_should_end_session(True)
return handler_input.response_builder.response
Note: When I checked the documentation it said you had to have the video url so just assume the video url is in a variable called video_url. More details: Custom Skill(No video app template or Interaction model template for video skill) Python 3.4(For server) and Python 3.5(For testing)
Upvotes: 1
Views: 385
Reputation: 396
You will need to import modules from ask_sdk_model.interfaces.videoapp
From there you will create a LaunchDirective
and create VideoItem
object to be passed as the video_item
argument. The VideoItem
object has 2 arguments(that are optional according to the SDK), source
which is a string of the URL and a metadata
argument which is created with Metadata(title="Title", subtitle="Subtitle")
. Finally use response_builder.add_directive
to add the directive to the response.
Upvotes: 1