0 Replies Latest reply on Feb 22, 2010 3:15 AM by JonnyReeves

    Layout in a Serial Element (Poster Frame)

    JonnyReeves Level 1

      Hi There,

       

      Using OSMF 0.9, I am currently creating a basic MediaFactory implementation which parses the response of a Service Endpoint.  This Endpoint contains both a Video File (FLV) and a JPEG Image which should be displayed before the Video starts playing back (Poster Frame).

       

      I have extended MediaElementLoader to implement my own Loader and Parser for the Service Endpoint, once I have parsed the additional metadata I set about creating two MediaElements, one for the Video and one for the PosterFrame:

       

      const posterElement : MediaElement = new PosterFrameElement(new ImageLoader(), new URLResource(new URL(videoManifest.posterURL)));
      const videoElement : MediaElement = factory.createMediaElement(videoMediaResource);


      // Should I be specifying Layout in the Loader?

      LayoutUtils.setLayoutAttributes(posterElement.metadata,  ScaleMode.LETTERBOX, RegistrationPoint.CENTER);
      LayoutUtils.setRelativeLayout(posterElement.metadata, 100, 100);
      LayoutUtils.setLayoutAttributes(videoElement.metadata,  ScaleMode.LETTERBOX, RegistrationPoint.CENTER);
      LayoutUtils.setRelativeLayout(videoElement.metadata, 100, 100);

                     
      const serialElement : SerialElement = new SerialElement();
      serialElement.addChild(posterElement);
      serialElement.addChild(videoElement);

       

      This all works correctly and I see the Poster Frame before the Video starts playing back; however, I do not think setting the Layout attributes inside the Loader is the expected design.  If I attempt to set the Layout attributres later during execution, I do not get the expected results - is this a bug with SerialElement, or is my approach to the problem wrong?

       

      Thanks

      Jonny.