views:

31

answers:

2

I am attempting to create a custom FLV player in flash that will allow me to link to an external FLV file in the html object code. This is in order to easily change a video that will appear on a client's index page dynamically. Currently I am using an external player that does exactly what I wish to do (http://www.walkernews.net/mediaplayer.swf). However the client I'm building the site for requires a custom built player. My abilities in Flash (CS3) are limited but I have scripted in ActionScript and worked in Flash many times before.

The HTML code I'm using is as follows.

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" width="720" height="480">
     <param name="flashvars" value="file=http://localhost/videos/video_test.flv" />
     <param name="movie" value="http://www.walkernews.net/mediaplayer.swf" />
     <embed src="http://www.walkernews.net/mediaplayer.swf" width="720" height="480" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="file=http://localhost/videos/video_test.flv" />
</object>

As I stated, this links to a free third-party player, which is great, but I'd really need to build to my own. I have built a basic player in flash already using the FLVPlayback control, but am unsure on the details of making it dynamic.

If anyone can point me to a guide, or in the right direction, I would surely appreciate it as google searching hasn't returned any useful results. Thank you for your time.

A: 

Actionscript 2 or 3? (They're quite different)

You'll find some useful information on obtaining and customising your FLVPlayback skin here, and in AS2 I believe there's a pretty big hole in the FLVPlayback class, as soon as you do...

flvPlayer.contentPath = 'my_url.flv';

...it begins streaming, and there's nothing you can to then stop the stream, even removing the component won't halt the initiated download.

For this reason, many people choose to subclass the component, no doubt you'll find countless examples with (hopefully now) narrower searching.

This SO post tells of some woes with the FLVPlayback component, improper destructors and such.

So. Tips. SO/Google how to subclass the FLVPlayback component, and be aware there are memory issues.

Hope this is at least some help!

EDIT: You may also find this link useful http://www.longtailvideo.com/players/jw-flv-player/

Danjah
A: 

For the dynamic side , you can use flashvars to set the video url. This is a fairly easy solution , that may also require a bit of PHP knowledge in order to change the client's url on the server side, then feed it to flashvars.

You could also do the query from Flash and feed the resulting url to your player. There are numerous ways to do this and then again , this is more of a server side issue. After you're established how to keep your video/clients records, you can decide what's the best way to query them and return the result to Flash.

You should easily find information about flashvars and Flash/PHP communication.

On the player front, if compatibility with FP9 is not an issue, I would recommend OSMF, check this blog
http://www.rblank.com/
You should find the code for a basic player , you can then extend on.

PatrickS