I'm having difficulty getting my parallel data to scale properly. Here's my execution:
private function createMediaElement():MediaElement
{
var layoutMetada:LayoutMetadata = new LayoutMetadata();
layoutMetadata.scaleMode = ScaleMode.LETTERBOX;
layoutMetadata.horizontalAlign = HorizontalAlign.CENTER;
layoutMetadata.verticalAlign = VerticalAlign.TOP;
layoutMetadata.top = 0;
layoutMetadata.left = 0;
layoutMetadata.right = 0;
layoutMetadata.bottom = 100;
var resource1:StreamingURLResource = new StreamingURLResource(BASE_STREAM_URL + REMOTE_STREAM1, null, 0, 5);
var videoElement:VideoElement = new VideoElement( resource1 );
videoElement.addMetadata(LayoutMetadata.LAYOUT_NAMESPACE, layoutMetadata);
var swfElement:SWFElement = new SWFElement( new URLResource(BASE_PROGRESSIVE_URL + REMOTE_SWF1) );
swfElement.addMetadata(LayoutMetadata.LAYOUT_NAMESPACE, layoutMetadata);
var durationElement:DurationElement = new DurationElement( 5, swfElement );durationElement.addMetadata(LayoutMetadata.LAYOUT_NAMESPACE, layoutMetadata);
// First child is an swf overlayed for 3 seconds onto a streaming video.
var parallelElement:ParallelElement = new ParallelElement();
parallelElement.addMetadata(LayoutMetadata.LAYOUT_NAMESPACE, layoutMetadata);
parallelElement.addChild( videoElement );
parallelElement.addChild( durationElement );
var serialElement:SerialElement = new SerialElement();
serialElement.addMetadata(LayoutMetadata.LAYOUT_NAMESPACE, layoutMetadata);
serialElement.addChild( parallelElement );
// second child is a video.
serialElement.addChild( mediaFactory.createMediaElement( new URLResource(BASE_PROGRESSIVE_URL + REMOTE_STREAM2) ) );
return serialElement;
}
The SWF loads in scaled to fit the Sprite bounds, but when the video loads and starts playing, both the SWF and video resize smaller to match the video's original width and height. They no longer scale. Am I putting the metadata assignments in the wrong place or at the wrong time?
Thanks!
After a fair bit of bashing my head against a wall the only work around I came up with is use fix width/height for the meta data values. They seem to work though left/right/top/bottom and percent values are ignored. This is a challenge because I need to be able to update these dynamically at runtime from the application to the media element the plugin generates but I already have communication channels so it will have to do until a fix or better solution comes up.
The use cases for this are very broad - seems to be an issue for any video element in a parellel with custom layout meta data. advertising is one biggy.
David,
I accidently may have discovered a workaround for this similar to Brian's post on another issue (http://forums.adobe.com/thread/724031?tstart=0).
The workaround is this:
In org.osmf.elements.loaderClasses.LoaderUtils change lines 85 & 86 from
mediaWidth = info.width;
mediaHeight = info.height;
to
mediaWidth = info.width + .001;
mediaHeight = info.height + .001;
I haven't had time to figure out why this works, but it fixes the problem I've been having with SWFElements playing in Parallel with VideoElements.
North America
Europe, Middle East and Africa
Asia Pacific