본문 바로가기

Story/Javascript

윈도우 미디어 플레이어 이벤트 캡춰 - Capturing Keyboard and Mouse Events

반응형
The EnableContextMenu and ClickToPlay properties provide for user input through the image window. If EnableContextMenu is true, right-clicking on the image window opens a context menu that gives the user access to many of the Windows Media Player control properties. When the ClickToPlay property is true, users can start Windows Media Player by clicking the image window.

To receive mouse movement and mouse click events, set the SendMouseMoveEvents and SendMouseClickEvents properties to true. Mouse events include the following:

  • MouseDown. Occurs when the user presses the mouse button.
  • MouseUp. Occurs when the user releases the mouse button.
  • MouseMove. Occurs when the user moves the mouse pointer.
  • Click. Occurs when the user clicks the mouse button while the pointer is over the Windows Media Player.
  • DblClick. Occurs when the user double-clicks the mouse button while the pointer is over the Windows Media Player.

To receive keyboard events, set the SendKeyboardEvents property to true. Keyboard events include the following:

  • KeyDown. Occurs when the user presses a key.
  • KeyUp. Occurs when the user releases a key.
  • KeyPress. Occurs when the user presses and releases a key.

출처 : http://msdn.microsoft.com/ko-kr/library/ms983976.aspx

         http://msdn.microsoft.com/en-us/library/ms909923.aspx

이중에 두가지만 보면
 
This page documents a feature of the Windows Media Player 6.4 ActiveX control. We recommend that you migrate your content to use the Windows Media Player 9 Series ActiveX control. For more information about the Windows Media Player 9 Series ActiveX control, see the Windows Media Player 9 Series SDK.

마우스 클릭시

This event occurs when a user clicks the mouse with the cursor in the image window.

Syntax

JScript

<SCRIPT FOR="MediaPlayer" 
        EVENT="Click( iButton, iShiftState, fX, fY )" 
        LANGUAGE="JScript">
    <!-- insert script commands -->
</SCRIPT>

VBScript

<SCRIPT LANGUAGE="VBScript">
Sub MediaPlayer_Click( iButton, iShiftState, fX, fY )
    <!-- insert script commands -->
End Sub
</SCRIPT>

Parameters

  iButton

Integer value specifying a bit field with bits corresponding to the left button (bit 0), right button (bit 1), and middle button (bit 2). These bits correspond to the values 1, 2, and 4, respectively. Only one of the bits is set, indicating the button that caused the event.

  iShiftState

Integer value specifying a bit field with the least significant bits corresponding to the SHIFT key (bit 0), the CTRL key (bit 1), and the ALT key (bit 2). These bits correspond to the values 1, 2, and 4, respectively. The shift argument indicates the state of these keys. Some, all, or none of the bits can be set, indicating that some, all, or none of the keys are pressed.

  fX

Single value specifying the x-coordinate of the mouse pointer relative to the upper left-hand corner of the image window.

  fY

Single value specifying the y-coordinate of the mouse pointer relative to the upper left-hand corner of the image window.

Remarks

This event occurs only if the value of the SendMouseClickEvents property is true.

- 키보드 사용시 

This event occurs when the user presses a key.

Syntax

JScript

<SCRIPT FOR="MediaPlayer" 
        EVENT="KeyDown(iKeyCode, iShiftState)" 
        LANGUAGE="JScript">
    <!-- insert script commands -->
</SCRIPT>

VBScript

<SCRIPT LANGUAGE="VBScript">
Sub MediaPlayer_KeyDown(iKeyCode, iShiftState)
    <!-- insert script commands -->
End Sub
</SCRIPT>

Parameters

  iKeyCode

Integer value specifying a key code, such as vbKeyF1 (the F1 key) or vbKeyHome (the HOME key). To specify key codes, see the Microsoft Visual Basic documentation.

  iShiftState

Integer value specifying a bit field with bits corresponding to the SHIFT key (bit 0), the CTRL key (bit 1), and the ALT key (bit 2). These bits correspond to the values 1, 2, and 4, respectively. Some, all, or none of the bits can be set, indicating that some, all, or none of the keys are pressed.

Remarks

If the value of the SendKeyboardEvents property is true, this event occurs when the Windows Media Player control has focus and the user presses a key. If SendKeyboardEvents is false, this event does not occur.

 

Requirements

Version: Windows Media Player version 6.4.

Library: Use msdxm.ocx.

Platform: Windows 98 Second Edition or higher.

사용 예를보면



또는






플레이어는
<object id="MediaPlayer" width="640" height="480" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" type="application/x-oleobject">
  <param name="FileName" value="mms://121.254.227.21/64431.wmv">
  <PARAM NAME="autostart" VALUE="1">
  <PARAM NAME="showcontrols" VALUE="1">
  <PARAM NAME="AllowChangeDisplaySize" VALUE="1">
  <PARAM NAME="DisplaySize" VALUE="3">
  <PARAM NAME="ShowGotoBar" VALUE="0">
  <PARAM NAME="Volume" VALUE="-250">
  <PARAM NAME="SendKeyboardEvents" VALUE="1">
  <PARAM NAME="SendPlayStateChangeEvents" VALUE="1">
  <PARAM NAME="EnableFullScreenControls" VALUE="0">
</object>
반응형