1

It would appear that the width and height of the Feathers VideoPlayer component can be set.

But when I load a video source the size always reverts to the size of the native video.

Any ideas how to fix this?

In this example the native video is 640x390 and the player is displayed at that size.

_videoPlayer = new VideoPlayer();
_videoPlayer.setSize( 640*2, 390*2 );
_videoPlayer.validate();

addChild( _videoPlayer);
_videoPlayer.videoSource = "http://www.test.com/test.mp4";
_imageLoader = new ImageLoader();
_videoPlayer.addChild( _imageLoader );
_videoPlayer.addEventListener( Event.READY, videoPlayer_readyHandler );
_videoPlayer.addEventListener( FeathersEventType.CLEAR, videoPlayer_clearHandler );

Thanks,

Mark

crooksy88
  • 3,849
  • 1
  • 24
  • 30

2 Answers2

0

Setting the imageLoader size seems to be the answer.

_videoPlayer = new VideoPlayer();
_videoPlayer.setSize( 640*Main._starlingScale, 390*Main._starlingScale );
_videoPlayer.validate();

_containerSprite.addChild( _videoPlayer);
_videoPlayer.videoSource = "http://www.test.com/test.mp4";
_imageLoader = new ImageLoader();
_imageLoader.width = 640;
_imageLoader.height = 390;
_videoPlayer.addChild( _imageLoader );

//640x390 is the size of the starling display area.

crooksy88
  • 3,849
  • 1
  • 24
  • 30
0

By default, the VideoPlayer does not have a layout, so even if you set the width and height properties, it will do nothing to constrain the size of any children that you add, such as the ImageLoader that displays the video texture. The VideoPlayer is actually staying at its fixed size, but the ImageLoader sees that it doesn't have an explicit width/height, so it resizes itself to render the video texture at the video's native size.

You should use VideoPlayer with a layout. For instance, you might use VerticalLayout, like this:

_videoPlayer.layout = new VerticalLayout();

And then, you can pass VerticalLayoutData to the ImageLoader, and set the percentWidth and percentHeight values to 100 to have it fill the entire bounds of the VideoPlayer:

_imageLoader.layoutData = new VerticalLayoutData(100, 100);
Josh Tynjala
  • 5,235
  • 3
  • 23
  • 25