Recording Audio through RTMP/Rails

和自甴很熟 提交于 2020-01-01 07:03:37

问题


I am in the process of building a rails/flex application which requires audio to be recorded and then stored in our amazon s3 account. I have found no alternative to using some form of RTMP server for recording audio through flash, but our hosting environment will not allow us to install anything like FMS, Red5, etc.

Is there any existing Ruby/Rails RTMP solution that will allow audio recording? If not, is it possible for Rails to at least intercept the RTMP stream and then I can hope to reference red5's source or something for parsing the data (long shot, I know)?

The other alternative I can think of is hosting a red5 server on another host and communicating with our rails app once the saving/uploading is done, which is not preferred.

Am I going to have any luck here?


回答1:


I was able to get this to work

1) Flash Player 10.1 can get the microphone's ByteArray

2) I captured this ByteArray, used Adobe's WavWriter class (from a microphone tutorial they put together) to create a new ByteArray in proper wav format

3) Sent this over to rails through RubyAMF

4) Used something along the lines of

wav_data = rubyamf_params[0][:wav_data]

f = File.new('c:/hello.wav')
f << wav_data.pack('c'*wav_data.length)
f.close

Once I've got this wav data it won't be too far of a stretch to convert it to an mp3, woo



来源:https://stackoverflow.com/questions/2716987/recording-audio-through-rtmp-rails

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!