View all of irock195's updates Kontained: 13 months ago

AS3 and FMS2

description of image

Okay, so I had to connect up some AS3 stuff to Flash Media Server 2 today. I've had all kinds of woes with Flash and video over the past few years. So I thought I'd post some information about it. I typically use a Video Object and add it to the stage. I rarely utilize components cause I'm not a huge fan. I have found that components are GREAT for testing video in flash though. Anyway, I figured I'd post up some of my findings here since I gathered this information from all over the place and now it's in my brain. This is just for playing videos that reside on an FMS as well. I'm not streaming anything to them or any other such tom foolery.


Know:

1) Your FMS works. I've tested this with a video component and a direct path to the movie. I've also asked the server admin Both solutions seem to work.


1a) What version of the FMS you are going to connect to. Once again, pick up the phone, and call the server admins. This is a pretty direct method, but we're here for results folks.


2) Your videos work. Make sure they're encoded right. If they're H.264 and have audio make sure the audio is encoded with AAC. Bonus Score - Make sure it's encoded with meta data. It's useful. You can use the Adobe Media Player to play and test FLVs you may have laying around.


3) At least one awesome dance move. Cause after you figure out Flash and Video you should perform a dance move. I choose a sweet aerial ninja kick.


Enough crap already. Download this Document class! It's got pretty much everything you need to connect to an FMS and stream a video. What doesn't it have? A server and video path. You've got to provide those cause I can't give you mine. I've commented the file in the layman's terms that I know so its fairly understandble if you have a decent knowledge of AS3. (By decent, you should know how to use a document class, what an event listener is and how to use them.)


Things to be aware of when playing with flash and video.

-- ASyncError! ARRRRRGH. What the hell are you? Its an error that occurs after a function has been called. This can and might happen. Solution, listen for it and handle it. I've found that ASyncErrors don't usually call down the wrath of Khan on my apps.


-- onBWDone! This is for bandwith checks. I haven't built any apps where this is needed. But if you're using AS3 + FMS + Trickery you may see this in an async error or just hanging out in your output window giving you the finger. Solution: Make sure the Net Connection object has a client defined ( even if it is itself: nc.client = this; ) and make sure you have a PUBLIC function onBWDone. public function onBWDone():void{}


-- Stream Not Found! OMGWTFBBQ! I know the path is right. It's just being a jerk face. Well, hold on there name caller. When you write netstream.play("myawesomevideo.flv"); You're doing it wrong. When requesting a video from an FMS you have to drop the '.flv' If you're going to be using progressive downloading, leave it in.


-- My nifty video doesn't have any sound. Well, if you're using H.264, you need to make sure the audio is encoded with AAC.


-- Still having lots of problems? A weird error in your output window? Try this. Go on over to the Flash output window and right click on the error. Hit 'copy description'. Paste it into a Google search box. Press enter on your keyboard. Wait a second. Click on the links that appear to find out the answer. Seriously. Use the flash community! It's huge.

Share this entry

Close
Invalid e-mail format, please try again

Your friends will be notified via email about this entry.

Remove Email

You are about to remove the selected emails from your list. Are you sure you want to remove them?

Yes
Cancel
Select All Deselect All Remove Selected

Share with third party communities This will take you to a new window.


Report Inappropriate Content

Close
Details
Operations

Thank You!

The safety and legitimacy of Kontain's content is paramount to us. We will be investigating this content shortly. Here is what you reported:

Report Category Harmful of Dangerous Acts Report Detail Drug Abuse
Additional Information

Lorem ipsum dolor sit amet consectetuer adipiscing elit penubrum purous

Comments (1)

What do you think?

Collapse

More from irock195

  1. Lights and Sounds and Particular 2

    Lights and Sounds and Pa...

    10/09/09 1465 views
  2. Multi-touch Mice? What do you think. [ Discussion ]

    Multi-touch Mice? What d...

    10/06/09 2569 views
  3. KKlass A14 | Lampard

    KKlass A14 | Lampard

    09/03/09 2218 views
  4. Fire Girl! Flame on!

    Fire Girl! Flame on!

    08/25/09 2476 views
  5. Kontain Theme: Love and Hugs

    Kontain Theme: Love and ...

    06/18/09 2065 views
  6. Minitutorial : Rotate Arbitrary in Photoshop

    Minitutorial : Rotate Ar...

    06/16/09 2292 views

Subscribe to irock195

Feeds are an easy way to stay up-to-date with websites you love. Feeds automatically update and show you the newest content without you having to check. Read more here.

All you need is a Feed Reader, like these free ones for Mac and PC.

Close
Collapse

Featured Kontainers

Copyright © 2010 Kontain LLC. All rights reserved