18 Replies Latest reply on Nov 14, 2010 12:16 AM by MarioVieira.net

    OSMF with Flex examples


      Hi there,


      I'm looking for a Flex flash video player that can be skinned using CSS and was hoping OSMF might be the answer. Somehow, I can't seem to find any examples of it? They all seem to be Flash related.



        • 1. Re: OSMF with Flex examples

          I haven't seen that OSMF has any CSS parsing/skinning capabilities built in, but it does have an example of a FlexUI component:

          MediacontainerUIComponent under apps\samples\framework - you can use that as a base Container for OSMF and build a larger Flex component on top of it.


          I think you'd have to construct your own system for reading in CSS, while you can use the Chrome skinning interface (example is the OSMFPlayer under apps\samples\framework) - that only seems to allow for a fixed external fonts. You might be able to pull in an assign different fonts to different assets, but I haven't experimented with that.



          • 2. Re: OSMF with Flex examples
            ttehify Level 1

            Hi there,


            Thanks for your reply! Ouch.. well that's not really gonna work for me. I was hoping that I can use a CSS file to be shared for my Flash players and HTML 5 players. Anyway, I'm having compilation issues when building a simple media player using OSMF and Flex 4.


            1. The OSMF.swc bundled with Flex 4 just wasn't able to recognize the MediaPlayerSprite type

            2. I copied the OSMF.swc from the source code and it wouldn't compile my mxml file because the of some signed-digest thing that wasn't found in the catalog. It requested me to compile the file again but I have no idea what to do. I tried compc but am completely lost at what options to use. Please help?

            • 3. Re: OSMF with Flex examples
              ScreenName1710b Level 1

              There is a new OSMF.swc available from Adobe on the OSMF downloads page, do not use the OSMF.swc that is packaged with Flash Builder 4 as it is not the most recent.


              I have had the most success in compiling from the raw AS3 source files found in the SVN trunk of the OSMF project, as there are also updated changes in those files as well. However, if you have need for the SWC, then re-compiling it yourself is an option.


              Also, make sure that you have added your additional compiler settings for OSMF:

              -define CONFIG::LOGGING false -define CONFIG::DEBUG true -define CONFIG::FLASH_10_1 true


              FLASH_10_1 set to true is required for HTTP streaming - but all of these settings are required to be present in the compiler build statement.


              • 4. Re: OSMF with Flex examples
                ttehify Level 1

                How would I be able to compile from the raw AS 3 source files and integrate it? Specifically, what would a sample command of compiling look like? I'm fairly new to Flex and have only ever compiled mxml files.


                I get an error mentioning that MediaContainer type was not found - would that relate to my library?


                I followed this code but was not able to compile:


                • 5. Re: OSMF with Flex examples
                  rshin Level 3

                  That example appears to be based on the old version of OSMF. Since then there were API changes that won't complie with OSMF1.0.

                  Have you imported MediaContainerUIComponent and it says no type MediaContainer found?  What version of OSMF.swc or library are you using?

                  Are you using Flex builder (Flash builder)?



                  • 6. Re: OSMF with Flex examples
                    ScreenName1710b Level 1

                    To get to the compiler in for the "define settings"

                    Click on the Project top folder> Right Click > Properties > Flex Compiler

                    Add the above info to "Additional compiler arguements:" space.


                    Download the OSMF Trunk via SVN to a directory.

                    In the project properties select "Flex Build Path" and under Source Path add that folder.


                    Remove in the Library under flex 4.1 (or whatever SDK) the OSMF.swc (as that will cause a conflict).

                    Make sure you have downloaded the most recent "playerglobal.swc" from AdobeLabs, then you'll want to "Add SWC" and link that swc to you project.


                    Maybe not the best example link because some of the tags aren't closed and seem to be misplaced, could be used with some corrections, but I don't have the time to make them for you.  Highly recommend the the media component above for flex, but it still will require you to add some code to get it to work.


                    • 7. Re: OSMF with Flex examples
                      ttehify Level 1

                      I'm using the command line compiler. I downloaded the swc off of the downloads page linked from the OSMF website. Here's what I do and here's what I get back:

                      I tried to compile it with:

                      mxmlc osmf.mxml

                      and I get back:

                      Error: No signed digest found in catalog.xml of the library, /opt/flex/frameworks/libs/osmf.swc. Compile the library with -create-digest=true and try again


                      Code is shown below

                      <?xml version="1.0"?>

                      <!-- mxml\HellowWorld.mxml -->

                      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="init()">


                              import flash.display.Sprite;

                              import org.osmf.media.MediaPlayerSprite;

                              import org.osmf.media.URLResource;


                              public function init():void {

                                  var sprite:MediaPlayerSprite = new MediaPlayerSprite();



                                  sprite.resource = new URLResource("http://mediapm.edgesuite.net/strobe/content/test/AFaerysTale_sylviaApostol_640_500_short.f lv");




                          <mx:Panel id="panel" title="My Application"






                              <mx:UIComponent id="videoContainer"/>




                      • 8. Re: OSMF with Flex examples
                        ttehify Level 1

                        Would there be any chance of doing this through command line?


                        I'm hoping everything will all build and compile on Solaris as well.

                        • 9. Re: OSMF with Flex examples
                          ScreenName1710b Level 1

                          Unfortunately, using the command line compiler isn't a forte of mine, and I'd have to defer to someone else with more experience with it.

                          Basic overview of what I think you'll need to do - add in the "source path" of the osmf source files (-source-path ?), add in the definition statements, (-define CONFIG::DEBUG false etc.).


                          Since there's a bunch of different settings that you'll have to set, then looking up how to build a configuration xml file would probably be best for expediency - that information can be found online with the mxmlc compiler docs.



                          1 person found this helpful
                          • 10. Re: OSMF with Flex examples
                            rshin Level 3

                            Here's some feeback from Flex folk


                            What build of Flex are you compiling with? Where did you get osmf.swc?


                            The quick solution to your problem is to turn off RSLs by compiling with the  "-static-rsls=true" option.


                            They think that this sounds like rsl so can you try this?



                            • 11. Re: OSMF with Flex examples
                              Andrian Cucu Adobe Employee

                              You can also try to use an ant task for compiling your project. It might be easier then using the command line directly.


                              Here is a sample build.xml that might get you started:



                              It sets the necessary compile options, and builds both the OSMF library and a player that uses it. You can target either 10.0 or 10.1 by changing the properties files.


                              Hope this helps,


                              1 person found this helpful
                              • 12. Re: OSMF with Flex examples
                                ttehify Level 1

                                Thanks Ryan.


                                I got the osmf.swc from http://opensource.adobe.com/wiki/display/osmf/Downloads

                                I used both the source.zip and the the standalone one.


                                I'd like to try compiling it but I don't know how to. I mean I have tried looking at compc but it looks like I also have to specify every single class I want to compile? Given the amount of classes in the osmf framework, I reckon it would probably take a while for me to find all the ".as" files and specify them. Furthermore, I am unfamiliar with all the other options required so it'd be nice if you can show me how you guys compiled the existing osmf.swc?



                                • 13. Re: OSMF with Flex examples
                                  ttehify Level 1

                                  Thanks! This sounds perfect.. I'll try it out!

                                  • 14. Re: OSMF with Flex examples
                                    ttehify Level 1

                                    Hi Ryan,


                                    I managed to compile it indeed with that solution. Does this mean that all the related libraries are within the swf?


                                    The swf file is unfortunately quite large.

                                    • 15. Re: OSMF with Flex examples
                                      daslicht Level 2


                                      I am looking for a Flex Player example which can play .f4m files and listen for Cue points.



                                      My first try, but I get :


                                      Error: The specified capability is not currently supported





                                                     import mx.events.FlexEvent;
                                                     import org.osmf.containers.HTMLMediaContainer;
                                                     import org.osmf.elements.HTMLElement;
                                                     import org.osmf.elements.VideoElement;
                                                     import org.osmf.media.MediaElement;
                                                     import org.osmf.media.MediaPlayer;
                                                     import org.osmf.media.URLResource;
                                                     import org.osmf.metadata.TimelineMetadata;
                                                     [Bindable] private var player:MediaPlayer = new MediaPlayer();
                                                     [Bindable] private var stream:String = "";
                                                     //private var embeddedTimelineMetadata:TimelineMetadata;
                                                     private var media:MediaElement = new VideoElement(new URLResource(stream));
                                                     protected function application1_creationCompleteHandler(event:FlexEvent):void
                                                          media = new  VideoElement( new URLResource(stream));
                                                          player.media =  media




                                      • 16. Re: OSMF with Flex examples
                                        MarioVieira.net Level 1



                                        I got OSMF 1.5 up for Flex 3 and 4. It's the actual playback and controls, you would be free to add your buttons as you want.



                                        Hope it helps!


                                        • 17. Re: OSMF with Flex examples
                                          daslicht Level 2

                                          What about *.f4m File Playback ?

                                          • 18. Re: OSMF with Flex examples
                                            MarioVieira.net Level 1

                                            just addded this player type

                                            select "flashMediaManifestF4M" for playerType in the OSMFPlayer