2 Replies Latest reply on Aug 26, 2010 9:43 PM by bringrags

    F4M and ProxyPlugins

    David_RealEyes Level 1

      So running into a slightly interesting situation and wonder if there is a recommendation on how to best handle.


      We are using a proxy plugin and it is set to handle any resource type, and I noticed when the main resource being loaded is a F4M file the proxy plugin create media element function is called twice. To be more specific the current F4M I am testing with is a dynamic stream F4M. I see in debugging the create media element function is first called with a URLResource, then again for the DynamicStreamingResource.


      This seems problematic and I am not sure of the best way to handle this. If I do nothing, it generates additional proxy elements and the last one doesnt even work. I did a test where I do not return true for the can handle resource function when it is a DynamicStreamingResource and the video works, but I am guessing for other types of F4M files that will be a problem.


      What is the best way to handle this?

        • 1. Re: F4M and ProxyPlugins
          David_RealEyes Level 1

          I tried checking to see if the extension is F4M in my can handle resource function - and if so pass false. Video plays fine, but for some reason if i play another video after first one in the same session I get the following error:


          RangeError: Error #2006: The supplied index is out of bounds.

          at flash.display::DisplayObjectContainer/setChildIndex()

          at org.osmf.containers::MediaContainer/onSetChildIndex()[C:\_projects\_FlashMediaResources\O SMF\_workspace\OSMF\org\osmf\containers\MediaContainer.as:360]

          at flash.events::EventDispatcher/dispatchEventFunction()

          at flash.events::EventDispatcher/dispatchEvent()

          at org.osmf.layout::LayoutRendererBase/addToStage()[C:\_projects\_FlashMediaResources\OSMF\_ workspace\OSMF\org\osmf\layout\LayoutRendererBase.as:808]

          at org.osmf.layout::LayoutRendererBase/prepareTargets()[C:\_projects\_FlashMediaResources\OS MF\_workspace\OSMF\org\osmf\layout\LayoutRendererBase.as:784]

          at org.osmf.layout::LayoutRendererBase/measure()[C:\_projects\_FlashMediaResources\OSMF\_wor kspace\OSMF\org\osmf\layout\LayoutRendererBase.as:414]

          at org.osmf.layout::LayoutRendererBase/validateNow()[C:\_projects\_FlashMediaResources\OSMF\ _workspace\OSMF\org\osmf\layout\LayoutRendererBase.as:402]

          at org.osmf.layout::LayoutRendererBase$/onExitFrame()[C:\_projects\_FlashMediaResources\OSMF \_workspace\OSMF\org\osmf\layout\LayoutRendererBase.as:927]

          • 2. Re: F4M and ProxyPlugins
            bringrags Level 4

            The createMediaElement function is being called twice because the first call is for the F4M resource, and the second call is for the video that the F4M document encapsulates.  Keep in mind that an F4MElement (which is what the F4M resource will generate) is itself a proxy element which proxies another element that the MediaFactory creates.  So if your canHandleResource function always returns true, then the corresponding createMediaElement function may also get called for the video within the F4M document.  (The fix you describe, of only returning true if the resource is an F4M file, seems appropriate.  Not sure why you get the RTE for the DisplayObject though, I'd probably need to see/run the code.)