次の方法で共有


Media.imageSourceHeight

[The feature associated with this page, Windows Media Player SDK, is a legacy feature. It has been superseded by MediaPlayer. MediaPlayer has been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer instead of Windows Media Player SDK, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

The ImageSourceHeight property retrieves the height of the current media item in pixels.

Syntax

player.currentMedia.imageSourceHeight

Possible Values

This property is a read-only Number (long).

Remarks

If the media item is not the current one, this property returns zero.

To retrieve the value of this property, read access to the library is required. For more information, see Library Access.

Examples

The following JScript example uses Media.imageSourceHeight to display the image size, in pixels, of the current media item. The information is printed to an HTML TEXTAREA element named VideoSize. The Player object was created with ID = "player".

<!-- Create an event handler to refresh the information when the current media changes. -->
<SCRIPT LANGUAGE = "JScript"  FOR = Player  EVENT = OpenStateChange(NewState)>

// Test whether the new media item is open.
if (NewState == 13){

   // Store the height and width of the new media item.
   var Height = Player.currentMedia.imageSourceHeight;
   var Width =  Player.currentMedia.imageSourceWidth;

   // Erase the information in the text area.
   VideoSize.value = "";

   // Test whether an image is visible.
   if (Height != 0 && Width != 0)

      // Display the image size information.
      VideoSize.value = Width + " x " + Height;
}
</SCRIPT>

Requirements

Requirement Value
Version
Windows Media Player version 7.0 or later.
DLL
Wmp.dll

See also

Media Object

Player.currentMedia

Settings.mediaAccessRights

Settings.requestMediaAccessRights