views:

1335

answers:

4

So would like to do: get an flv file from a protected directory and feed it to a swf embedded player as a parameter using PHP.

Is this possible?

Sending the contents of the file to the embedded player does not seem to work.

A: 

Well, since the player requires that the client fetches both the player and the FLV from the server, I suspect that this would require a temporary location from which the FLV is made accessible to the user via a URL. The most obvious solution is to create an expiring URL that times out in a reasonable amount of time, preventing users from linking directly to the FLV. I'm not sure if there's a way to keep it protected beyond this without embedding the address to the file in the flash itself dynamically - basically, you can't use a general purpose player that takes a URL for the FLV as a parameter if additional protection is required.

Edit: Here is a potential solution using the JW player: Code URL in V4 for protection against leechers

And here is another possible solution along the lines of my original comment: Flashcomguru.com: 'Streaming' flv video via PHP, take two

bchang
A: 

The Flashcomguru link look promising, not sure I understand this stuff however. I'm not a Flash guy but I know someone that may be able to help.

I'm also not sure how to create a 'create an expiring URL"

A: 

Not sure what you mean with "feed it to a swf embedded player as a parameter using PHP", but looks like what you want to do is this:

  1. Store your flv file somewhere outside the DocumentRoot in your server.
  2. Create a PHP script that based on some parameter, reads the flv file and serves it. I'm assuming that you are planning to have some authentication in this php script to prevent anyone from just calling your PHP script and getting the flv as if it was in the DocumentRoot
  3. Create an swf clip that will call the PHP script to retrieve the flv to the client.

If that is what you want, the part of the script in 2 that reads and serves the flv should be pretty straight forward using the standard file accessing functions from the PHP API and setting the appropriate content-type header before echoing it out.

palako