Media.imageSourceWidth
The imageSourceWidth property retrieves the width of the current media item in pixels.
Syntax
player.currentMedia.imageSourceWidth
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.imageSourceWidth 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
Version |
Windows Media Player version 7.0 or later. |
DLL |
|