Skip to content

[SingleStream] null response for play_later when card_data is empty #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
rerenoob opened this issue Nov 16, 2019 · 0 comments
Closed
Assignees

Comments

@rerenoob
Copy link

def play_later(url, card_data, response_builder):
    """Play the stream later.

    https://developer.amazon.com/docs/custom-skills/audioplayer-interface-reference.html#play
    REPLACE_ENQUEUED: Replace all streams in the queue. This does not impact the currently playing stream.
    """
    # type: (str, Dict, ResponseFactory) -> Response
    if card_data:
        # Using URL as token as they are all unique
        response_builder.add_directive(
            PlayDirective(
                play_behavior=PlayBehavior.REPLACE_ENQUEUED,
                audio_item=AudioItem(
                    stream=Stream(
                        token=url,
                        url=url,
                        offset_in_milliseconds=0,
                        expected_previous_token=None),
                    metadata=add_screen_background(card_data)))
        ).set_should_end_session(True)

        return response_builder.response

The above function will return an invalid response if card_data is empty. The function should still return a valid response.

@aszk aszk self-assigned this Apr 17, 2023
@aszk aszk assigned Ilyt00 and unassigned aszk Jul 25, 2023
@Ilyt00 Ilyt00 closed this as completed Aug 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants