Skip to content

Commit 712dfe7

Browse files
Adding audio_clear_queue and options={} all around
1 parent 485d7e4 commit 712dfe7

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

lib/alexa_rubykit/response.rb

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ def add_speech(speech_text, ssml = false)
2424
end
2525
@speech
2626
end
27-
28-
def add_audio_url(url, token='', offset=0)
27+
28+
def add_audio_url(url, token='', offset=0, options={})
2929
@directives << {
3030
'type' => 'AudioPlayer.Play',
3131
'playBehavior' => 'REPLACE_ALL',
@@ -36,11 +36,20 @@ def add_audio_url(url, token='', offset=0)
3636
'offsetInMilliseconds' => offset
3737
}
3838
}
39-
}
39+
}.merge options
4040
end
4141

42-
def add_audio_stop
43-
@directives << { 'type' => 'AudioPlayer.Stop' }
42+
def add_audio_stop(options={})
43+
@directives << {
44+
'type' => 'AudioPlayer.Stop'
45+
}.merge options
46+
end
47+
48+
def add_audio_clear_queue(options={})
49+
@directives << {
50+
'type' => 'AudioPlayer.ClearQueue',
51+
'clearBehavior' => 'CLEAR_ENQUEUED' #CLEAR_ALL
52+
}.merge options
4453
end
4554

4655
def add_reprompt(speech_text, ssml = false)

0 commit comments

Comments
 (0)