文件打开时的文件 I/O(HTML5 Ogg 直播)
我有一个简单的问题:文件是在完成之前创建的,还是完成后创建的?
例如,我正在尝试使用 JSpotify 创建一个基于网络的 Spotify。我已经为它创建了一个在服务器上运行的接口。当按下播放按钮时,它将在服务器上播放(如果我想创建 Spotify 遥控器,这很棒)——但我想将其流式传输给用户。
据我所知,JSpotify 在播放之前会播放/转换 Spotify 的流为 ogg 格式。现在假设我将新转换的流重新路由到 ogg 文件(例如stream.ogg),我可以嵌入 html5 音频标签并将其指向stream.ogg 并让用户在stream.ogg 文件仍然存在时播放吗正在被写入,还是stream.ogg仅在java完全完成写入之后创建(当调用close()时)?
更进一步,html5 音频是否需要一个完整的文件来进行流式传输?我想这个问题与 ogg 格式有更多关系......
I have just a quick question: Are files created before they are finished, or are they finished and then created?
For example, I am attempting to create a web-based Spotify using JSpotify. I already have created an interface for it that runs off a server. When play is pressed it will play it on the server (which is great, if I wanted to create a Spotify remote) -- but I want to stream that to the user.
As near as I can tell, JSpotify plays/converts Spotify's stream to ogg format before playing. Now lets say instead I re-route that newly converted stream to an ogg file (say stream.ogg), can I embed the html5 audio tag and point it to stream.ogg and let the user play while the stream.ogg file is still being written to, or is stream.ogg only created after java is completely done writing to it (when close() is called)?
To take it one step further, does html5 audio need a completed file to stream from? I guess this question has more to do with the ogg format...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在我使用过的所有系统(而且数量很多)上打开输出或 I/O 时都会创建文件,RT-11 除外,它们在关闭之前不存在。但那是很久以前的事了。
Files are created when opened for output or I/O on all systems I have ever used (and that's a lot), with the exception of RT-11, where they didn't exist until closed. But that's a long time ago.
如果您有流,则可以使用 http: //docs.oracle.com/javase/1.4.2/docs/api/java/io/FilterInputStream.html 或 http://docs.oracle.com/javase/1.4 .2/docs/api/java/io/FilterOutputStream.html 将流内容同时重定向到您的客户端和文件。
If you have a stream, you can use http://docs.oracle.com/javase/1.4.2/docs/api/java/io/FilterInputStream.html or http://docs.oracle.com/javase/1.4.2/docs/api/java/io/FilterOutputStream.html to redirect the streamcontent to your client and the file at the same time.