About This File
This file is 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. zPlayer is powered by winmm.dll which is an integral part of Windows.
This player has the following features:
- No 3rd party dependencies. This player is made with Windows components and standard AutoIt UDFs only
- Play back all formats of digital media files as far as proper codecs are installed in the computer
- Video window is independent of other windows. Minimal GUI for music
- Can load files, folders or an audio CD for playback
- Playlists are automatically generated in sorted and shuffled orders and saved in the folder
- Playlist is hidden by default, availbable when desired
- Context menus available: Play this file, File properties, Search internet, Go to this folder, Remove from playlist
- A double-click on any item plays that item
- Search strings in the playlist
- Forward, backward, pause, change folder
- A-B repeat, current file repeat and multiple-file repeat functions
- Increase/decrease/mute program sound volume. Synchronized with Windows Volume Mixer
- Save play-back environment when terminating a session and resume that environment in the next session
- 'Resume playback' option for a file left off in the middle of playback. Audio fade-in when playback is resumed
- Hotkeys available for most of the functions
- Very small footprint: very low CPU and memory usage
The script is set to run or compile in x64 mode. You can change this setting by commenting out #AutoIt3Wrapper_UseX64=Y. zPlayer.exe, attached hereto, was compiled in x64 mode and is not flagged by Windows Defender as malicious. If you compile the script to an x86 file, the resulting zPlayer.exe will most probably be falsely flagged by Windows Defender as malicious.
If you find an error, please download the latest version as most probably the error may have been corrected already. Otherwise I would appreciate it very much if you could kindly let me know.
Note: zPlayer is the name I used when I introduced the early version of this player in my blog in 2009 and has nothing to do with the mobile media player of the same name which started marketing in 2015.
Version 6.1.2.7 - October 14, 2024
1. Fixed: _VolumeUp() function produced an error when called while playing an audio file. Version 6.1.2.6 was the only version with this error.
Version 6.1.2.6 - October 10, 2024
1. Fixed: {ESC} hotkey was meant to turn full screen off while and only while video was in full screen and visible in the foreground. When Ctrl+Alt+z hotkey was added in Version 6.1.2.5, there must have been a procedure to unset {ESC} hotkey after it is used for minimizing a full screen video.
Version 6.1.2.5 - October 9, 2024
1. Changed: Once auxilliary windows(Help, Playlist and File Properties) are opened, they will remain open and visible even when the main GUI and video window are minimized, until they are explicitly closed. They will remain open even after the folder has been changed and a new playlist has been loaded. If another window is brought to foreground, however, they will not be visible and relevant hotkeys should be pressed to bring them to foreground again.
2. Added: Ctrl+Alt+z hotkey was added for minimizing or restoring the main GUI and video window. You could do this by clicking the taskbar icon or the minimize box of main GUI, but this hotkey can be useful to minimize a full screen video window.
Version 6.1.2.4 - October 1, 2024
1. Fixed: While the main GUI is in minimized state, video is also played in the minimized state and does not show up in the foreground. I would expect the same behaviour when the main GUI is not minimized but is behind another window. For audio playback, it was OK. When a video playback came around, however, the main GUI and the video window came to the foreground and remained in that state afterwards.
Version 6.1.2.3 - September 29, 2024
1. Fixed: Hotkey Ctrl+Alt+m toggles between mute and unmute of the audio output and, if these keys were pressed down for an extended period of time, the player kept toggling. This was the same with all the other hotkeys. Now, however long the keys are kept down, all hotkeys run their respective functions only once at a time. Audio volume controls are the only exceptions.
2. Added: _Execute() function to execute expressions. Triggered by Ctrl+Alt+v, this is mainly for checking the current value of variables including arrays. This function may be of help to those who want to tweak this program. Beware that an AutoIt function like _ArrayDelete() and user-defined function like _Exit() can be executed and may foul up the flow of the program.
Version 6.1.2.2 - September 27, 2024
1. Fixed: There was a line of code in _VolumeUp() function which was included during the proof-test of the Version 6.1.2.1 and not deleted before release.
Version 6.1.2.1 - September 25, 2024
1. Added: A double-click on video image turns full screen mode on or off.
Version 6.1.2.0 - September 21, 2024
1. Added: A single-click on video image pauses or plays video.
Version 6.1.1.9 - September 20, 2024
1. Fixed: The transition of playback to the next video file produced an error if the following sequence of actions took place: Play a video file, maximize it, minimize the windows by clicking taskbar icon, move to the next video file by pressing Ctrl+Alt+Right arrow, restore the windows by clicking taskbar icon.
Version 6.1.1.8 - September 18, 2024
1. Fixed: When an app window is minimized, Windows OS captures the app's image at that point of time and, by default, shows the same image in its thumbnail preview until the app's window is restored. Thus, even if the playback moved on to another item in the playlist while the main GUI was in minimized state, the thumbnail preview would not update the current file name.
2. Fixed: While the main GUI is in minimized state, video window was intended to be also minimized and remain so until main GUI is restored. When the player moved to the next video file, however, the video window got restored.
3. Changed: Some MsgBox() functions were replaced with GUI's so that the message boxes are positioned within the boundary of their parent windows.
4. Changed: The minimize boxes of all child windows were eliminated. The maximize boxes were also eliminated except for the video window.
5. Changed: F11 hotkey for full screen is now set when the center point of video window is visible in the foreground and unset when not.
Version 6.1.1.7 - August 30, 2024
1. Fixed: The main GUI is created with 'zPlayer' as its title. But I wanted its taskbar thumbnail tooltip to show 'zPlayer' in the first line and the current media title in the 2nd line. This was implemented by issuing WinSetTitle() command with 2 lines of text everytime a new file was played back. In Windows 11, it worked perfectly. In Windows 10, however, the tooltip was the same as in Windows 11, but the GUI's title bar showed concatenation of 2 lines. In order to fix this anomally in Windows 10, SetThumbnailTooltip interface was used instead of WinSetTitle() to define the tooltip text.
2. Changed: All the variables needed for implementation of ISimpleAudioVolume interface declared in global scope were moved to pertinent UDF functions as local variables.
Version 6.1.1.6 - August 24, 2024
1. Fixed: If the current position of media was forcefully changed by clicking on the slider while the media was in paused state, the media resumed play as intended but Play icon(▶) did not change to Pause icon(❚❚) in the main GUI.
2. Changed: About a year ago, I added the current file name as the 2nd line of main GUI's title. This worked beautifully as I hoped in my Windows 11. The GUI showed only the first line and the Windows taskbar tooltip showed both lines. I recently found that, in Windows 10, the GUI's title is a contatenation of two lines, without even a space between the two. So far I have no solution for Windows 10 and, therefore, I changed the code to make this function available only in Windows 11.
3. Changed: Put $hMain(main GUI) as the last parameter of FileOpenDialog(), FileSelectFolder() and MsgBox() functions to prevent user's inadvertent interaction with the main GUI while these dialog boxes are open.
Version 6.1.1.5 - August 13, 2024
1. Fixed: Volume could be set to 0 occasionally when the folder is changed.
2. Changed: Disabled the maximize buttons of playlist and file properties windows.
Version 6.1.1.4 - July 18, 2024
1. Fixed: The file properties window could be hidden behind the playlist window when the latter was bigger than a certain size. The default position of file properties window is now set to change relative to the size of playlist window so that it is not blocked in its entirety when the playlist gets focus.
2. Fixed: The main window could unintentionally be hidden behind another window when both the playlist and file property windows were closed successively. Now, the ‘Change Folder’ button receives focus, ensuring that the main window remains on top when any child window is closed.
3. Improved: The readability of the code was improved in areas related to program sound volume. DllCalls were issued every time volume was needed to be adjusted. Now DllCalls are defined in UDFs with readable function names like _VolumeGet and _VolumeSet.
Version 6.1.1.3 - July 9, 2024
1. Fixed: If zPlayer was playing music in the background while you were working in another window, your work window would loose focus when zPlayer moved on to the next item of the playlist. For video, it is natural that the focus moves to the new video window.
Version 6.1.1.2 - June 30, 2024
1. Fixed: The method of getting frame size of video files were changed from GetDetailsOf() to ExtendedProperties(). I recently noticed that the column numbers used in GetDetailsOf(), especially those in 300s, are being changed rather frequently as Windows get updated. Some file properties, including video frame size, can be obtained by ExtendedProperties(), which is called by names instead of column numbers.
2. Changed: Including the column numbers in ini file was meant to allow the user to adapt this program to their Windows version. Now 2 different sets of column numbers are hard-coded in the program: one set for Windows XP and another for Windows Vista and later. The column numbers in the range of 1 to 30 have not changed since they were set for Windows Vista.
Version 6.1.1.1 - June 19, 2024
1. Fixed: An error occurred when "Unload" and "Load File" buttons were clicked in sequence.
Version 6.1.1.0 - June 15, 2024
1. Changed: The default run/compile mode of script was changed to x64.
2. Fixed: Shuffle, Rescan and Reshuffle functions for Audio CD files were not robust enough.
Version 6.1.0.9 - May 20, 2024
1. Fixed: Once a video window is maximized, the next videos in the same session are meant to be opened in maiximized state. The video itself($hVideo) was opened in maximized state, but the parent window($hVideoGUI) failed to open in maximized state.
Version 6.1.0.8 - April 10, 2024
1. Fixed: Support for custom-made playlist was prone to error.
Version 6.1.0.7 - April 8, 2024
1. Fixed: The column header text of playlist listview could be incorrect when a certain sequence of actions took place.
Version 6.1.0.6 - March 27, 2024
1. Fixed: There was a typo in _LoadFiles() function resulting in open failure when "Load File" button is selected.
Version 6.1.0.5 - March 26, 2024
1. Changed: If the player could not open a file or a file which the player tried to open did not exist, the player exited after a warning message. Now the player moves to the next item in the playlist after a warning message.
Version 6.1.0.4 - March 18, 2024
1. Fixed: A lot of rearrangement of existing code was necessary to adopt CD playback and this caused a misbehaviour in an area which worked well previously. Now all functions for media files associated with playlist, such as "resume playback", are available to CD tracks as well.
2. Added: _VolumeSync() adlib function to synchronize volume and mute operations of zPlayer with those of Windows Volume Mixer. User can change the volume or mute the sound either in zPlayer or in Windows Volume Mixer. ISimpleAudioVolume interface was used for this purpose.
3. Changed: Once the program sound was muted, the muted state persisted even when the user loaded another folder. Now the muted state is maintained only when zPlayer moves to the next file in a looping process. When the user selects another file or folder, it is unmuted.
4. Changed: Got rid of "Reload" button in playlist window. It had been added in Version 6.0.2.0 to handle random flickering phenomenon. This phenomenon was fixed in Version 6.0.2.1, and it never happened ever since.
Version 6.1.0.2.Beta - March 5, 2024
1. Changed: When an audio CD is played, zPlayer cannot save the playlist on the CD. So all the player features relying on playlist could not be appiled to CD. Program was changed to save CD playlist in zPlayer.ini file which resides in the script directory. Now zPlayer can resume the playing environment when you move to the CD drive including "resume playback" option. The program has a simple code to verify if the currently mounted CD is the same as the one played last time when the playlist was saved. The relatively small number of tracks on a CD made this possible. This change was more complicated than I first thought, so much so that I decided to call this release a Beta version. If I don't find any major bug during the next couple of weeks, I will make it a formal release. Your feedback is most welcome.
2. Fixed: I had used only "mciSendString" function of winmm.dll for all audio and video playback. It was OK until the addition of CD playback feature. "mciSendString" did not have suitable command strings to control audio volume level for CD playback. This problem was solved by using "waveOutSetVolume" function of the same dll for all audio volume controls of zPlayer.
3. Fixed: zPlayer would not loop to the first track after playing the last track in some CDs.
Version 6.1.0.1 - February 8, 2024
1. Fixed: Setting the file numbers for multi-file repeat function could result in error in certain cases.
2. Fixed: Moving to previous file, via Ctrl+Alt+Left Arrow or ◀ icon, failed while multi-file repeat function was in effect if the immediate previous file was a non-repeat file.
Version 6.1.0.0 - February 5, 2024
1. Added: Support for audio CD. You can load an entire CD via 'Load Folder' menu, or one or more tracks via 'Load File' menu.
2. Fixed: There was a problem in getting file properties when individual files in a root directory were loaded via 'Load File' menu.
Version 6.0.2.3 - Janyary 25, 2024
1. Fixed: Brief, but unintended, flashing of video controls in the center of video image occurred at the beginning of video if the mouse pointer happened to be at the bottom part of upcoming video window.
Version 6.0.2.2 - January 14, 2024
1. Fixed: When the player was playing a video file in fulls creen mode and moved on to another video file, the next file failed to inherit the full screen mode. This behaviour was evident when a music file was in between the two video files.
Version 6.0.2.1 - January 11, 2024
1. Fixed: The flickering of listview control in playlist window. Since this happened randomly and quite rarely for an unknown reason, I have no way to confirm that the problem was really fixed. Even though I could not find any clue in AutoIt Help, I suspected that the mere existence of control IDs for context menu could randomly cause the problem. In order to prevent pile-up of expired context menus, I previously had a routine to delete existing menu items just before creating a new set. But now the menu items are deleted immediately after the close of context menu popup. I have not noticed any incidence of flickering for several days now. I hope the problem was fixed.
2. Fixed: Video image intermittently failed to stretch to fulls creen while in paused mode.
3. Added: A dialog box for confirmation of removing an item from playlist when 'Remove from playlist' context menu is selected.
4. Added: An adlib function to check the position and size of video window at 500ms interval. The video control is resized only if there was a change in the video position or size. Previously several functions, such as _FullScreen() and WM_MOVE(), called the resize funtion on their own, thus sometimes duplicating the resize function calls.
5. Changed: If the player moves on to a new file while the file property window is open, the file properties will be updated with those of the new file.
6. Changed: When file property function or internet search function is called, hotkeys and context menus act differently now. Hotkeys always work on current file, while context menus always work on any item selected in the playlist.
Version 6.0.2.0 - January 8, 2024
1. Improved: Substantially reduced time for obtaining file properties. It was done by reducing the number of GetDetailsOf() function calls from all available column numbers(>320) to 25 essential ones. Most file types take less than 500 milliseconds per file, while a large mp4 file may take more than 1.5 seconds.
2. Added: "File Property Column Numbers" key in zPlayer.ini file. The default values are GetDetailsOf() column numbers valid for recent Windows versions. If your OS support different numbers, you must change the ini file key value to suit your OS.
3. Added: "Reload" button in the playlist. I found rare instances of playlist flickering after a context menu is executed. The flickers can be stopped by reloading the playlist.
4. Added: "Esc" hotkey to turn video full screen off. This hotkey is effective only when video is in full screen mode.
5. Changed: When GUIs are set to their default positions by Ctrl+Alt+w hotkey, larger GUIs are activated first so that smaller ones become visible on top of larger ones.
Version 6.0.1.9 - December 26, 2023
1. Item 4 of changes made in Version 6.0.1.8 was a wrong choice. Out of more than 10,000 media files I have, only 64 had problems, and this did not justify the extra time spent on obtaining the media length by a different method. The problematic files were all from one folder which contained files that I collected from unknown sources about 20 years ago and all of them had non-standard bitrates such as 201. I thought I had better throw them away. So I reverted to shell.application method for initial process of making a new playlist. Instead, the program will check the length using winmm.dll command string while the file is actually playing and dynamically update the playlist if necessay.
Version 6.0.1.8 - December 24, 2023
1. Added GUICtrlSetState($idFolder, $GUI_FOCUS) here and there to make "Change Folder" button of main GUI to get focus upon closure of any other GUI.
2. Fixed: Shuffle/Sort button in main GUI could get focused only by tab key, not by arrow key. Now arrow keys can also move the focus to and from Shuffle/Sort button.
3. Fixed: When the Rescan button in playlist window is clicked, the non-used playlist (e.g. zPlaylist-Shuffled.txt when zPlaylist.txt was being played back) was created with Length column empty.
4. Changed: The method of obtaining the media lengths in the playlist was changed from shell.application object to winmm.dll command string. Shell.application is 2 to 3 times faster but it produced wrong (mostly shorter) lengths for some media files for an unknown reason.
Version 6.0.1.7 - December 18, 2023
1. Fixed: 'Resume Playback' position was not saved correctly when playlist was unloaded by clicking Unload button or by pressing Ctrl+Alt+u.
2. Fixed: Marquee adlib function for title display in the main GUI, once registered, was not properly unregistered even when the length of title did not require the function.
Version 6.0.1.6 - December 11, 2023
1. Corrected: An error occurred when video full screen was turned on by F11 hotkey while video window was not visible. Now F11 hotkey is valid only when the center point of video is visible.
Version 6.0.1.5 - November 22, 2023
1. Corrected: An error occurred when the following sequence of actions took place:
(1) While a video file is playing, click the taskbar icon of zPlayer and minimize all GUIs.
(2) While all GUIs are minimized, the player moves on to the next file, which happens to be an audio file.
(3) While an audio file is playing, click the taskbar icon of zPlayer again.
(4) I would expect to see the main GUI only. But an empty $hVideoGUI remained on the screen as well.
2. Changed the function of Ctrl+Alt+w hotkey. Now it will bring up all open GUIs to the foreground and move them to their default positions.
Version 6.0.1.4 - November 14, 2023
1. Corrected: Error when "Find Next" button is clicked in the playlist window. There must have been some foul-up in making changes somewhere else.
Version 6.0.1.3 - November 3, 2023
1. Corrected: The closing parenthesis missing for the folder name in the playlist column header when a root folder of a drive is loaded.
2. Corrected: A-B repeat and multi-file repeat setup windows not working as intended when the video window is in maximized or full screen mode.
3. Eliminated redundant process of getting the total length of a playlist when the playlist is shuffled or sorted. Previously, _GetLength() function was called as a part of _PlaylistLoad() function , but now it is called separately as needed.
4. Changed the term "shuttle" to "progress bar" and "streaming" to "playback" to alleviate any confusion. The small rectangular progress bar moves along the slider to indicate current media position.
Version 6.0.1.2 - October 10, 2023
1. Corrected the problem of total media length of the playlist not showing after removal of an item from the playlist by way of context menu.
2. Revised Help file to show file types which can be played back by winmm.dll without installing additional codecs.
Version 6.0.1.1 - September 28, 2023
1. Corrected the problem of Windows Defender incorrectly detecting zPlayer.exe as malware. Through comparison of codes, I found that using WinSetState function to hide video control GUI caused the false detection. The problem was solved by using GUISetState instead of WinSetState.
Version 6.0.1.0 - September 26, 2023
1. A minor error was found and corrected. When I clicked zPlayer icon on the taskbar to hide all open GUIs, the video control on video window, which is almost transparent, remained on the screen.
2. Some spelling mistakes in Help window were corrected.
Version 6.0.0.9 - September 22, 2023
1. When a folder is selected, and if the folder has media files in both the top-level and sub-level folders, an option will be given to include or exclude the files in sub-level folders. If a playlist file already exists in the folder, this option will be skipped. If the user wants to change the scope of inclusion, the playlist should be deleted before selecting that folder, or the Rescan button clicked in playlist window.
2. If the mouse moves over zPlayer icon on the Windows taskbar, the current file name will appear in a tooltip. Clicking this icon will hide or show all open GUIs.
Version 6.0.0.8 - September 12, 2023
1. Made changes here and there including some major ones, to accomodate virtual listview, which was not as a simple task as it seemed at first.
Version 6.0.0.7 - September 09, 2023
1. Changed the method of adding items to playlist from _GUIListView_AddArray() to virtual listview, which is much faster and allows colored background without flickering.
2. Added multi-file repeat function, which can be set-up in a little GUI invoked by clicking the total length label at the right side of progress bar. As I listen to a large playlist, sometimes I feel like repeating several items, Beethoven's Symphony 9, movements 1 to 4, for example, out of a collection of several hundred classical music titles. In order to visualize this set-up, the player displays selected items in pink background.
Version 6.0.0.5 (August 27, 2023) and Version 6.0.0.6 (August 29, 2023)
1. Added Ctrl+Alt+s hotkey to perform shuffle/sort functions. - Version 6.0.0.5
2. Fixed error in the process of removing an item from the playlist, an aftermath of adding length column in the playlist. - Version 6.0.0.6
3. Added a column to playlist to show length of each file. The total length of the playlist is also displayed in the file name column header. - Version 6.0.0.5
Note: When you load a folder for the first time, the player will get media lengths in the background and fill the Length column of the playlist. During this time, media will keep playing but Shuffle/Sort, Load/Unload, Rescan and Reshuffle functions will be disabled and media title will be displayed in red color. This process will take about 15 seconds for a folder containing 500 media files. Playlists created by the former versions are compatible with this version, but it is recommended that all previous playlists be deleted before running this version. If you have a manually-made playlist, you may keep it.
Version 6.0.0.4 - August 14, 2023
1. Added $SS_NOPREFIX in the style of title display label, so that "&" symbol contained in the file name is displayed correctly.
2. Improved A-B repeat set-up and cancel procedures.
Version 6.0.0.3 - August 7, 2023
1. A new hotkey(Ctrl+Alt+t) was defined to set "Always On Top" attribute of main GUI on or off.
2. Provided for the possibility of A-P Repeat set-up window to be positioned on the left side of main GUI, in case the user has moved the main GUI to the right side of the screen.
Version 6.0.0.2 - August 4, 2023
1. Changed the color of media control icons(Unicode characters) in main GUI from default black to gray. The black icons looked too conspicuous compared to other components nearby.
2. Corrected a minor error in A-B repeat set-up function where starting and ending positions entered in seconds instead of mm:ss format failed to work correctly.
3. Corrected errors in re-creation of playlists after 'Reshuffle' or 'Remove from playlist' operations.
4. Added a procedure to ensure the integrity of existing zPlaylist.txt and zPlaylist-Shuffled.txt files when loading a folder.
Version 6.0.0.1 - July 29, 2023
1. Changed writing mode of files from UTF-8 to UTF-16 to handle double-byte characters correctly.
2. Added a function to accommodate manually-made playlist which contains files from different folders.
3. Added some details about playlist in Help contents and changed zPlayer_ReadMe file format from text to PDF.
Version 6.0.0.0 - July 23, 2023
1. Changed playback engine from IE-embdded WMPlayer.ocx to Winmm.dll.
2. Reduced the main GUI to a bare minimum and the playlist window is hidden by default.
3. To cope with the reduced GUI, the name of current file flows in marquee style.
4. Added an option to load files instead of folders.
5. Implemented A-B repeat function.
6. Implemented audio fade-in when resuming playback from the last streamed position.
7. Changed default position of video window from right upper corner of screen to center.
8. The media control in video window is hidden by default and becomes visible when mouse hovers over the bottom of the window.
9. The length of progress bar in video window is as long as the width of the window.
10. Eliminated file installs and used unicode characters instead for all media controls.
11. Unless the video window is maximized or stretched to full screen, its size is forcefully adjusted to keep the source aspect ratio.
Edited by CYCho
What's New in Version 6.1.3.0
Released
Version 6.1.3.0 - October 23, 2024
1. Changed: In the playlist window, you can now move to an item by 'searching' the item number in the search box.
2. Fixed: When the playlist window was overlapped by a video window in its entirety, the playlist window could not be closed by clicking the media title control($idTitle). Though this was fixed, it is still better to use Ctrl+Alt+l hotkey to open and close the playlist window. The problem occured because the playlist window looses focus the moment media title control is clicked and the main GUI and video window come to the top.
Version 6.1.2.9 - October 21, 2024
1. Fixed: When the player moved to the next file without user intervention while the audio was muted, the mute state is supposed to be mainatined with the speaker icon crossed out. When the next file happened to be a video file, however, the speaker icon in the video control was not crossed out.
2. Fixed: Positions of viedo controls were fouled up when the default video width had to be narrowed down so that its height does not exceed screen height.
Version 6.1.2.8 - October 18, 2024
1. Added: A check icon(✅) was added in the video control. After resizing and moving the video window to your liking, you can click this icon to set/unset current video size and location as default. When default is set, and the icon turns pink, a full screen or maximized video will restore to that default and the ensuing video files in the current session will be played in that default size and location.
2. Improved: The CPU usage of this player is comparable to any modern media player, and considerably lower than Windows Media Player Legacy, especially in video playback. It was further reduced slightly by lengthening the calling intervals of some adlib functions and moving some tasks from adlib to standard user-defined functions.