0

Watching a video on windows media player will produce black bars on the left and right.

this.MPlayer.stretchToFit = true;
AxWindowsMediaPlayer mPlayer = this.MPlayer;
mPlayer.URL = "Location of a file";

Below attached file output of the code.

How to change the aspect ratio of an Windows media player?

enter image description here

James Z
  • 12,209
  • 10
  • 24
  • 44
  • Does this answer your question? [Stretch video of AxWindowsMediaPlayer without maintaining aspect ration in C#](https://stackoverflow.com/questions/15749181/stretch-video-of-axwindowsmediaplayer-without-maintaining-aspect-ration-in-c-sha) – Sinatr Jul 30 '20 at 11:53

1 Answers1

0

With C# images you define width and height as double. When you now display your image you can choose between the following stretch options:

  • Stretch="Fill" - depending on your width and height the image can be distortedor Stretch="None" - depending on your width and height the image may not fit into the display area Stretch="Uniform" - the image stretches into the display area and completely fills the display area
    • you might have some empty space at upper/lower or left/right border. The aspect ratio is not changed Stretch = "UniformToFill" - the image stretches and completely fills the display area, the aspect ratio remains intact however to fit into the display area the lower or right part of the imace is cut off.

For the MediaElement first try Stretch="None", this leaves the display undistorted.

If your video absolutely does not fit into the display area replace the Stretch argument by SizeToContent="WidthAndHeight".

Regards Martin

kmcontact
  • 21
  • 3