Publishing and Viewing a VideoStream using Flex & FMS

This post deals with how you would publish and broadcast an Audio and/or Video Stream using FMS (Flash Media Server) and Flex.

You would need to have FMS installed on your system (you can get a free developer edition if you don’t have one) and Flex of course 🙂

To publish a stream, you would require a WebCam and/or Microphone hardware. You would also require the following files

publish.mxml | NetConnectionClient.as

Now lets look at publish.mxml. These are the steps to be followed

  • A NetConnection Object has to be used to connect to the FMS Server. This is done in the initConnection() method in the code.
  • The client propery of the NetConnection Object is set to a particular class (Indicates the object on which callback methods should be invoked.)
  • objectEncoding is set to AMF0 (Action Message Format) since FMS2.0 is built on AS2 which uses AMF0 while Flex is built on AS3 which streams using AMF3 by default.

Once the connection is established using the NetConnection Object, it generates a netStatus Event. You can then tap into this event and check if the connection is established. Once the connection is established you can publish the stream, using the NetStream Object.

Once the stream is published, you can write another application to tap into it…. Here’s an example that lets you do that.

view.mxml

 

Advertisements

3 Responses to Publishing and Viewing a VideoStream using Flex & FMS

  1. ian says:

    awesome! awesome! awesome!

    Thank you so much.

    Great tutorial!!

  2. Darshan says:

    Plz send me all mxml file as links are missing plzzzzzzzz

  3. Denesh says:

    Please send with mxml source files of connecting fms with netconnection and netstream with source of connecting audio file using FMS 3.5 and FLEX 3

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s