Skip to content

Commit

Permalink
removed incorrect mapping
Browse files Browse the repository at this point in the history
the PlaybackFailed requests from amazon are a little different from other AudioPlayer requests. Instead of having offsetInMilliseconds and playerActivity as top level parameters, information about the playback state is nested under "currentPlaybackState". Currently, you cannot map a function argument to a nested parameter value.
  • Loading branch information
treethought committed Feb 18, 2017
1 parent 4e34769 commit c427d53
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions flask_ask/core.py
Expand Up @@ -391,13 +391,14 @@ def wrapper(*args, **kwargs):
return f
return decorator

def on_playback_failed(self, mapping={'offset': 'offsetInMilliseconds', 'error': 'error', 'playerActivity': 'activity'}, convert={}, default={}):
def on_playback_failed(self, mapping={}, convert={}, default={}):
"""Decorator routes an AudioPlayer.PlaybackFailed Request to the wrapped function.
This AudioPlayer Request sent when Alexa encounters an error when attempting to play a stream.
The wrapped view function may accept parameters from the AudioPlayer Request.
In addition to locale, requestId, timestamp, and type
PlayBackFailed Requests include:
error - Contains error info under parameters type and message
Expand All @@ -406,14 +407,14 @@ def on_playback_failed(self, mapping={'offset': 'offsetInMilliseconds', 'error':
currentPlaybackState - Details about the playback activity occurring at the time of the error
Contains the following parameters:
token - represents the audio stream currently playing when the error occurred.
Note that this may be different from the value of the request.token property.
token - represents the audio stream currently playing when the error occurred.
Note that this may be different from the value of the request.token property.
offsetInMilliseconds - Position in stream when request was sent.
Not end of stream, often few ms after Play Directive offset.
This parameter is automatically mapped to 'offset' by default.
offsetInMilliseconds - Position in stream when request was sent.
Not end of stream, often few ms after Play Directive offset.
This parameter is automatically mapped to 'offset' by default.
playerActivity - player state when the error occurred
playerActivity - player state when the error occurred
"""
def decorator(f):
self._intent_view_funcs['AudioPlayer.PlaybackFailed'] = f
Expand Down

0 comments on commit c427d53

Please sign in to comment.