Flash AS3 video start and stop

C++, C#, Java, PHP, ect...
Post Reply
User avatar
Ravinos
Posts: 281
Joined: Tue Sep 15, 2009 4:14 pm

Flash AS3 video start and stop

Post by Ravinos »

I really didn't know how to word the title for this post sorry if it doesn't express what my question is.

What I need is someone to point me in the right direction not necessarily spoon feed me the code. I'm currently trying to figure out a way of getting a flash video played on my website to start at a certain time code and end at a certain time code based on a XML file.

Our system records video news feeds directly to the web server that we are trying to make smaller clips of it without using standalone editing software.

Example: So say I have a master video file that is 2:00 minutes long and I want clip one to start at :30 and end at :60 seconds.

How would I get the flash player on the site to play only those time codes saved in the XML file? This needs to be done dynamically when the video is called. In reality these video clips are 30 minutes long and we usually need 5 or so clips made from each one. Our current method is to hack up the video file in Adobe Premiere and then post up each clip. We are looking for a something a little more dynamic.

Also if anyone knows an esier way of doing something like this using Javascript, HTML5, or AJAX please let me know.
User avatar
Ravinos
Posts: 281
Joined: Tue Sep 15, 2009 4:14 pm

Re: Flash AS3 video start and stop

Post by Ravinos »

// AS3
var customClient:Object = new Object();
customClient.onCuePoint = cuePointHandler;
customClient.onMetaData = metaDataHandler;

var myVideo:Video = new Video();
addChild(myVideo);

var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
ns.client = customClient;
myVideo.attachNetStream(ns);
ns.play("testcuepoint_1.flv");
ns.seek(120);

i think i've found my work around. the above code is an example of what i've been working with. ns.seek(50); works great for my purpose, my actual code pulls the seconds variable from the metadata. this sets the videos in point but I can't for the life of me figure out how to get it to stop. of course it isn't as simple as doing something like ns.stop(60); does anyone know the proper code to get it to end play back at a certain point?
User avatar
Chris
Posts: 1581
Joined: Wed Sep 30, 2009 7:22 pm

Re: Flash AS3 video start and stop

Post by Chris »

Are you making the video streamer yourself?
Fighting for peace is declaring war on war. If you want peace be peaceful.
User avatar
Ravinos
Posts: 281
Joined: Tue Sep 15, 2009 4:14 pm

Re: Flash AS3 video start and stop

Post by Ravinos »

Yeah everything from scratch. So far so good.

The answer to my last problem was so simple and I totally overlooked it....all I had to do was fire a timer that ticked every second to see if i had reached the outpoint i wanted. Then it stops the movie and returns it to first frame. I have a tendency to over complicate things.

My next goal is to make a web app that allows you to set the inpoint and outpoint yourself quickly. My last attempt wasn't that good so I'm starting over. Also while I was working on this....I was pondering a flash based "choose your own adventure style game".... inspiration comes from the strangest places sometimes.
User avatar
Chris
Posts: 1581
Joined: Wed Sep 30, 2009 7:22 pm

Re: Flash AS3 video start and stop

Post by Chris »

Nice, so you got it all sorted?

Good luck with the game ;).
Fighting for peace is declaring war on war. If you want peace be peaceful.
User avatar
Ravinos
Posts: 281
Joined: Tue Sep 15, 2009 4:14 pm

Re: Flash AS3 video start and stop

Post by Ravinos »

Yes I did. I'm currently working on a new version of the clip editor that allows you to set the in and out points. So far so good.

If this pans out I may be making some serious bank. There aren't many apps like this out there that can be hosted from a local server. I plan on packaging and selling a CMS script for news agencies, blogs, and hosting services eventually.

My work uses something similar to this but the problem is that it is overly complicated with too many steps as in you must do 5 separate edits to a story to post it. Mine works with just one. Fast, easy, and user friendly is the idea behind mind. It also saves space on the disk and reduces bandwidth by 75% so far in my early tests.

Unfortunately working on this has eaten all my game developing time :(
Post Reply

Return to “Coding”