3 Replies Latest reply on Dec 12, 2010 3:01 PM by Andrian Cucu

    Proxy Plugin




      I'd like to know if, in a proxy plugin, we have access to the MediaContainer which is containing the proxied media element ?



      Best regards

        • 1. Re: Proxy Plugin
          Andrian Cucu Adobe Employee

          Hi Coco213,


          A ProxyPlugin doesn't have access to the MediaContainer. You can try and pass a reference to the MediaContainer if you need it. I suppose you would pass it as Plugin Resource metadata and handle it in the initialize method.


          Check the plugin user guide for details: http://osmf.org/dev/osmf/OtherPDFs/osmf_plugin_dev_guide.pdf



          • 2. Re: Proxy Plugin
            Coco213 Level 1

            Hi Adrian,


            Thanks for your answer, but I don't really understand how to pass a Plugin Ressource Metadata in the initialize method.


            The chapter in the plugins guide about the initialize method is quite small, there is no example about how to do that ... do you have any snippet ?


            Thanks !




            • 3. Re: Proxy Plugin
              Andrian Cucu Adobe Employee



              Here is a player side snippet (it might contain spelling errors, i didn't check it with a compiler).


              var pluginResource = new URLResource("http://myserver.com/myplugin.swf");

              pluginResource.addMetadataValue("username", "myusername");

              pluginResource.addMetadataValue("password", "mypassword");


              var mediaFactory:MediaFactory = new DefaultMediaFactory();

              mediaFactory.... add events listeners





              Here is a snippet in a PluginInfo side:



              * SingleSignOnPluginInfo will read the username and password from the plugin metadata

              * and will create a SingleSignOnProxyElement that would handle the auth.


              public class SingleSignOnPluginInfo extends PluginInfo


              public const SSO_USERNAME:String = "username";

              public const SSO_PASSWORD:String = "password";


              public function SingleSignOnPluginInfo()


              var items:Vector.<MediaFactoryItem> = new Vector.<MediaFactoryItem>();


              var item:MediaFactoryItem = new MediaFactoryItem("org.osmf.plugin.singlesignon",









              override public function initializePlugin(resource:MediaResourceBase):void


              username = resource.getMetadataValue(SSO_USERNAME) as String;

              password =  resource.getMetadataValue(SSO_PASSWORD) as String;




              // Internals



              private var username:String;

              private var password:String;




              * Handles everything


              private function canHandleResource(resource:MediaResourceBase):Boolean


                   return username != null && password != null;






              * Creates a new MediaElement and sets on it the plugin metadata


              private function createMediaElement():MediaElement


              var mediaElement:MediaElement = new SingleSignOnProxyElement(null, username, password);

              return mediaElement;