Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
@warren-bank/alexa-skill-library-audio-player-http-request-headers
Advanced tools
Readme
Add API methods missing from Alexa ResponseBuilder to configure HTTP headers to include in requests for audio stream URLs
npm install --save "@warren-bank/alexa-skill-library-audio-player-http-request-headers"
const {AddAudioPlayerHttpHeadersRequestInterceptor, SetDefaultAudioPlayerHttpHeadersRequestInterceptor} = require('@warren-bank/alexa-skill-library-audio-player-http-request-headers')
const PlayAudioIntentHandler = {
canHandle(handlerInput) {
return (
(Alexa.getRequestType(handlerInput.requestEnvelope) === 'IntentRequest') &&
(
(Alexa.getIntentName(handlerInput.requestEnvelope) === 'PlayAudioIntent') ||
(Alexa.getIntentName(handlerInput.requestEnvelope) === 'AMAZON.ResumeIntent')
)
);
},
handle(handlerInput) {
const speakOutput = 'Playing the audio stream.';
const playBehavior = 'REPLACE_ALL';
// https://requestbin.com/
// https://requestbin.com/r
// https://requestbin.com/r/en0m33feca4osq
const audioStreamUrl = 'https://en0m33feca4osq.x.pipedream.net/audio_track.mp3';
return handlerInput.responseBuilder
.speak(speakOutput)
.addAudioPlayerPlayDirective(
playBehavior,
audioStreamUrl,
'mytoken',
0
)
// .removeAudioPlayerHttpHeaders()
.addAudioPlayerHttpHeaders([{
"name": "X-Alexa-Issue",
"value": "https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs/issues/610#issuecomment-1483729767"
}])
.getResponse();
}
};
exports.handler = Alexa.SkillBuilders.custom()
.addRequestHandlers(
PlayAudioIntentHandler
)
.addRequestInterceptors(
AddAudioPlayerHttpHeadersRequestInterceptor,
SetDefaultAudioPlayerHttpHeadersRequestInterceptor([{
"name": "X-Alexa-Skill-Demo",
"value": "https://github.com/warren-bank/Alexa-skill-demos/tree/alexa-samples/skill-sample-nodejs-audio-player/e93ec39"
},{
"name": "X-Alexa-Skill-Library",
"value": "https://github.com/warren-bank/Alexa-skill-libraries/tree/master/audio-player-http-request-headers"
}])
)
.lambda();
The code for the previous usage example is taken from this minimal but complete skill demo.
ResponseBuilder
, so its usage is easy and follows the familiar patternResponseBuilder.addAudioPlayerHttpHeaders(headers_collections, only_update_last_directive)
headers_collections
can be:
{name, value}
Objects for each key{name, value}
Objectsonly_update_last_directive
is:
ResponseBuilder.addAudioPlayerPlayDirective(...)
ResponseBuilder.addAudioPlayerPlayDirective(...)
ResponseBuilder.removeAudioPlayerHttpHeaders(header_names, only_update_last_directive)
header_names
can be:
only_update_last_directive
is:
ResponseBuilder.addAudioPlayerPlayDirective(...)
ResponseBuilder.addAudioPlayerPlayDirective(...)
AddAudioPlayerHttpHeadersRequestInterceptor
can be used without SetDefaultAudioPlayerHttpHeadersRequestInterceptor
AddAudioPlayerHttpHeadersRequestInterceptor
is required to use SetDefaultAudioPlayerHttpHeadersRequestInterceptor
SetDefaultAudioPlayerHttpHeadersRequestInterceptor
is applied to each directive immediately after its being added by a call to: ResponseBuilder.addAudioPlayerPlayDirective(...)
ResponseBuilder.removeAudioPlayerHttpHeaders(null, true)
can be called immediately after ResponseBuilder.addAudioPlayerPlayDirective(...)
to selectively prevent default headers from being included in a particular directiveFAQs
Add API methods missing from Alexa ResponseBuilder to configure HTTP headers to include in requests for audio stream URLs
The npm package @warren-bank/alexa-skill-library-audio-player-http-request-headers receives a total of 0 weekly downloads. As such, @warren-bank/alexa-skill-library-audio-player-http-request-headers popularity was classified as not popular.
We found that @warren-bank/alexa-skill-library-audio-player-http-request-headers demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.