Streaming mp3 while it is being generated on the server

情到浓时终转凉″ 提交于 2019-12-25 03:34:34

问题


I am trying to stream an mp3 via javascript/html5 or flash on my webserver. The javascript/html front end calls a script on the server which begins generating an mp3 file.

I want the file to begin playback immediately once enough audio is buffered, and to continue playing.

I am new to streaming and want to know the best method to do this in both apache server and windows iis.

At first I thought I would need to use an actual streaming protocol, such as rtp or rtsp, but it seems like it maybe better using a custom javascript player that takes the mp3 file in via http. However the concern with http is that the file transfer will stop once the incomplete tail of the mp3 file is hit. Is there a way around this, perhaps altering the config to make the apache/iis server wait until the file is complete before terminating the transfer?

I also looked into m3u files but this seems to require a complete mp3 file, although I'm not clear on it.

Any advice/solutions/examples will be appreciated.


回答1:


I don't have the exact solution, but you can try this http://learningsfromdotnet.blogspot.com/2011/11/playing-mp3-using-audio-tag-html-5-in.html.

I was trying to stream MP3 file from IIS server, had issue with Chrome because it makes a request with "Range" header. If you can make similar request with "Range" header and from server stream the piece of MP3, it might work.



来源:https://stackoverflow.com/questions/5655623/streaming-mp3-while-it-is-being-generated-on-the-server

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