Results 1 to 2 of 2

Thread: WMP Component - How to use components?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jul 2004
    Posts
    20

    WMP Component - How to use components?

    I've loaded the WMP component but I don't understand how to use the objects and interfaces (newbie in OOP).

    For instance, if I want to get the height of a video file, I know I need to get it from imageSourceHeight property in the Media object, but I don't know how.

    What do I need to do?

    Thx

  2. #2
    Junior Member
    Join Date
    Jul 2004
    Location
    Port Huron, Michigan
    Posts
    20
    This is the example from the SDK documentation, the script used is pretty straight forward to read and understand.

    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 Media Library is required. For more information, see Media Library Access.

    Example Code

    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

    Version: Windows Media Player version 7.0 or later.

    Header: Defined in wmp.idl; include wmp.h.

    Library: Use wmp.dll.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width