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

Dynamic media URL and intercepting AudioPlayer fetch requests for HLS long streaming #740

Open moniecodes opened 9 months ago

moniecodes commented 9 months ago

I'm submitting a...


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

Expected Behavior

We are working on an http live streaming solution that allows us to send events to our service via query parameters to the m3u8 request.

Right now there is no way to update the m3u8 url when the player starts polling for a live hls playlist.

I tried a few work arounds. For example if the user skips we send a skip event parameter with the media url. But the very next request we want it to resume without skip command.

Our hls streaming sever uses httpOnly cookie that are required for consecutive playback and it seems when queued up via Audio player the cookies are sent, however when I make a similar request withCredentials, the previous host cookies are not sent/available.

Is there a way for us to intercept AudioPlayer fetch requests or chain audio directives? Ideally we can control how the player is polling live playlists

Current Behavior

Possible Solution

Some options can be one of these, all would help us solve our problem:

Steps to Reproduce (for bugs)

Here is an example directive:

  handlerInput.responseBuilder
            .speak(speakOutput)
            .addAudioPlayerPlayDirective(
                'REPLACE_ALL',
                getUrl("load", 0, true, "live"),
                playbackInfo.token,
                0
            )

We want to update this request for the next fetch to change the url parameters we are passing, but currently there is no way to do this. Nor can we pass extra headers or add additional context to the fetch request (adding headers is not a blocker, but updating url is)

Context

We cannot publish this skill for our new streaming service without some level of support with media requests. 😞

Thanks so much for the help!

Your Environment

Node.js and NPM Info