const LaunchRequestHandler = { canHandle(handlerInput) { return Alexa.getRequestType(handlerInput.requestEnvelope) === 'LaunchRequest'; }, handle(handlerInput) { const speakOutput = '<audio src="https://www.hm.ysrock.com/api/test_mp3/wan1.mp3" />'; return handlerInput.responseBuilder .speak(speakOutput) .reprompt(speakOutput) .getResponse(); } };
MP3ファイルは次の制限がある
※詳しくはAlexaSkillsKitを参照
ffmpegで変換する場合は、ffmpeg.exeと同じディレクトリにmp3を置いて、コマンドプロンプトを起動する
今回はデスクトップにffmpegと言うフォルダを作成しその中に保存しました
C:\Users\ysrock\Desktop\ffmpeg>ffmpeg -i original.mp3 -ac 2 -codec:a libmp3lame -b:a 48k -ar 16000 new.mp3]]>
const LaunchRequestHandler = { canHandle(handlerInput) { return Alexa.getRequestType(handlerInput.requestEnvelope) === 'LaunchRequest'; }, handle(handlerInput) { const speakOutput = '<audio src="https://www.hm.ysrock.com/api/test_mp3/wan1.mp3" />'; const largeImageUrl = 'https://www.hm.ysrock.com/api/test_image/largeImageUrl.jpg'; const smallImageUrl = 'https://www.hm.ysrock.com/api/test_image/smallImageUrl.jpg'; return handlerInput.responseBuilder .speak(speakOutput) .withStandardCard('ダイです', 'なぁに?', smallImageUrl, largeImageUrl) .reprompt(speakOutput) .getResponse(); } };
画像ファイルは次の制限がある
※詳しくはAlexaSkillsKitを参照
]]>