Jump to content

zPlayer - My own little audio/video player


Recommended Posts

It seems that the computer somehow fails to load either VLC.exe or the playlist. Maybe Sleep(1000) after the Run command is too short. You can try this code and find the optimum sleep time.
 

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

 

Edited by CYCho
Link to post
Share on other sites
  • Replies 119
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

zPlayer is the name I used when I introduced the early version of this player in my blog back in early 2009 and, therefore, has nothing to do with the mobile media player of the same name which starte

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!

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 cu

Posted Images

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 post
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 post
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 post
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 post
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 post
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 post
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 post
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 post
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 post
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 post
Share on other sites
  • 3 weeks later...
  • 3 weeks later...
Posted (edited)

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 post
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 post
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 post
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 post
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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By CYCho
      This file includes the source code for zPlayer, which is a stand-alone, simple, intuitive and easy-to-use, yet fully functional media player.  I made this to suit my purpose and you can tweak it to your taste. The source code is only about 1600 lines and only standard #include files were used. Also included in the source code file are some image files which are used for drawing the graphical media controls in the main window.
      As of its release date, the compiled exe file of this player, as attached hereto, is not flagged by Windows Defender with latest Security Intelligence Update.
      Hash values for compiled file of the latest version are as follows:
      SHA256: B21A386B916175FB05639BACC398812BE6CEB1B02E463585EA900E329A596A5D
      SHA1: 3AAAFF9B3E8D4FC5FE3D27C49241C23C0C9DF654

      This player has the following features:
      - Play back all formats of media files which can be played back by the Windows Media Player in your computer
      - Depending on the file types specified by the user in zPlayer.ini file this player can be either audio only, video only or both.
      - Video window is independent of other windows and, when maximized, increases the immersion of the user
      - Graphical media controls similar to embedded Windows Media Player
      - Forward, backward, pause, repeat, shuffle function
      - Increase/decrease/mute sound volume
      - Change folders and create playlist for all media files in that folder and its subfolders, and support for manually-made playlists
      - Save play-back environment when terminating and resume that environment when restarting
      - 'Continue playback' option for a file you left off in the middle of playback
      - With one click, you can see internet search results for the file selected in playlist
      - With a double-click, you can play back an item in the playlist
      - Search strings in the playlist
      - Option to see long file names including folder names
      - View file properties for any file in the playlist and copy their values
      - Resize the playlist and video windows, and restore them to their default positions
      - Very small footprint: very low CPU and memory usage, with only about 1MB when compiled
      - You can even hide all the windows and manipulate the player with hotkeys only
      Note: zPlayer is the name I used when I introduced the early version of this player in my blog back in early 2009 and, therefore, has nothing to do with the mobile media player of the same name which started marketing in 2015.
       
    • By PeterVerbeek
      In this post I take the opportunity to show the awesome capabilities of AutoIt and its libraries. My open source project Peace is a long running AutoIt based app located on SourceForge. It provides users with a system-wide equalizer and effects machine. It's an interface using the power of Equalizer APO, an audio processing object software. Peace has been download over 2,600,000 times by various kind of users. Amongst others it gives them possibilities like these:
      Hearing impaired - Amplify the gain of frequencies which are impaired. Home Theatre - Create Equalizer presets for watching movies and listening to music. Music lovers & audiophiles - Create presets for listening to music on their high quality speakers and headphones. Gamers - Enhance frequencies to get an edge over other gamers. Headphones - Improve the sound quality of cheap headphones and get the max out of expensive ones. Bass lovers - Boost low frequencies for extra bass. Voice - Make a microphone sound better and improve the voice, for instance for YouTube usage. Low audio - Boost low audio of an input source to a comfortable level. This list covers the main needs of the Peace user. Many people have contacted me over the years asking for new features and telling me how they use Peace for their (sometimes specific) needs.  I was able to use AutoIt and its libraries for all of their needs. So what are the main features of Peace?
      Equalize your computer audio by using up to 31 sliders. Support of equalizing 9 speakers : left/right, center, subwoofer, left/right rear, left/right side. Per slider a filter can be chosen such as peak, low/high pass, shelving. The graph windows shows your equalization so you see exactly what you're doing. Apply an effect such as crossfeed simple/Jan Meier/Chu Moy, stereo balance, bass/treble, upmix/downmix, channel routing. Save presets (called configurations) and activate by mouse click, hotkey, desktop shortcut or Peace system tray. Select a target device to equalize, microphone as input can also be equalized. Automate: you can let Peace automatically activate presets on a switch to another device and another process. Peace is available in these languages: English, Czech, Deutsch, Français, Italiano, Nederlands, Pусский, Українська So who am I? I'm a Dutch programmer who happens the stumble upon AutoIt 5 years ago and created a small Equalizer interface app of less than 400 program lines with it. Nowadays Peace has grown to more than 18,000 lines as many features were added. Although Peace is open source, the program code isn't of the best possible quality. The reason being that I didn't expect it to become so popular. It caught me by supprise. I've created a Library of functions called Pal (link to forum post) which quality is up to the AutoIt community standard as counterpart to the Peace program code.
      I want to state here that AutoIt is a mature program language as Peace obviously shows. I wish it to be used more extensively for professional or semi-professional apps. In my view AutoIt deserves a place amongst the major programming languages for Windows computers.
      Regards,
      Peter Verbeek








    • By nacerbaaziz
      hello autoit team
      please i need your help
      i found that the youtube provide a way to get any video informations with this link
      https://youtube.com/get_video_info?video_id=id
      but it incoded i can not read it
      can any one tell me how to decode that please?
    • By nacerbaaziz
      goodmorning; autoit team
      please their are any youtube search way working?
      because i was using the get source and split it to get the result but know it does not working any way.
      is the youtube disabled that? and is their any other simple way to do that?
      i tested all examples found in this post but also it don't work
      https://www.autoitscript.com/forum/topic/123945-youtube-search/
      and here is the example that i use to and it don't work any more
      local $hSearchOpenHNDL, $hSearchConnect, $sSearchGet local $a_UrlsArray[1][5] local $b_ButtonsDisabled = false, $b_SearchBTNFocus = false, $b_SearchListFocus, $h_SearchFocusHND local $Return = "0" local $s_OpenStringY = "/feed/trending" local $ChannelUrl = "", $channelName = "" if Not ($a_YoutubeSearchArray[0][0] = 0) then GUICtrlSetData($searchInp, $s_youtubeSearchLastSearch) $s_OpenStringY = "/results?search_query=" & StringReplace(GUICtrlRead($searchInp), " ", "+") $a_UrlsArray = $a_YoutubeSearchArray for $i = 1 to $a_UrlsArray[0][0] _GUICtrlListBox_AddString($SearchList, $a_UrlsArray[$i][0] & $a_UrlsArray[$i][2] & $a_UrlsArray[$i][3]) next _GUICtrlListBox_SetCurSel($SearchList, $I_youtubeSearchLastIndex-1) GUICtrlSetState($SearchList, $GUI_focus) else if Ping("youtube.com", 1000) > 1 then $hSearchOpenHNDL = _WinHttpOpen('') if not (@Error) then $hSearchConnect = _WinHttpConnect($hSearchOpenHNDL, "youtube.com") if Not (@Error) then $sSearchGet = _WinHttpSimpleRequest($hSearchConnect, "get", $s_OpenStringY) if not (@Error) then local $a_strings = _StringBetween($sSearchGet, '<a href="/watch', "<ul") local $title = "" local $url = "" local $length = "" local $result = "" GUICtrlSetData($SearchList, "") ReDim $a_UrlsArray[1][5] for $i = 0 to UBound($a_strings)-1 $url = _StringBetween($a_strings[$i], "?", '"') if @error then ContinueLoop $url = "https://www.youtube.com/watch?" & $url[0] $title = _StringBetween($a_strings[$i], 'dir="', '</a>') if @error then ContinueLoop $title = $title[0] $title = StringRegExpReplace($title, '(.*\"\>)', "") if StringRegExp($a_strings[$i], '[0-9]{1,2}\:[0-9]{1,2}\:[0-9]{1,2}', 0) = 1 then $length = StringRegExp($a_strings[$i], '[0-9]{1,2}\:[0-9]{1,2}\:[0-9]{1,2}', 2) elseIf StringRegExp($a_strings[$i], '[0-9]{1,2}\:[0-9]{1,2}', 0) = 1 then $length = StringRegExp($a_strings[$i], '[0-9]{1,2}\:[0-9]{1,2}', 2) else $length = "" endIf if IsArray($length) then $length = ": (" & $length[0] & ")" else $length = "" endIf $ChannelUrl = stringRegexpReplace($a_strings[$i], '(^.*?<a.*?\"(\/user|\/channel))+', "$2") $channelName = stringRegexpReplace($ChannelUrl, '(.*?\".*?>)(.*</a>)+', "$2") $ChannelUrl = stringRegexpReplace($ChannelUrl, '(\".*)+', "") $channelName = stringRegexpReplace($channelName, '(</a>.*)+', "") $result &= $title & @crlf & $url & @crlf ReDim $a_UrlsArray[UBound($a_UrlsArray)+1][5] $a_UrlsArray[UBound($a_UrlsArray)-1][0] = $title $a_UrlsArray[UBound($a_UrlsArray)-1][1] = $url $a_UrlsArray[UBound($a_UrlsArray)-1][2] = $length if not ($channelName = "") then $a_UrlsArray[UBound($a_UrlsArray)-1][3] = ", (" & $channelName & ")" if not ($channelUrl = "") then $a_UrlsArray[UBound($a_UrlsArray)-1][4] = "https://www.youtube.com" & $channelUrl $a_UrlsArray[0][0] = UBound($a_UrlsArray)-1 _GUICtrlListBox_AddString($SearchList, $a_UrlsArray[UBound($a_UrlsArray)-1][0] & $length & $a_UrlsArray[UBound($a_UrlsArray)-1][3]) next endIf endIf endIf endIf endIf  
      i hope any one can help me
      thanks in advance
    • By ripdad
      This is a project that I have been working on for several months off and on.
      It's a simple "What You Hear" MP3 @ 320Kbps and WAV audio recorder.
      Features:
      - LoudMax, a Gain Controller and Look-Ahead Limiter
      - Auto Shut-Off after one minute of silence
      - Side-by-Side Simulated LED Meter
      - Running Time Counter
      It started off being a large project, but I eventually stripped it down to its
      bare essentials because I came to realize that it would be very difficult to
      deal with every sound card and every way a PC is set up for audio. It would
      have been a nightmare that I was not willing to go through.
      This project contains the most up-to-date BASS.dll v.2.4.15.0 - December 17, 2019.
      All BASS Dll's are 32bit. Those and the needed UDF's are included in the zip file.
      I will try to explain how it works in the next post.

      Download:
      BASS VST Recorder v1.1.zip
       
×
×
  • Create New...