2 Replies Latest reply on May 14, 2010 12:43 PM by RyanOConnell

    Flex integration




      I'm trying to integrate the fc1 drop into our Flex application.


      1) It would be great to be able to bind on the MediaPlayer properties.

      I've made a subclass, FlexMediaPlayer, that declares ChangeEvents for a bunch of properties:


      [ChangeEvent(name="mutedChange", type="org.osmf.events.AudioEvent")]

      override public function get muted():Boolean


           return super.muted;


      I presume that the ChangeEvents are not declared on MediaPlayer to keep the osmf core AS3-only/no-Flex compatible?


      2) I've adopted org.osmf.samples.MediaContainerUIComponent and been trying to bend my brain to the MediaPlayer / MediaContainer split.
      So far I understand MediaPlayer to be something of a "model-controller" class and the MediaContainer to be the "view".
      It is useful to have access to the MediaPlayer from MediaContainerUIComponent so I've added a FlexMediaPlayer property to it.


      3) It seems cumbersome to have to set an element on both the MediaPlayer and add it to the MediaContainer.
      Since MediaContainerUIComponent now knows about MediaPlayer (#2 above) I've made it listen for changes to the element and add/remove it from the view -- making the assumption that there is one element per container. It also adds a default layout to the element if no layout is present on the element.


      Could #1 and #2 be considered good practice for Flex-based apps using osmf?
      What about #3?
      I hope someone can clarify if I'm missing something...


      thx in advance!
        • 1. Re: Flex integration
          smarcus99 Level 1

          I've just (re)discovered FC1's MediaPlayerSprite and see that it does what I list in #2 and #3!


          So I've marked this question as answered.


          But if someone knows why #1 is a bad idea -- or has a better way -- many thanks...



          • 2. Re: Flex integration

            #1 is a great idea,  I even push for it during the original MediaPLayer design phase.  Given that [ChangeEvent] is a flex specific tag, that generates flex specific bindings, we left these out to help keep framework pure AS3.  ChangeEvent/Binding tags had dependencies on some mx.binding classes that we didn't want to have to force every player developer to include in their project.  A wrapper is a great idea, and it would help ease flex developers into using OSMF from the MXML  standpoint.