Giter Club home page Giter Club logo

skill-sample-python-audio-player's Introduction

Skill Sample Python Audio Player

This project demonstrates the use of Alexa Audio Player for skills using ASK Python SDK.

  • Multiple-streams folder contains an example skill to play multiple, pre-recorded audio streams, such as a basic podcast skill.

  • Single-stream folder contains an example skill to play a single stream, such as a live radio skill.

This code is using the Alexa Skill Kit SDK for Python.

License

This library is licensed under the Amazon Software License.

skill-sample-python-audio-player's People

Contributors

aszk avatar jpeddicord avatar nikhilym avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

skill-sample-python-audio-player's Issues

minor code change request - line removal

in SingleStream/lambda/py/lambda_function.py
line 481 and line 485 : sb.add_request_handler(PlaybackStartedHandler()) is duplicated:

sb.add_request_handler(PlaybackStartedHandler())
sb.add_request_handler(PlaybackFinishedHandler())
sb.add_request_handler(PlaybackStoppedHandler())
sb.add_request_handler(PlaybackNearlyFinishedHandler())
sb.add_request_handler(PlaybackStartedHandler())

Next intent vs normal play behavior

Hi,

Quick question. When using the next intent, you are able to get a card to print to screen and also echo the title of the track. When the audio stream has control and playback continues through your array, there is no cards\title echoed back to the user. Is there a way to make the automatic playback behave like the next intent?

TY

[SingleStream] null response for play_later when card_data is empty

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.

Session End when in exception so "said help" do not work

Hello, if there is something wrong the method AllExceptionsHandler() is invoked and a speak message offers you to said "help" and finish. At that moment Alexa is no longer running the skill so if I said "Alexa, help" alexa answer but no the answer programmed in HelpIntentHandler(). How can I program it so that if something is not understand and launch AllExceptionHandler if the user saids "Alexa, help" it goes to HelpIntentHandler?

[MultiStream] data.CANNOT_SKIP_MSG missing

Hello,

I was just checking this skill and going through the code I saw this:

class NextOrPreviousIntentHandler(AbstractRequestHandler):
    """Handler for next or previous intents."""
    def can_handle(self, handler_input):
        # type: (HandlerInput) -> bool
        return (is_intent_name("AMAZON.NextIntent")(handler_input) or
                is_intent_name("AMAZON.PreviousIntent")(handler_input))

    def handle(self, handler_input):
        # type: (HandlerInput) -> Response
        logger.info("In NextOrPreviousIntentHandler")
        _ = handler_input.attributes_manager.request_attributes["_"]
        handler_input.response_builder.speak(
            _(data.CANNOT_SKIP_MSG)).set_should_end_session(True)
        return handler_input.response_builder.response

What I had found odd was the in data.py there is no CANNOT_SKIP_MSG. Am I missing something here?.

Thank you very much in advanced.

[Update]: I can see now. Just checked the same file and class in the SingleStream code and, because it is a radio, you cannot skip therefore that message should be there, however I am afraid that for podcasts it should be possible to play next and previous episodes, right?. Thanks again.

[Update#2]: Just saw there is a verification of a playback session for the AMAZON.NextIntent and AMAZON.PreviousIntent , when there is a play back session then it is possible to play next and previous. Thanks again :D

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.