Skip to content

Commit

Permalink
Add builder methods for AudioPlayerPlay
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasviehweger committed Dec 30, 2016
1 parent 893fdcd commit 2907b7d
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions Alexa.NET/ResponseBuilder.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Alexa.NET.Request;
using Alexa.NET.Response;
using Alexa.NET.Response.Directive;
using System;
using System.Collections.Generic;
using System.Linq;
Expand Down Expand Up @@ -63,6 +64,37 @@ public static SkillResponse Ask(IOutputSpeech speechResponse, Reprompt reprompt,
return BuildResponse(speechResponse, false, sessionAttributes, reprompt, null);
}

public static SkillResponse AudioPlayerPlay(PlayBehavior playBehavior, string url, string token)
{
return AudioPlayerPlay(playBehavior, url, token, 0);
}

public static SkillResponse AudioPlayerPlay(PlayBehavior playBehavior, string url, string token, int offsetInMilliseconds)
{
return AudioPlayerPlay(playBehavior, url, token, null, offsetInMilliseconds);
}

public static SkillResponse AudioPlayerPlay(PlayBehavior playBehavior, string url, string token, string expectedPreviousToken, int offsetInMilliseconds)
{
var response = BuildResponse(null, true, null, null, null);
response.Response.Directives.Add(new AudioPlayerPlayDirective()
{
PlayBehavior = playBehavior,
AudioItem = new AudioItem()
{
Stream = new AudioItemStream()
{
Url = url,
Token = token,
ExpectedPreviousToken = expectedPreviousToken,
OffsetInMilliseconds = offsetInMilliseconds
}
}
});

return response;
}

private static SkillResponse BuildResponse(IOutputSpeech outputSpeech, bool shouldEndSession, Session sessionAttributes, Reprompt reprompt, ICard card)
{
SkillResponse response = new Response.SkillResponse();
Expand Down

0 comments on commit 2907b7d

Please sign in to comment.