Share via


Sizing the Windows Media Player Control

Windows Media Player SDK banner art

One powerful feature of Windows Media Player is its ability to stretch or shrink a clip from its original dimensions. Changing clip dimensions can be done programmatically by changing the value of the DisplaySize property. This property can be set to a wide range of values, from one half the size of the source image to full-screen display. It can only be set when the value of the AllowChangeDisplaySize property is true.

For Windows-based applications, the initial dimensions of the Windows Media Player control are determined at design time. For example, in Microsoft Visual BasicĀ® you select the control from the toolbox and use the mouse to draw the Windows Media Player object on the form. On a Web page with an embedded control, the HEIGHT and WIDTH parameters of the OBJECT tag determine the initial size of the control. If the height and width are specified, and the value of the AutoSize property is false, media clips conform to the dimensions of the Windows Media Player.

Specifying the size is an ideal way to tailor Windows Media Player to specific media content. However, because clips can be stored and streamed in a variety of shapes and sizes, it is often advantageous to have the Windows Media Player conform to the dimensions of the clip. Setting the AutoSize property to true allows the Windows Media Player to stretch or shrink to accommodate the clip played at the specified display size.

When the AutoSize and ShowControls properties are both true, the control bar might determine the minimum width of the Windows Media Player. The Windows Media Player can resize itself no smaller than the control bar with all of its buttons displayed. Adding position and audio controls increases the width of the control bar. The following table describes the different widths of the control bar.

Width ShowAudioControls ShowPositionControls
Narrowest False False
Wide True False
Wider False True
Widest True True

If the AutoSize property is false, the HEIGHT and WIDTH parameters specify the dimensions of the entire control, including the control panel, display panel, status bar, and so forth. If the specified height is insufficient for both the controls and the video display, the video shrinks to fill the available space. If the specified width is insufficient to accommodate the control bar, buttons on the right side of the control bar are cut off.

If the Windows Media Player control is embedded in a Web page, using HEIGHT and WIDTH parameters has the following effects:

  • The DisplaySize property defaults to mpFitToSize. Clips are sized to fit into the specified dimensions.
  • The AutoSize property defaults to false.

Embedding the Windows Media Player control without specifying HEIGHT and WIDTH parameters has the following effects:

  • The DisplaySize property defaults to mpDefaultSize. Clips are sized to the dimensions of the source image.
  • The AutoSize property defaults to true.