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 735 forks source link

Audio stutters every 10 seconds, but only when provided metadata #703

Closed GregCKrause closed 2 years ago

GregCKrause commented 2 years ago

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Other... Please describe:

Expected Behavior

Audio should play smoothly, with or without metadata.

Current Behavior

Audio stutters every 10 seconds when metadata is provided to addAudioPlayerPlayDirective. This problem persists for a couple of minutes, and then the audio eventually plays smoothly.

This issue does not occur when expectedPreviousToken and audioItemMetadata are removed.

Possible Solution

I have tried updating the device software, hard resetting for 30 seconds, and reducing metadata image size. None of these fixed the issue.

Steps to Reproduce (for bugs)

const LaunchRequestHandler = {
  canHandle(handlerInput) {
    return (
      Alexa.getRequestType(handlerInput.requestEnvelope) === "LaunchRequest"
    );
  },
  async handle(handlerInput) {
    const playbackInfo = await getPlaybackInfo(handlerInput);

    const speakOutput = "Playing the eighties channel.";
    const playBehavior = "REPLACE_ALL";
    const streamUrl = "https://la2.indexcom.com/hls/80s/64k/program.m3u8";
    const audioItemMetadata = {
      title: "The '80s Channel",
      subtitle: "Non-Stop '80s Hits!",
      art: {
        sources: [
          {
            url: "https://theotic-static-hosting-prod.s3.amazonaws.com/the-80s-channel/the-80s-channel-logo.jpg",
          },
        ],
      },
      backgroundImage: {
        sources: [
          {
            url: "https://theotic-static-hosting-prod.s3.amazonaws.com/the-80s-channel/the-80s-channel-background.jpg",
          },
        ],
      },
    };

    return handlerInput.responseBuilder
      .speak(speakOutput)
      .addAudioPlayerPlayDirective(
        playBehavior,
        streamUrl,
        playbackInfo.token,
        playbackInfo.offsetInMilliseconds,
        null,
        audioItemMetadata
      )
      .getResponse();
  },
};

Your Environment

Node.js and NPM Info

GregCKrause commented 2 years ago

Not entirely sure what the root cause was, but this example provided by Dabble Lab did not have the same issue.