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

addAudioPlayerPlayDirective not playing some URLs #723

Open akhilerm opened 1 year ago

akhilerm commented 1 year 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:

I have created an alexa skill to stream music from youtube music. But echo dot is able to play only some stream URLs and not other. The following code snippet is used to play the song.

        .addAudioPlayerPlayDirective(
          playBehavior,
          audioFormat.url,
          audioInfo.id.videoId,
          0,
          null
        );

Ref : index.js

The following are the stream URLs that were generated using ytdl-core node js library for 2 youtube IDs.

  1. (Working) Youtube ID : M1isvrDYyRg . Generated from youtube video

    {
    mimeType: 'audio/webm; codecs="opus"',
    qualityLabel: null,
    bitrate: 131906,
    audioBitrate: 160,
    itag: 251,
    url: 'https://rr1---sn-ci5gup-cagd.googlevideo.com/videoplayback?expire=1667732238&ei=rj5nY-u-F6WB4-EP1IGjiAg&ip=122.171.21.73&id=o-AIt-2kJCYrg7QixBN5_tJ0Z55lBXp78TwwJ9pO_bfjvk&itag=251&source=youtube&requiressl=yes&mh=AU&mm=31%2C29&mn=sn-ci5gup-cagd%2Csn-ci5gup-qxae7&ms=au%2Crdu&mv=m&mvi=1&pcm2cms=yes&pl=22&initcwndbps=1376250&vprv=1&mime=audio%2Fwebm&ns=pL39PidWrF6EMNdd4-ivok0J&gir=yes&clen=3893907&dur=294.061&lmt=1652807822699211&mt=1667710368&fvip=2&keepalive=yes&fexp=24001373%2C24007246&c=WEB&txp=5532434&n=YLrcMXkVfCo3hQ&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRAIgH-nNVynqQKWnxSFubQq96GnFX7w0ocFzY_EwwfQ2KPECIEntQnsc1u_yVmdJmKocTR8K7wEJAWjk8megPxf3-Agw&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpcm2cms%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIgQR2cCcjidI4wfLuDrxnERGQVwr9dErqpA6UMRJi4X88CIQDwh5-KwiGWw3PIwi8Kr3qtvVs-4sU9CtUkPRfJw0wNKg%3D%3D',
    initRange: { start: '0', end: '265' },
    indexRange: { start: '266', end: '772' },
    lastModified: '1652807822699211',
    contentLength: '3893907',
    quality: 'tiny',
    projectionType: 'RECTANGULAR',
    averageBitrate: 105934,
    audioQuality: 'AUDIO_QUALITY_MEDIUM',
    approxDurationMs: '294061',
    audioSampleRate: '48000',
    audioChannels: 2,
    loudnessDb: 10.98,
    hasVideo: false,
    hasAudio: true,
    container: 'webm',
    codecs: 'opus',
    videoCodec: null,
    audioCodec: 'opus',
    isLive: false,
    isHLS: false,
    isDashMPD: false
    }
  2. (Not Working): Youtube ID: 5XthUghC2Po. Generated from youtube music.

    {
    mimeType: 'audio/webm; codecs="opus"',
    qualityLabel: null,
    bitrate: 153683,
    audioBitrate: 160,
    itag: 251,
    initRange: { start: '0', end: '258' },
    indexRange: { start: '259', end: '765' },
    lastModified: '1646654326914510',
    contentLength: '5013866',
    quality: 'tiny',
    projectionType: 'RECTANGULAR',
    averageBitrate: 138208,
    audioQuality: 'AUDIO_QUALITY_MEDIUM',
    approxDurationMs: '290221',
    audioSampleRate: '48000',
    audioChannels: 2,
    loudnessDb: 5.75,
    url: 'https://rr1---sn-ci5gup-cag6.googlevideo.com/videoplayback?expire=1667732296&ei=6D5nY5z-Hfvvz7sPwJ2xkAc&ip=122.171.21.73&id=o-APi1E2dvjJrwvILdBbeiYO13jzwwGaZjo-ToStHkIC5y&itag=251&source=youtube&requiressl=yes&mh=ul&mm=31%2C29&mn=sn-ci5gup-cag6%2Csn-ci5gup-cvhr&ms=au%2Crdu&mv=m&mvi=1&pcm2cms=yes&pl=22&pcm2=yes&gcr=in&initcwndbps=1672500&vprv=1&mime=audio%2Fwebm&ns=Ui8WpIAOpthPms0pGVjq36MJ&gir=yes&clen=5013866&dur=290.221&lmt=1646654326914510&mt=1667710368&fvip=2&keepalive=yes&fexp=24001373%2C24007246&c=WEB&txp=2318224&n=OPpnHbI8gTOENQ&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cpcm2%2Cgcr%2Cvprv%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpcm2cms%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIgI98HU0HLl7IJB4d-Jdrf3xccRxUX_H-A73zUeTWV29oCIQDeO7LPp-dX4eDsJhr0THooNNNsK_Zv_fYPkio7rKbBsQ%3D%3D&sig=AOq0QJ8wRQIhAOzV84yUuB7AqaXM9oFgVU21FB_698H33I7XZxdz3cFsAiA8jEXy8_MwNrMvsNgpNxm7EtS6rohvfcJr4edTon91mg%3D%3D',
    hasVideo: false,
    hasAudio: true,
    container: 'webm',
    codecs: 'opus',
    videoCodec: null,
    audioCodec: 'opus',
    isLive: false,
    isHLS: false,
    isDashMPD: false
    }

The only difference between both of them is the loudnessDb field is lesser for the not working stream.

Both the stream URLs are working fine in other applications. Tried loading in VLC as well as chrome and the music is playing

Expected Behavior

Echo dot should be able to play from the stream URL.

Current Behavior

Echo dot is speaking the speak as part of the response but the music is not played.

Logs

Cloud watch logs when the music is not playing. The below set of lines are repeated multiple times in each lambda run when the the music is not being played.

2022-11-06T08:30:31.775Z    e5169aa1-0f61-45b9-a137-c607a0ae4463    INFO    ~~~~ Error handled: AskSdk.GenericRequestDispatcher Error: Unable to find a suitable request handler.
    at Object.createAskSdkError (/var/task/node_modules/ask-sdk-runtime/dist/util/AskSdkUtils.js:23:19)
    at GenericRequestDispatcher.dispatchRequest (/var/task/node_modules/ask-sdk-runtime/dist/dispatcher/GenericRequestDispatcher.js:72:33)
    at async GenericRequestDispatcher.dispatch (/var/task/node_modules/ask-sdk-runtime/dist/dispatcher/GenericRequestDispatcher.js:45:22)
    at async CustomSkill.invoke (/var/task/node_modules/ask-sdk-core/dist/skill/CustomSkill.js:68:26)

Possible Solution

Steps to Reproduce (for bugs)

Context

Your Environment

ORi0N commented 2 months ago

Hi anyone, does anyone have any pointer what to try?

Or does this error ring a bell?