Closed serfreeman1337 closed 10 months ago
I can appreciate the extra work to maintain compatibility, but my first reaction is that I'd prefer to break compatibility and have a cleaner API (aka no empty interfaces). I'm thinking more functional arguments like we use in ext/play.
Thoughts?
Something like that ?
h.Play("myPlaybackID", playback.Media("sound:hello-world"))
h.Play("myPlaybackID",
playback.Media("sound:hello-world", "sound:silence/1"),
playback.Lang("en"),
playback.OffsetMs(750),
)
Not sure where to put playback
functions.
We can also create alias:
// Array of media URIs to play.
type PlaybackMedia = []string
h.Play("myPlaybackID", ari.PlaybackMedia{"sound:hello-world"}, nil)
h.Play("myPlaybackID",
ari.PlaybackMedia{"sound:hello-world", "sound:silence/1"},
ari.PlaybackOptions{Lang:"en", OffsetMs: 750},
)
Or just leave ari.PlaybackOptions
:
h.Play("myPlaybackID", ari.PlaybackOptions{Media: []string{"sound:hello-world"}})
h.Play("myPlaybackID", ari.PlaybackOptions{
Media: []string{"sound:hello-world", "sound:silence/1"},
Lang:"en",
OffsetMs: 750,
})
Other option would be PlaybackOptions as 2nd param and media URI array as variadic:
h.Play("myPlaybackID", nil, "sound:hello-world")
h.Play("myPlaybackID",
ari.PlaybackOptions{Lang: "en", OffsetMs: 750},
"sound:hello-world",
"sound:silence/1",
)
See #140 This PR adds playback options and reverts the changes introduced with #142.
This change is![Reviewable](https://reviewable.io/review_button.svg)