简体   繁体   English

在服务器上生成流式mp3时

[英]Streaming mp3 while it is being generated on the server

I am trying to stream an mp3 via javascript/html5 or flash on my webserver. 我正在尝试通过javascript / html5或我的网络服务器上的Flash流式传输mp3。 The javascript/html front end calls a script on the server which begins generating an mp3 file. javascript / html前端在服务器上调用一个脚本,该脚本开始生成mp3文件。

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. 我是流媒体的新手,并且想知道在apache服务器和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. 起初我以为我需要使用实际的流协议,例如rtp或rtsp,但使用自定义javascript播放器通过http接收mp3文件似乎更好。 However the concern with http is that the file transfer will stop once the incomplete tail of the mp3 file is hit. 但是,与http有关的问题是,一旦mp3文件的尾部不完整,文件传输将停止。 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? 有没有办法解决此问题,也许更改配置以使apache / iis服务器等到文件完成后再终止传输?

I also looked into m3u files but this seems to require a complete mp3 file, although I'm not clear on it. 我也查看了m3u文件,但这似乎需要完整的mp3文件,尽管我不清楚。

Any advice/solutions/examples will be appreciated. 任何建议/解决方案/示例将不胜感激。

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 . 我没有确切的解决方案,但是您可以尝试使用此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. 我试图从IIS服务器流式传输MP3文件,Chrome出现问题,因为它发出带有“ Range”标头的请求。 If you can make similar request with "Range" header and from server stream the piece of MP3, it might work. 如果您可以使用“ Range”标头发出类似的请求,并从服务器流中获取MP3,则它可能会起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM