Jump to content

zPlayer - My own little audio/video player


CYCho
 Share

Go to solution Solved by TheXman,

Recommended Posts

I added your code above the old run($vlcPath . . .) code.  It reported 1 second (first run after a reboot).  The Paus/Play button worked.  The exit button quit the program, but didn't stop the video from playing.

My debug counter was still in the code, giving "Counting - 1 0x00000000 Counting - 2 0x00000000 Counting - 3 0x00010818 exiting with MyExit $hWnd = 0x00010818 "

It appears that the $hWnd is the problem area. 

I need to take off now, but if you have any other debugging techniques better than my crude stuff, I can try it tomorrow.

Thanks,
Carl

Link to comment
Share on other sites

That was it for not stopping the video player.  My code in that area now reads:

Global $pid, $seconds
While 1
    ConsoleWrite (" 1 pid = " & $pid )
    $pid = Run($vlcPath & " " & @ScriptDir & "\VLC-Playlist.m3u")
    ConsoleWrite (" 2 pid = " & $pid )
    $seconds += 1
    Sleep($seconds * 1000)
    If $pid <> "" Then
         ConsoleWrite (" 3 pid = " & $pid )
        ;MsgBox(0, "", "It took " & $seconds & " seconds to run VLC.exe", 0, $vcGUI)
        ConsoleWrite ( " exiting pid loop ")
        ExitLoop
    EndIf
    If $seconds > 10 Then
        ConsoleWrite (" timeout exit " & $seconds )
        Exit MsgBox(0, "", "VLC.exe could not be run.")
    EndIf
WEnd

$hWnd = WinGetHandle("[CLASS:Qt5QWindowIcon]", "VLC")  ; Please check if your VLC window class matches with this
ConsoleWrite (" after read of $hWnd = " & $hWnd )

 

I'm still having problems with the initial run after reboot.  The results of the ConsoleWrites for the first boot are:

1 pid =  2 pid = 14236 3 pid = 14236 exiting pid loop  after read of $hWnd = 0x00000000 

 

And after running again:

 1 pid =  2 pid = 14704 3 pid = 14704 exiting pid loop  after read of $hWnd = 0x0006087E

 

Can you tell me how to check the VLC window class?  With that, I can probably proceed to the next step of debugging.

Thanks,
Carl

 

 

 

Link to comment
Share on other sites

7 hours ago, carlvanwormer said:

I'm still having problems with the initial run after reboot.  The results of the ConsoleWrites for the first boot are:

1 pid =  2 pid = 14236 3 pid = 14236 exiting pid loop  after read of $hWnd = 0x00000000 

 

And after running again:

 1 pid =  2 pid = 14704 3 pid = 14704 exiting pid loop  after read of $hWnd = 0x0006087E

From this I can see that vlc.exe is executed without a problem, but your computer seems to take time to handle some internal processes before being ready to load the playlist. One thing you could do is wait for some time, like 5 to 10 minutes, after reboot and run the program.

Attached is a file including revised debugging lines. Now the window title used for getting $hWnd is " - VLC " which is a common text in both English and Korean versions of VLC. I hope this works for you.

My SciTE output with this code is as follows:
 

**PID obtained after 4.9228 milliseconds = 6808
**Window handle obtained after 529.2289 milliseconds = 0x00020864


 

 

 

zPlayer-VLC.au3

Edited by CYCho
Link to comment
Share on other sites

You did it!

I got

 **PID obtained after 1 seconds = 9324
**Waiting for VLC to produce window handle...
**Window handle obtained after 4755.6825 milliseconds = 0x00010900

for the first run, then

**PID obtained after 1 seconds = 876
**Waiting for VLC to produce window handle...
**Window handle obtained after 0.6338 milliseconds = 0x00020944

it looks like my old windows machine needs to knock stuff around for the first time it tries something.

 

I'll add a little polish to my code while waiting for the tablet to arrive.  When I like it, should I upload it here in case anybody else wants the world's dumbest controller?

Thanks,

Carl

 

Link to comment
Share on other sites

I revised a few lines. Please dowload the above file again before you finalize your code.

29 minutes ago, carlvanwormer said:

When I like it, should I upload it here in case anybody else wants the world's dumbest controller?

Yes, please. It would be good if someone else could benefit from your hard work.

Link to comment
Share on other sites

Things are going well.  I thought changing the color of the button to red for Pause and (when paused) Green for play.  Unfortunately, this is just a toggle and it can get out of sync.  I will be looking into the VNC commands to see if I can query the paus/play state to resolve my problem.  Otherwise, I'll go back to the single color.

Later,
Carl

Link to comment
Share on other sites

Version 3.0.2.1 was released with following improvements:

1. The playing mode(sequential or shuffled) used to be saved in the zPlayer.ini when exiting the program. Now it is saved in the playlist in each folder so that the program, when it loads a playlist, picks up the playing mode which was in effect for that particular playlist. I realized that I play back some folders always in sequential mode and some other folders always in shuffled mode. Saving the playing mode in the playlist solved the problem of having to change the mode when I change the folder.

2. Added a function to resume playback of a media from where it was left off. It has Never, Ask and Always options as most of the established media players do. And I have added one more functionality. I thought that it would be good if I could set certain filters for application of this function. Now you can set the minimum length of media and the minimum streamed length of that media to qualify for application of this function. The initail values are set at 600 and 300 seconds respectively. So if a media is shorter than 10 minutes or the streamed portion of the media, when you left it off, is shorter than 5 minutes, this function will not be initiated even if you have set Ask or Always option. You can change these criteria to suit your taste.

3. Made substantial changes to wordings of the main window to increase readability and intuitiveness.

Edited by CYCho
Link to comment
Share on other sites

I have my "final" version!  (yes, I know what a joke that is . . .)

It works and my dad can Play-Paus easily with the giant button filling most of the 10.1" display on his tablet.  Here is the current AutoIt version for your viewing pleasure.  I cannot express enough thanks to CYCho for doing most of the hard work on this project.  My 96-year-old dad is now "self sufficient" with his Monk habit (60GB 8-season series on the Tablet) and only 2 buttons to press (the one on the tablet and a mechanical giant power button on a modified TV remote control.

Thanks,
Carl

 

BigPause-118-m3u.au3

Link to comment
Share on other sites

9 hours ago, carlvanwormer said:

My 96-year-old dad is now "self sufficient"

It's great to see that you did it. I enjoyed helping you help your dad. Cheers to you and your daddy!

GUICtrlSetFont(-1, $vcWidth/8, 900)

I like this. Good job!

Edited by CYCho
Link to comment
Share on other sites

  • 2 months later...

I updated the log file and added a system reboot at 1am each morning.  The original system would reboot if VLC crashed, but I was still getting an occasional system problem (touchscreen going black even though the system had constant power and was set to never blank the screen or go to sleep). I added a reboot at 1am (with notes left in the log file) to try to catch any remaining hardware and software problems.

 

BigPause-206-m3u.au3

 

Link to comment
Share on other sites

  • 3 weeks later...
  • 3 weeks later...

I'd like to know if this code works in Windows 11. I'm especially concerned about _IE~ functions which are essential for this program. I would appreciate it if anyone could share their experience with Windows 11.

Edit: A while ago I reported that this player worked under pre-release version of Windows 11. I hope it still does under the official release version as well.

Edited by CYCho
Link to comment
Share on other sites

  • 2 months later...

@CYCho I read your post and checked. The same problem appears on my computer with AutoIt 3.3.16.0 and zPlayer (no matter its version, even an old version of zPlayer gives the same error)

So this is the error I encounter with the last version of zPlayer (3.0.2.4) when I run it with AutoIt 3.3.16.0 :

zPlayer_3024_source\zPlayer.au3" (428) : ==> The requested action with this object has failed.:
While $oPlayer.playState <> $iPlaying
While $oPlayer^ ERROR
>Exit code: 1

After several tries, I was lucky to have it working like this :

Original line 308 :

Global $oPlayer = _IEGetObjById($oIE, "objWMPlayer")

Changed to :

Global $oPlayer

Then define $oPlayer directly at 1st line in Main()

Func Main()
    $oPlayer = _IEGetObjById($oIE, "objWMPlayer") ; <======= moved it here
    $oPlayer.Settings.Volume = $nVolume
    $oPlayer.Settings.autoStart = True
    $oPlayer.uiMode = "none"

I also tried to add a com error handler to your original script (when $oPlayer is defined outside Main) and it intercepted errors on each line in Main() where $oPlayer is encountered, starting with original line 392 :

$oPlayer.Settings.Volume = $nVolume ; original line 392, com error is "access denied"

I don't know why this change made it work but it worked. Let's hope a guru will investigate to find why everything was working fine with AutoIt 3.3.14.5 when $oPlayer was defined outside Main(), but now it seems it has to be defined inside Main() when using AutoIt 3.3.16.0, very strange.

Let's hope it will work same on your computer :bye:
 

Link to comment
Share on other sites

What seems to work too is to move the entire line 308 like this :

; Create a Windows Media Player object embedded in Internet Explorer
Global $IEControl, $oIE = MyWMPlayer()
; Global $oPlayer = _IEGetObjById($oIE, "objWMPlayer") ; <=== move this line 308...

and place it here, after the @SW_HIDE / @SW_SHOW trick (if you place it before it doesn't work) :

GUISetState(@SW_HIDE, $winMain) ; without these 2 lines of code, the $winMain is randomly minimized
GUISetState(@SW_SHOW, $winMain) ; when the "Close" box of $winListView is clicked
WinSetTitle($winMain, "", "zPlayer by C. Y. Cho")   ; caption of $winMain sometimes synchronizes to that of $winListView

Global $oPlayer = _IEGetObjById($oIE, "objWMPlayer") ; <========= line 308 moved here

Main()

Func Main()
    $oPlayer.Settings.Volume = $nVolume
    $oPlayer.Settings.autoStart = True
    $oPlayer.uiMode = "none"

 

Link to comment
Share on other sites

A good find. This one is better than the former one. I hope someone can tell me what makes this difference between v3.3.14.5 and v3.3.16.0.

Another difference I found is  horizontal and vertical scroll bars in video window. There is no scroll bar when run in old version of AutoIt, but there are both scroll bars when run in new version. And my problem is I don't know how to get rid of them.

Link to comment
Share on other sites

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
 Share

×
×
  • Create New...