View Full Version : Getting the url in flash and integrating it with the video player?
Rockonmetal
04-22-2008, 10:28 PM
I am trying to make a video player that will save space on my website. Since my site will have videos uploaded from users which then the videos automatically get put on my site.
I have the flv component player on the stage and i gave it an instance name of "player". I am totally helpless when it comes to action script.
What I want to do is to have flash grab the url and in the URL like below:
http://localhost/new/video.php?watch=id
The highlighted part is what i want the video player to grab the id and search through a directory probably going to be videos/ to grab the content.
Thanks in advance,
Medyman
04-22-2008, 10:56 PM
Hey Rockon...
Have you tried asking Flash nicely? That usually works for me :p
What you're looking for here is flashVars. FlashVars are, as the name implies, variables that you set outside of a .swf file. So, you can easily pass dynamic variables to flash at runtime. Flashvars go directly into the embed code on your HTML page.
So, you would add something similar to this to your page:
<PARAM NAME=FlashVars VALUE="id=80">
Since you're using PHP, you can easily parse the URL and echo the id number into the code.
With some quick googling, I found this: http://www.permadi.com/tutorial/flashVars/
There are probably better tutorials out there, but I don't have the energy to look right now. I'm sure you can easily find better ones if that one doesn't explain everything.
Also, on a design note...
I find the Flash components to be hideous. So, if you're interested in building your own flash video player, I'd suggest that you check out the tutorials at www.gotoandlearn.com by Lee Brimelow. The video tuts are towards the bottom of the page. He walks you through the process, step by step so anyone can make one and you can alter it to fit with the design of your page.
Hope that helps. Post back if you have more questions. :D
Rockonmetal
04-23-2008, 01:58 AM
Another question i have that sorta applies to this topic... Is there a way to convert videos users upload to flv format automatically as they upload them?
Thanks
Medyman
04-23-2008, 03:16 AM
Another question i have that sorta applies to this topic... Is there a way to convert videos users upload to flv format automatically as they upload them?
Thanks
Yes, but they're all expensive solutions. You want to look into the Flash Media Server (http://www.flashcommunicationserver.net/faq/flash_video_technical_faq.htm).
We (i.e. my web design/development company) use it sporadically for some of our bigger clients. If it this is within your means and you want some more info, I can provide it if you want.
Rockonmetal
04-23-2008, 08:05 PM
K thanks... I'll check it out... I am having some problems with the video player... The code in the action script for the player is:
import mx.video.player;
player.contentPath = ID;
The parameter line is:
<PARAM NAME=ID VALUE='videos/" . $row['id'] . ".flv'>
The row['id'] thing is correct... I think I just haven't linked the video properly in flash
If someone could help that would be great...
Medyman
04-23-2008, 09:59 PM
The param name always has to be Flashvars
<PARAM NAME=FlashVars VALUE="ID=videos/2.flv">
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.