[Red5] Using Flex videoDisplay with Red5
mikesyd at cybermike.net
Mon Aug 10 09:29:35 PDT 2009
This took me 3 days to figure out.. Hopefully, I can save anyone else
the difficulty I had figuring out how to make Flex videoDisplay and Red5
work to play a stream.
The problem, as I understand it now, is this: Adobe FMS invokes the
callback to onBWDone() AFTER the connection handshaking is completed.
The Red5 demo application invokes the callback to onBWDone() DURING the
connection handshake. Yes, I am using the demo application (oflaDemo)
because I don't know one shred of Java. (hint to Red5 developers: please
someone write a easy/simple config program and installer for this).
On the Flex side, Adobe's
mx.controls.videoClasses.NCManagerConnectClient handles the callback to
its onBWDone() function. This function assumes it has a valid and
active connection. With Red5, it does not.
To solve the problem, I made a local copy of the mx directory structure
and placed that in my .\src directory so now I have
.\src\mx\controls\videoClasses in my Flex project.
In this vidoeClasses directory, I have the NCManagerConnectClient.as
file. I also have the following file: .\src\mx\core\Version.as only
because NCManagerConnectClient has a relative reference to it. Both of
these files can be copied from [C:]\Program Files\Adobe\Flex Builder
Simply having the mx directory under .\src for your project overrides
the default mx controls build location with the files that you have in
the local directory. You can re-write any/all of Flex for a specific
project without affecting the base autobuild files this way.
In the onBWDone() function inside NCManagerConnectClient.as, I simply
removed the call to onConnet(). That's it. Presto done.
If you know Java - which I do _NOT_ and understand the Red5 architecture
(which again, I do not), you should be able to write a custom Red5
application that invokes the callback functions in whatever order you want.
I really hope this helps some folks coming down the same path that I did.
- Mike (aka Vortran)
More information about the Red5