2

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.

Jim Simson
  • 2,774
  • 3
  • 22
  • 30
Kombuwa
  • 1,613
  • 4
  • 20
  • 35

2 Answers2

4

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.

Henrik Paul
  • 66,919
  • 31
  • 85
  • 96
0

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.

Paolo Bergantino
  • 480,997
  • 81
  • 517
  • 436