Skip to content

Instantly share code, notes, and snippets.

@machisuji
Created October 27, 2017 13:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save machisuji/ed561ee40f1ad19cf6d7e1e92342daba to your computer and use it in GitHub Desktop.
Save machisuji/ed561ee40f1ad19cf6d7e1e92342daba to your computer and use it in GitHub Desktop.
class AudioController
def playback
ssml = SSMD.to_ssml params.require(:ssmd)
result = Audio::Polly.say ssml, ssml: true, language: params[:language]
if result
send_data result.audio_stream.read, type: "audio/ogg", disposition: "inline"
else
render json: { errors: ["invalid SSML"] }, status: 400
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment