3 Replies Latest reply on Dec 13, 2010 1:30 PM by deadcorporate

    How to use OSMF external linkage in plugins?

    Mykola3296 Level 2



      I'm writing a modular player based on OSMF.

      It's a pure actionscript project - so I use a makeshift preloader to load some custom libraries.

      OSMF is loaded in that way too.


      Player structure is based on MediaFactory plugin feature.

      I've tried to use an external linkage to OSMF there too and I'm getting a verify error (class not found) when loading plugins.

      I assume that is because plugins are being loaded in a different ApplicationDomain than my preloads are in. Here is an abstract from org.osmf.elements.loaderClasses.LoaderUtils class of OSMF:


      if (validateLoadedContentFunction != null)      {
            // Don't load into the default ApplicationDomain.  Instead,
            // we'll load into a child of the system ApplicationDomain
            // (so that class types) don't get merged.  If the validation
            // function returns true, then we'll execute a second load,
            // this time into the default ApplicationDomain (so that class
            // types are merged).
            context.applicationDomain = new ApplicationDomain();

      The class is hidden all the way in excluded and internal - so I need to redo the factory itself to avoid this in a legit way :O)

      Is there any way to avoid this problem? This would greatly improve the size of my plugins (plenty of them).


      Thank you!


      Best regards,


        • 1. Re: How to use OSMF external linkage in plugins?
          bringrags Level 4

          Plugins are loaded in two phases.  First, they're loaded into a separate ApplicationDomain so that we can verify that the version is compatible with the player's version.  Then they're loaded into the same SecurityDomain so that class types are merged.  It's not a good practice to use external linkage because you can never be sure that the player the plugin is loaded into will have all of the class types that your plugin needs (and you won't find out that a class is missing until the player tries to use it, as opposed to at load time).


          Note that there's an undocumented static property on SWFLoader called allowValidationOfLoaderContent.  If you set this to false, then the plugin loading will skip the first validation step.  This isn't a recommended practice, but if you absolutely know that your plugin is of the right version, then you could skip the first validation step.

          • 2. Re: How to use OSMF external linkage in plugins?
            Mykola3296 Level 2

            Brian, thanks for the tip!


            For now all the plugins are developed by ourselves and the only external library used is OSMF and couple of static const holders. OSMF is loaded using SWF taken from the SWC - so it has all the definitions required. So the problem you've mentioned is not a big deal for now. However the size of plugins are reduced greatly when using external linkage that is a requirement of a task.


            Thank you!

            • 3. Re: How to use OSMF external linkage in plugins?

              before someone else gets a stroke over this, it's allowValidationOfLoadedContent and not allowValidationOfLoaderContent...