Streaming video file?

為{幸葍}努か 提交于 2019-12-24 04:10:23

问题


I need to stream an flv file. Streaming should look like live streaming, and I there should be a way to change the target file.
Sorry for my poor English.


回答1:


If by "streaming" you mean "showing a flash-video clip", flv-streaming isn't really streaming, but it's a normal file transfer, with the flash player starting playback even if the file isn't completely downloaded to the client. Time seeking is implemented in a standard HTTP way, with a file download offset - if you scroll the video halfway on the timeline and it hasn't downloaded yet, the current download is (most often) aborted, and restarted with an offset of filesize/2 bytes.

So, you could be fine with just using plain old readfile() and fixing the HTTP mime-type headers appropriately with header(). But, since you'd need seeking, you need to parse the HTTP request and instead of readfile(), use fpassthru(), seeking the right place, instead.

tl;dr: Avoid handling this on the PHP side, and let Apache (or the httpd of your choice) handle this instead.




回答2:


I'm not quite sure what you're asking about, but if you have a bunch of media files and want to play them with a Youtube-esque media player on your website, I suggest checking out Flowplayer - It has an amazing Javascript API that lets you do all kinds of cool stuff to the player, including handling stuff like playlists and programmatically changing the current video.

I recently used it on a project with great results.



来源:https://stackoverflow.com/questions/847018/streaming-video-file

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