18 December 2010
Getting started with OSMF & Flex 4 on the Linux Command Line
If you’re using Flex on the command line without Flex Builder, the documentation for getting up and running with OSMF is pretty slim. Here’s what has worked for me. (I upgraded to Flex 4 to get access to all of the OSMF features, but you should be able to do this with Flex 3 as well).
First, get the latest OSMF from the downloads page: http://sourceforge.net/adobe/osmf/home/. There’s an older version packaged with Flex 4, but OSMF is evolving very quickly so get the most recent.
Unzip that basically anywhere. It doesn’t fit neatly into the Flex directory structure, and if you try to replace the old OSMF files in the Flex package you’ll have problems building the asdocs, so just pop the new OSMF in the Flex home directory or something.
Now to get Flex to use it you have to tell the compiler where to find it, and add a few tweaks. Here’s my
mxmlc \ -compiler.source-path=/path_to_new_osmf/framework/OSMF/ \ -define CONFIG::LOGGING false \ -define CONFIG::DEBUG true \ -define CONFIG::FLASH_10_1 false \ -compiler.debug=true \ -static-link-runtime-shared-libraries \ YourFlexApp.mxml
That should get you running! Check out these resources for some basic examples. Keep in mind that since OSMF is changing so quickly, you may have to look around for where this or that package is hiding today…
Google on those CONFIG definitions to find out what they’re about. The most important one to note is that if you want to take advantage of HTTP streaming and DRM, you have to target Flash Player 10.1.
In order to properly bridge Flex and OSMF display components, you need to use the
MediaContainerUIComponentclass that’s available in a
pps/samples/framework. Then you can do like so:
// create the MediaContainer and add it to the app layout container = new MediaContainer(); var containerUIComponent:MediaContainerUIComponent = new MediaContainerUIComponent(); containerUIComponent.container = container; containerUIComponent.percentWidth = 100; containerUIComponent.percentHeight = 100; myFlexContainer.addChild(containerUIComponent);