10 Replies Latest reply on Jan 21, 2011 3:35 AM by __brndn__

    metaData events within nested serial and parallelElements

    __brndn__

      Hi all

      I am just trying to figure out why there are duplicted events on          

      value.addEventListener(MediaElementEvent.METADATA_ADD, onMetaDataAdd);
      value.addEventListener(MediaElementEvent.METADATA_REMOVE, onMetaDataRemove);

       

      when elements are wrapped via the SMIL plugin

       

        <ns2:seq>
                      <ns2:video src="rtmpe://cdn.com/mp4:e4/test/cms/clips/clip.mp4">
                          <ns2:metadata>
                              <ns2:meta content="preRoll" name="contentType"/>
                          </ns2:metadata>
                      </ns2:video>
                      <ns2:par>
                          <ns2:switch>
                              <ns2:video system-bitrate="1581000" dur="852" src="mp4:e4/HIGH_RES/00000418/41803.mp4?s=1292344952&amp;e=1292345702&amp;h=a0832fd166d3d d8b83cb6efb1ac2a096" clipEnd="852" clipBegin="0"/>
                              <ns2:video system-bitrate="500000" dur="852" src="mp4:e4/LOW_RES/00000418/41804.mp4?s=1292344952&amp;e=1292345702&amp;h=25f880bd01a2dc 244a346e0d9836a707" clipEnd="852" clipBegin="0"/>
                              <ns2:video system-bitrate="844000" dur="852" src="mp4:e4/STD_RES/00000418/41805.mp4?s=1292344952&amp;e=1292345702&amp;h=211fc21bb0d083 55019fd1b70b474199" clipEnd="852" clipBegin="0"/>
                              <ns2:metadata>
                                  <ns2:meta content="mainContent" name="contentType"/>
                              </ns2:metadata>
                          </ns2:switch>

       

      if anyone has experienced this issue I would be greatful to hear of the potential cause.

       

       

      cheers

        • 1. Re: metaData events within nested serial and parallelElements
          Mykola3296 Level 2

          Hello!

           

          That is because of ProxyMetadata "implementation".

           

          Consider line 63 in ProxyMetadata.as:

          proxiedMetadata.addEventListener(MetadataEvent.VALUE_ADD, redispatchEvent);
          

          Here ProxyMetadata redispatches any addValues from PROXIED element.

          Here is ProxyMetadata "addValue" override:

                    override public function addValue(key:String, value:Object):void
                    {
                         proxiedMetadata.addValue(key, value);                              
                    }
          
           
          

          As you can see, the value is added to PROXIED metadata... Listener in line 63 (above) redispatches add event.

          And here is line 416 in ProxyElement:

                    _proxiedElement.addEventListener(MediaElementEvent.METADATA_ADD, onMetadataEvent);
          

          Here you get a second event (due to updated metadata is in fact PROXIED).

          That is not the only drawback of ProxyMetadata. Here is a link to the previous discussion:

          http://forums.adobe.com/thread/680728

          1 person found this helpful
          • 2. Re: metaData events within nested serial and parallelElements
            __brndn__ Level 1

            Thanks for the help, this bug still seems to be occuring. as the jira was marked as not a bug then closed. Which indicates this is not resolved. I will try your solution for now, and hopefully the guys at adobe can share some light.

             

            cheers

            • 3. Re: metaData events within nested serial and parallelElements
              Mykola3296 Level 2

              That is what I'm talking about :O)

               

              The most critical part for us was the part that you won't get any notifications on already existing names upon setting a proxiedElement.
              Consider the LoadFromDocumentElement here to.

              So we are still using a workaround from:

              http://forums.adobe.com/message/2995239#2995239

               

              But that does not solve your problem unfortunately...

              1 person found this helpful
              • 4. Re: metaData events within nested serial and parallelElements
                __brndn__ Level 1

                HI there

                 

                .addEventListener(MediaElementEvent.METADATA_ADD, onMetaDataAdd);

                 

                it seems to be on the mediaElementEvent as opposed to the MetadataEvent that you are seeing.

                 

                 

                 

                It seems like nesting a parallel element inside a serialElement has a chain effect somewhere in the compositeElement's childMetadataGroups.

                 

                thus causing a multiple events to fire of the proxiedElement.

                • 5. Re: metaData events within nested serial and parallelElements
                  __brndn__ Level 1

                  unless I am missing something completely..


                  • 6. Re: metaData events within nested serial and parallelElements
                    Mykola3296 Level 2

                    That seems messy indeed... I'm lost again :O)

                     

                    Here is the code from MediaElement:

                     

                    _metadata = createMetadata();
                    _metadata.addEventListener(MetadataEvent.VALUE_ADD, onMetadataValueAdd);
                    _metadata.addEventListener(MetadataEvent.VALUE_REMOVE, onMetadataValueRemove);
                    _metadata.addEventListener(MetadataEvent.VALUE_CHANGE, onMetadataValueChange);
                    
                    
                    
                    
                    
                    

                     

                    Those events are redispatched as METADATA_ADD in MediaElement (see handlers)

                    Here is the code from ProxyElement "set proxiedElement":

                     

                    ProxyMetadata(metadata).metadata = _proxiedElement.metadata;
                    

                     

                    So Proxy is using internal method to proxy TOP-LEVEL element metadata. The one which events are converted to METADATA_ADD

                    It seems that we have two dispatches from Proxy - one from:

                     

                    _proxiedElement.addEventListener(MediaElementEvent.METADATA_ADD, onMetadataEvent);
                    

                     

                    It is #1 redispatch...

                    And one from MediaElement ancestor due to it receives events from ProxyMetadata:

                     

                    proxiedMetadata.addEventListener(MetadataEvent.VALUE_ADD, redispatchEvent);
                    

                     

                    It is #2 redispatch of METADATA_ADD due to the code of MediaElement at the top quote...

                     

                    What do you think?

                    • 7. Re: metaData events within nested serial and parallelElements
                      __brndn__ Level 1

                      hmm that could be the issue.. ill have a play and supressing metaValueAdded chain..

                       

                      ill drop my finding here...

                       

                       

                      cheers again..

                      • 8. Re: metaData events within nested serial and parallelElements
                        __brndn__ Level 1

                        onMetadataValueAdd line 669, if your on 1.5 sdk.

                         

                        I see it does fire an adtional  new MediaElementEventI have wired up an

                         

                        metadata.addEventListener(MetadataEvent.VALUE_ADD, onAdsMetaDataTest);

                         

                        to catch this event.

                         

                        But I still think the problem is with the compositeElements. as there is no change on the metadata as such, this get feed via a webService. However the content changes to a parallelElement.

                        • 9. Re: metaData events within nested serial and parallelElements
                          Mykola3296 Level 2

                          Hello again!

                           

                          By the way, if you have OSMF source - you may try to comment out

                          _proxiedElement.addEventListener(MediaElementEvent.METADATA_ADD, onMetadataEvent);
                          
                           
                          

                          in toggleMediaElementListeners function of ProxyElement and see if that helps :O)

                          Just to make sure where the problem is...

                           

                          Best regards!

                          • 10. Re: metaData events within nested serial and parallelElements
                            __brndn__ Level 1

                            Hi

                            cheers for the suggestion.

                            I have removed the listener in the plugIn that extends ProxyElement

                            this disables the listener at the class level.

                             

                            I have looked further and it seems that this is common across the entire application.

                             

                            By the looks the suggested way to is to use the metaDataEvents to listen for changes.

                             

                            Unfortunately the metadata changes but its values do not.

                             

                            I am using the SMILPlugin to ingest a full content experience, coupled with some 3rdParty advertising Plugins.

                             

                            The fact that we are using compositeElements seems to redispatch MediaElementEvent.METADATA_ADD excessively.

                             

                            Are we the only 2 people who have notice such odd behaviours??