-
Requesting flv files dynamically
Hi Flashers,
I'm working on a flash video project and have come across an issue whilst requesting flv files dynamically. I was hoping you might be able to help.
Basically, the swf grabs corresponding video files using flashvars provided by PHP. It seems when ever a question mark is added into the path, the path breaks and flash either doesn't know how to locate the file or it doesn't know what to do with it.
flashvar from PHP:
url=http://localhost:8888/includes/retrieve.video.php?videoID=9
Actionscript:
flv.contentPath = url;
A few ideas I've tried:
It will work if I insert a static url in the PHP but as soon as I implement variables (question mark or &), it doesn't know what to do!
I've also tried urlencode to pass the special characters (questions marks, & etc.).
I've tried adding .flv to the end of the path using php and then in the actionscript, no luck.
Whilst testing, i was using absolute paths. In apache, I've noticed flash adds FLVPlaybackVersion=version to the url request. I've fixed this by using relative urls....again, no luck.
Any ideas or help would be greatly appreciated!!
Best regards,
Luke.
-
-
How are you encoding the variables? Without having a look at your code, that's what I would guess as the culprit. Have a look at this article about URL encoding if need more guidance on that front.
-
-
Fixed!
Using Apache web server, we managed to find the work around.
This is the url we need to request but flash doesn't handle file requesting with special charters - ? or &. so this wont work: http://localhost:8888/includes/retri...%3FvideoID%3D9
But if we use this url, it works:
http://localhost:8888/includes/retrieve.video.php/9/f
Adding this to your php file, will do the trick.
$vars = explode("/", $_SERVER["PATH_INFO"]);
$_GET['videoID']=$vars[1];
$_GET['type']=$vars[2];
So at the end the url you request is
http://localhost:8888/includes/retrieve.video.php/9/f
Last edited by lukebrisbane; 10-24-2008 at 04:02 PM.
Reason: incorrect solution
-
-
Hmm...creative workaround.
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks