I'm trying to set up a very basic skill that plays some custom m4a files stored in the provided S3 bucket. I've gotten everything to work, however the PlayDirective doesn't play the audio completely. Every single time the audio is played, it stops at a seemingly random point. I'm not sure how to debug this, as the setup works perfectly, and the audio always starts playing, but it never plays to completion, always stopping arbitrarily.
def handle(self, handler_input):
# type: (HandlerInput) -> Response
slots = handler_input.request_envelope.request.intent.slots
tale_name = slots["tale_name"]
audio_url = create_presigned_url("Media/"+self.get_audio_url(tale_name))
speak_output = "Now playing {tale_name}!".format(tale_name=NOW_PLAYING)
handler_input.response_builder.add_directive(PlayDirective(play_behavior=PlayBehavior.REPLACE_ALL, audio_item=AudioItem(stream=Stream(token="TOKEN", url=audio_url, offset_in_milliseconds=10, expected_previous_token=None))))
return (
handler_input.response_builder
.speak(speak_output)
# .ask("add a reprompt if you want to keep the session open for the user to respond")
.response
)
UPDATE:
If it helps, I've been seeing the following error in CloudWatch Logs:
[INFO] 2021-02-13T05:32:54.526Z e6499c9a-54e6-4c22-80e6-ffd1544662fd In PlaybackFailedHandler [INFO] 2021-02-13T05:32:54.526Z e6499c9a-54e6-4c22-80e6-ffd1544662fd Playback failed: {'message': 'Device playback error', 'object_type': 'MEDIA_ERROR_UNKNOWN'} [ERROR] 2021-02-13T05:32:54.578Z ef7f8718-c822-42ad-a54b-43fcbb51a0e9 Unable to find a suitable request handler Traceback (most recent call last): File "/var/task/ask_sdk_runtime/dispatch.py", line 118, in dispatch output = self.__dispatch_request(handler_input) # type: Union[Output, None]