2 Replies Latest reply on Oct 7, 2011 8:28 AM by jethroq

    How/Where best to add TubeMogul metadata?

    jethroq

      Hi, I am working on a Flex + robotlegs videoplayer project that uses OSMF and TubeMogul's data tracking. Tubemogul has been successfully integrated, with the exception of the metadata injection on each video that would make the resulting TubeMogul data vastly more useful (videoID, publisherID, display name, and so on).

       

      Following TubeMogul's plugin guide, down at the bottom in Step 4 it says to add the Metadata to each MediaElement. I do that in my controller immediately after calling MediaFactory.createMediaElement(resource), but the metadata is never added to the element.

       

      I believe the problem is that as soon as the OSMF MediaFactory creates the mediaElement, it dispatches the element out to the various plugins and they go on their merry way, leaving the metadata in their dust.

       

      So for reference, in my "play episode" command method I am doing the following:

       

      var TMMediaParams:Object = {

                      publisherID:"Publisher ID Data",

                      videoID:"Video ID Data",

                      displayName:"Display Name Data",

                      categories:"categories, data"

                  }

                  var tmMetadata:Metadata = new Metadata();

                  tmMetadata.addValue("TMMediaParams",TMMediaParams);


                  // Load the new mediaElement

                  var resource:URLResource = new URLResource( evt.episode.assetPath )

                      resource.addMetadataValue("TMMediaParams",TMMediaParams);


                  var mediaElement:MediaElement = mediaPlayerModel.mediaFactory.createMediaElement( resource );

                      mediaElement.addMetadata( "TMMediaParams", tmMetadata); /**
                                                                              *   THIS METADATA NEVER APPEARS IN THE TUBEMOGUL TRACE
                                                                              *   BECAUSE IT IS ADDED AFTER THE PLUGIN SENDS THE DATA TO

                                                                              *   TUBEMOGUL

                                                                              **/

       

      Maybe I'm being thick (I am new to all this), but for the life of me I can't think of how or where I can do this metadata injection on the mediaElement, aside from modifying the OSMF MediaFactory's createMediaElement method itself to do it, before it dispatches the MediaFactoryEvent.MEDIA_ELEMENT_CREATE with the mediaElement payload to all the plugins (including TubeMogul).

       

      So I have added the following lines to MediaFactory.as in createMediaElement, just before it dispatches MediaFactoryEvent.MEDIA_ELEMENT_CREATE:

       

      if ( Boolean(mediaElement.resource.getMetadataValue("TMMediaParams")) )

                      {

                          var mediaElementMetadata:Metadata = new Metadata();

                          mediaElementMetadata.addValue("TMMediaParams", resource.getMetadataValue("TMMediaParams"));

                          mediaElement.addMetadata( "TMMediaParams", mediaElementMetadata);

                      }

       

      I see proxyElement in that method and it looks like it has potential, but I can't find much useful info on it or how to use it; if anyone has a helpful link or suggestion that'd be great.

       

      So really I'm hoping someone can tell me whether this is "kosher," and if not, then how I should actually be handling this.

        • 1. Re: How/Where best to add TubeMogul metadata?
          Silviu Vergoti Adobe Employee

          Hi Jethroq,

           

          the "resource" metadata is kind of incorrectly named in http://www.tubemogul.com/ip_install/osmf , it's supposed to be the plugin resource. The metadata should be set on the plugin, not on the video resource.

           

          var resource:URLResource = new URLResource( evt.episode.assetPath )

          //this is the video resource

          resource.addMetadataValue("TMMediaParams",TMMediaParams);

           

          I can't see in you example where you load the plugin. That "resource" should receive its metadata.

           

          The element metadata should be set up, too.

           

          S.

          • 2. Re: How/Where best to add TubeMogul metadata?
            jethroq Level 1

            Hi Silviu,

             

            Thank you so much for your reply. I do load the player level metadata when I load the plugin; that stuff is coming through fine.

             

            Correct me if I'm wrong, but I believe the stream level metadata needs to be set up for each element *on* each element... this is where I was having trouble. I can add all the element metadata I want, but if I'm using the MediaFactory class to create it, the TubeMogul plugin gets the element and runs with it before the element metadata gets set (i.e., after createMediaElement has run and dispatched).

             

            The only way I've been able to get around this is to directly modify the createMediaElement method in MediaFactory as above, to pull the element metadata out of the URL Resource and add it to the element before it is dispatched.

             

            How else can I add the element metadata to the element?

             

            Thank you!

            -Jeff