タイトルの内容に引っかかったので、ここで共有します。
ファイルのタイプを指定します
ファイルを呼ぶときに、audioであることの指定(type: 'audio/mp3'
)をしていないと、アプリケーションエラーになりました。
この例ではhollo_twilios_url
でファイルを呼び出しています。
app/controllers/twilios_controller.rb
def hello
send_file "#{Rails.root}/public/audios/hello.mp3", filename: 'hello.mp3', disposition: :inline, type: 'audio/mp3'
end
config/routes.rb
resources twilio do
get hello, on: :collection
end
音声ファイルの場所
puclic
|-audios
|-hello.mp3
誰かの参考になれば幸いです。
参考
https://www.twilio.com/docs/api/twiml/play
http://stackoverflow.com/questions/2830223/ruby-on-rails-audio-mp3-content-header-download