alexa / alexa-skills-kit-sdk-for-nodejs

The Alexa Skills Kit SDK for Node.js helps you get a skill up and running quickly, letting you focus on skill logic instead of boilerplate code.
Apache License 2.0
3.12k stars 736 forks source link

Error in documentation for AudioPlayer Events #295

Closed ghost closed 6 years ago

ghost commented 6 years ago

The handling for AudioPlayer events is documented incorrectly. The current example as below will not work and all AudioPlayer events result in an un-handled event:-

const handlers = {
    'AudioPlayer.PlaybackStarted' : function() {
        console.log('Alexa begins playing the audio stream');
    },
    'AudioPlayer.PlaybackFinished' : function() {
        console.log('The stream comes to an end');
    },
    'AudioPlayer.PlaybackStopped' : function() {
        console.log('Alexa stops playing the audio stream');
    },
    'AudioPlayer.PlaybackNearlyFinished' : function() {
        console.log('The currently playing stream is nearly complate and the device is ready to receive a new stream');
    },
    'AudioPlayer.PlaybackFailed' : function() {
        console.log('Alexa encounters an error when attempting to play a stream');
    }
};

The following does however work by dropping the AudoPlayer suffix:-

const handlers = {
    'PlaybackStarted' : function() {
        console.log('Alexa begins playing the audio stream');
    },
    'PlaybackFinished' : function() {
        console.log('The stream comes to an end');
    },
    'PlaybackStopped' : function() {
        console.log('Alexa stops playing the audio stream');
    },
    'PlaybackNearlyFinished' : function() {
        console.log('The currently playing stream is nearly complate and the device is ready to receive a new stream');
    },
    'PlaybackFailed' : function() {
        console.log('Alexa encounters an error when attempting to play a stream');
    }
};

Not sure whether this is an issue with the documentation or the SDK

talkingnews commented 6 years ago

I hope this one gets noticed - I submitted a ticket and a pull request to fix this 10 days ago, and it's not been merged or commented on yet: https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs/issues/281 https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs/pull/280

Wasted a few hours figuring out what was wrong and was hoping by alerting the admin and making a pull request it might help others.

TianTXie commented 6 years ago

Thanks, guys, I will create an internal task to solve that.

TianTXie commented 6 years ago

This issue is solved in the latest commit.