2 Replies Latest reply on Sep 28, 2009 12:10 PM by gloam

    What is the best way to for a plugin to wrap a video element in a parallel composition with a reference plugin that points to that Video Element?

    gloam

      I have a basic reference element loaded as a plugin, which is able to retrieve information about, pause and play video elements while displaying its own overlay content as well.  What it's not currently doing, is automatically positioning itself to the same location and dimensions of the video element that it references.  For some reason, when I try using the layout API to set position and size in the video element metadata, this is not retrieved by the reference element (it returns a null value for the target video element's metadata).

       

      I wanted to try a different approach, specifically, creating a parallel composition that works as follows:

       

      1) When a video element is created in the factory, it is automatically wrapped in a parallel composition element along with a reference element, which is passed the video element as a target.

       

      2) The reference element sets its width and height with the width and height properties of the video element spatial trait and will listen for any changes to that width and height to adjust accordingly.

       

      3) Now that I think about it, the parallel composition should itself be a proxy for the video element, so other code in the player that moves, resizes, or otherwise alters the dispay of the video element, will if fact be adjusting the whole video element + reference element parallel composition.

       

      In other words, I want the reference element to be an overlay that is "locked" to the surface of any video element and follows it in size, position, display and even audio traits.

       

      Suggestions for the best way to approach this within the framework?

        • 1. Re: What is the best way to for a plugin to wrap a video element in a parallel composition with a reference plugin that points to that Video Element?
          weizhangstrobe Level 2

          You are basically on the right track. You can implement your own overlay element that implements IMediaReferrer interface. The implementation of your IMediaReferrer interface can decide whether to refer to a given media element in the canReferenceMedia function and then get a hold on the media element in the addReference function. Once you have the referred media element, you are free to explore its metadata. Whether you want to package your overlay element as a plugin or directly link into your application is totally up to you. Without looking into the actual code, I am unable to tell why you cannot retrieve the targe video element's metadata. If you want, you may send me your source code and I can take a look of it for you. My email address is weizhang@adobe.com

           

          -Wei Zhang

          Senior Computer Scientist

          Adobe Systems Inc.

          1 person found this helpful
          • 2. Re: What is the best way to for a plugin to wrap a video element in a parallel composition with a reference plugin that points to that Video Element?
            gloam Level 1

            Thanks Wei,

             

            With some more tweaking, I am able to get and use the layout metadata as you said!  Here is where my issue stands now:

             

            * My IMediaReferrer element can now look at the layout metadata of the target media element and copy those values, so it has the same width, height, x, and y  properties.  This is great!

            * However, particularly for RelativeLayoutFacet metadata, this is only fully useful if both the target media element and my IMediaReferrer element are in the same composition.  If they are in different compositions which are themselves placed differently, then even identical x and y values don't add up to the same position on the screen.

             

            So, my challenge is to figure out how to ensure that my IMediaReferrer element is placed in the same composition as the target media element.

             

            Again, the goal is to write a plugin that will have a reference to an underlying video, and will always have the same width, height, x, and y of the video it is overlaying.  This plugin should not require any additional coding in the player, but should take care of setting itself up as above automatically when loaded.

             

            There isn't any property on a media element which exposes the "parent" composition element that it is a part of, so I don't know how to get my IMediaReferrer to add itself to the same composition as the reference target automatically.  I'm not sure if it's possible to make my IMediaReferrer element extend ParallelElement and still load in a SWF Element as an overlay, and add that SWF Element and the target Media Element as children with identical layout metadata.

             

            Do you have any suggestions on how I should proceed?

             

            Thanks again!