Jump to content

zPlayer - My own little audio/video player


Go to solution Solved by TheXman,

Recommended Posts

Posted

I recently found that Microsoft had inserted some new items in Windows 11 file property collection. Formerly, I could get a video frame width with $oDir.GetDetailsOf($oFile, 316). But now the column number for frame width was pushed back to 322, 6 items having been inserted before 311. I confirmed that there was no change in Windows 10. Since I now know that the column numbers can change any time, I had to find a way to get the property values without using their column numbers. @ioa747 suggested using ExtendedProperty() method. That solved problems for video properties. But that method failed in some of the music file properties. For example, ExtendedProperty("System.Music.Artist") produced an empty string while GetDetailsOf($oFile, 13) produced a valid result. However, I was relieved to find that the first 30 or so column numbers, which cover most of properties of music files, have not changed since Win_Vista. So I decided to use ExtendedProperty() for video file properties ony. I incorporated this method in the latest version of zPlayer.

  • 2 months later...
Posted (edited)

I liked the way YouTube video is paused and played by clicking on the image. How can I implement this in my zPlayer?

_WinAPI_WindowFromPoint() was the answer. In the main loop of zPlayer I put a line of code calling the following function and it works beautifully.
 

Func _VideoClicked()
    $aPos = MouseGetPos()
    Local $tStruct = DllStructCreate($tagPOINT)
    DllStructSetData($tStruct, "x", $aPos[0])
    DllStructSetData($tStruct, "y", $aPos[1])
    Local $hWnd = _WinAPI_WindowFromPoint($tStruct)
    If WinGetTitle($hWnd) = "ActiveMovie Window" Then
        If _IsPressed("01") Then
            _Pause()
            Sleep(200)
        EndIf
    EndIf
EndFunc

 

Edited by CYCho
Posted
50 minutes ago, Werty said:
Func _VideoClicked()
    If WinGetTitle(_WinAPI_WindowFromPoint(_WinAPI_GetMousePos())) = "ActiveMovie Window" Then
        If _IsPressed("01") Then
            _Pause()
            Sleep(200)
        EndIf
    EndIf
EndFunc

I  changed this to:
 

Func _VideoClicked()    ; Click on video image to pause or play the video
    Local $tPoint = _WinAPI_GetMousePos()
    If WinGetTitle(_WinAPI_WindowFromPoint($tPoint)) = "ActiveMovie Window" Then
        If _IsPressed("01") Then
            _Pause()
            Sleep(200)
        EndIf
    EndIf
EndFunc     ;==>_VideoClicked

and it worked. Thanks for your suggestion.

Posted (edited)

@Werty, I noticed that, in VLC, a double-click on video image turns fullscreen mode on or off. I am trying to implement it in zPlayer, but I can't. GUIRegisterMessage(0 is not applicable because the video window($hVideo) is not my GUI. It is created by winmm.dll and the top-most window we actually click or double-click is its child window whose title is "ActiveMovie Window". Do you have any suggestion to tackle this? Thank you for your attention.

Edited by CYCho
Posted (edited)

How are you going to fullscreen the GUI?

Shouldnt you hide the GUI parent window and only fullscreen the childwindow?

I have no experience with doubleclicking.

Edited by Werty

Some guy's script + some other guy's script = my script!

Posted (edited)

Video popup is created by winmm.dll as a child of my own GUI. In fullscreen mode, the whole screen becomes the client area of my GUI, and then the video popup is resized to the maximum keeping its original aspect ratio and centered in GUI. I set the background color of GUI black so that any spaces not filled by video, usually top and bottom, remain black. Currently, F11 hotkey turns fullscreen mode on or off and it works pretty well. A double-click for fullscreen may be redundant. I am just thinking about the possibility of imitating VLC. YouTube also uses double-click for fullscreen. Browsers and file explorer use F11 for fullscreen. zPlayer's F11 works only when the center point of video window is visible on top.

Edited by CYCho
Posted (edited)

I changed the code as follows and it seems to work for now. I will have to proof-test it for a while. One drawback is that the response  to a single click can be somewhat draggy depending on double-click speed set in Windows Settings.
 

Func _VideoClicked()    ; Single click on video image to pause or play the video, double-click to turn fullscreen on or off
    Local $tPoint = _WinAPI_GetMousePos()
    If WinGetTitle(_WinAPI_WindowFromPoint($tPoint)) = "ActiveMovie Window" Then
        Local $user32DLL = DllOpen("user32.dll"), $hTime, $doubleclicked, $doubleclickSpeed
        If _IsPressed("01", $user32DLL) Then
            $hTime = TimerInit()
            While _IsPressed("01", $user32DLL)
                Sleep(10)
            WEnd
            $doubleclickSpeed = DllCall($user32DLL, 'uint', 'GetDoubleClickTime')[0]
            While TimerDiff($hTime) <= $doubleclickSpeed
                If _IsPressed("01", $user32DLL) Then
                    While _IsPressed("01", $user32DLL)
                        Sleep(10)
                    WEnd
                    $doubleclicked = 1
                    ExitLoop
                EndIf
                Sleep(10)
            WEnd
            If $doubleclicked Then
                _FullScreen()
            Else
                _Pause()
            EndIf
        EndIf
        DllClose($user32DLL)
    EndIf
EndFunc     ;==>_VideoClicked

Edit: Incorporated this code in the latest version(6.1.2.1) of zPlayer.

Edited by CYCho
  • 5 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...