Solved

Stream out file in PHP

Posted on 2007-03-29
1
4,355 Views
Last Modified: 2008-01-09
I'm making an application where members can stream out videos (as FLVs) a set number of times.

I know in ASP you can stream files out as I've done it. When I try it in PHP, the entire film has to download before the Flash applet starts playing. Due to the size of the videos this is hardly ideal.

This worked when I was testing the FLV directly (not going through PHP, just HTTP GETting it off the server).

Here's the important part of my code:

<?
session_start();
ob_start();

header("Content-Type: video/x-flv");
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");

$fh = fopen(realpath("filename.flv"), "rb");
fseek($fh, 0);
while (!feof($fh)) {
      print (fread($fh, 500));
      ob_flush();
}
fclose($fh);
?>

Either that or the flash player cannot understand what the data means, like it can via direct download. I don't know how to tell the difference.
0
Comment
Question by:OliWarner
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 23

Accepted Solution

by:
Zeffer earned 500 total points
ID: 18821856
so it has to Content-Type at fault..
the flv is being loaded like a swf ..
the php needs to let the player know it's a streaming flv ..like the other platforms it works on.
video/x-flv.. must be wrong..

and looking around..
this is for you..! almost at the bottom of the page//up a dozen posts..stefan has the same problem..
http://www.flashcomguru.com/index.cfm/2005/11/2/Streaming-flv-video-via-PHP-take-two

I hope this helps :)

Z
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question