Jump to content

zPlayer - a small audio and video player 4.0.0.2

   (1 review)

4 Screenshots

About This File

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: ED6FA666192AD8420161BB3E082F7440886A5DFA9D258AFB54D486AEA2D9703B
SHA1: 9F41B7B1E01DA66A0A1C59398769D5AEB26A62D6

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.

Spoiler

CHANGE LOGS

Version 4.0.0.2 - March 26, 2022
1. When a video was paused while being played in maximized (not full screen) window, the image would shrink to a certain size smaller than the GUI for an unknown reason. _ResizeWMP() was added at the end of MyPause() function as an ad hoc measure. This brings the image back to normal size, but there is a short flicker while resizing the image. This problem remains to be solved in the future.

Version 4.0.0.1 - March 19, 2022
1. Implemented resizing of video in a Windows Media Player ActiveX control. This was made possible by using SetObjectRects method as demonstrated by @MattyD in his recent post (https://www.autoitscript.com/forum/topic/207744-media-player-embedding/?tab=comments#comment-1498631). Previously WMP was embedded in an Internet Explorer HTML document and I was worried of IE being not supported by Windows.

Version 3.0.2.6 - March 15, 2022
1. Deleted _IEAction ($myIE_Obj, "scrollintoview") from MyWMPlayer() function. It was found that _IEAction ($myIE_Obj, "refresh") was not necessary to start with.

Version 3.0.2.5 - March 14, 2022
1. Fixed code broken by newly released AutoIt stable version v3.3.16.0. An error occured at line #428 (While $oPlayer.playState <> $iPlaying) which meant that the WMP object was not duely created. It was solved by replacing _IEAction ($myIE_Obj, "refresh") with _IEAction ($myIE_Obj, "scrollintoview") in MyWMPlayer() function. Thanks go to @pixelsearch for his help in finding the cause.
2. Redundant re-creation of shell.application object in MyFileProperties() function was eliminated.

Version 3.0.2.4 - December 2, 2021
1. Added "File properties" to the playlist context menu. The user can copy any file property by doubleclicking an item in properties window and, therefore, previous context menus for copying file name and path were eliminated. File properties for the current file can also be invoked by clicking the media title in the main window.

Version 3.0.2.3 - November 5, 2021
1. In order to accommodate Unicode folder names, changed file format of zPlayer.ini file from default ANSI to Unicode UTF16 Little Endian.

Version 3.0.2.2 - October 29, 2021
1. Eliminated 'Video full screen on/off' menu from the main window because, according to my experience, it is better to handle it in the video window alone.
2. The function of 'Go to this folder' of the playlist context menu was expanded. In addition to going to the current folder, it now searches the relevant file in the folder. The error in finding a folder name with spaces was corrected.

Version 3.0.2.1 - September 8, 2021
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.
2. Added a function to continue playback of a media from where it was left off. The initial default criteria for activation of this function are minimum media length of 600 seconds and minimum streamed length of 300 seconds. When you change the folder or exit the program and the current file meets these conditions, the current media position is saved in the playlist. When you reload that playlist, you will be asked if you want to continue or restart. By changing the preferences in Help window, you can adjust the minimum lengths, disenable this function or let the program automatically jump to the saved file position without asking a question.
3. Made substantial changes to wordings of the main window to increase readability and intuitiveness.

Version 3.0.2.0 - August 16 , 2021
1. Corrected malfunction in synchronization of zPlayer graphic controls when the user pauses or plays a file through video window context menu.
2. Improved readability of code by changing docking values for controls in playlist window from intigers to global constant variables defined in the GUIConstantsEx.au3.

Version 3.0.1.9 - July 19, 2021
1. Added menu buttons in playlist window to move an item up or dwon. Drop and drag was not impemented at this stage considering it's complexity for a small player like this.
2. Streamlined codes for drawing menu buttons in playlist window to improve readability and make it easier to add or delete a menu button.

Version 3.0.1.8 - July 3, 2021
1. Added 4 alternate hotkey sets to be used when the Windows uses Ctrl+Alt+Arrow shortcuts to change screen orientation. This happens when the computer has Intel CPU and Intel HD Graphics Control Panel installed. The alternate hotkeys use =, -, < and > keys instead of up, down, left and right arrows.
2. Changed some lines of code to comply with good coding practice.

Version 3.0.1.7 - April 17, 2021
1. Added Ctrl+Alt+0(Zero) hotkey to restore all windows to their default postions
2. Added Ctrl+Alt+c hotkey to show/hide media controls in video window

Version 3.0.1.6 - March 27, 2021
1. Drastically reduced the playlist load time by using _GUICtrlListView_AddArray() function instead of _GUICtrlListView_AddItem(). The load time was further reduced by use of _SendMessage(GUICtrlGetHandle($ctrlView), $LVM_DELETEALLITEMS) instead of _GUICtrlListView_DeleteAllItems() for deleting existing listview items when changing the folder. It used to take more than 5 seconds to load an 8,000-item playlist but, now, it takes less than 2 seconds.
2. Disabled hiding or showing main and/or playlist windows when video is playing in full screen or maximized mode.
3. Fixed incorrect functioning of Ctrl+Alt+m hotkey for changing playing mode.

Version 3.0.1.5 - March 24, 2021
1. Added codes to make the current item of the listview control remain focused all the time when the playlist window is visible.
2. Disabled hiding or showing main and/or playlist windows when video is playing in full screen mode.
3. Fixed incorrect functioning of Ctrl+Alt+m hotkey for changing playing mode.

Version 3.0.1.4 - March 17, 2021
1. Fixed the problem of main window being minimized when the Close box of playlist window is clicked.
2. Changed hotkeys for Play Next File, Play Previous File, Increase Volume and Decrease Volume from Ctrl+Arrows to Ctrl+Alt+Arrows. This will unify all the hotkey combinations of zPlayer and free up Ctrl+Arrows which are frequently used by other applications.
3. Fixed the problem of the title bar text of playlist window failing to accurately indicate the current playing mode.
4. Improved the way playlist window is scrolled to bring current file to the center of the window. Now it works dynamically while the window is resized.
I owe special thanks to @pixelsearch for his kind and active participation in this update.

Version 3.0.1.3 - March 14, 2021
1. Provided an input box in the Welcome window to allow the first time user to add file types to the default ones.
2. The main loop, which basically handled messages from all of the windows, was divided into 3 loops: one loop each for main window, playlist window and video window.
3. Eliminated minimize and maximize boxes from playlist window.
4. Eliminated horizontal scroll bar from listview control.
5. Added many comments to increase readability of source code.

Version 3.0.1.2 - March 11, 2021
1. Changed some constants to variables: they are heights of listview header and individual items in the playlist window, which are used for scrolling the current file to the center of window, and GUI border width, which is a factor affecting the default positions of windows. They are now obtained from an acutual temporary GUI created at the start of the program so that they accurately reflect the user's OS and default language which affect their values.
2. Streamliined the procedure to handle discrepancy between a playlist and actual files existing in the folder.

Version 3.0.1.1 - March 6, 2021
1. Fixed the problem of mute status being automatically unmuted when a new file is loaded.
2. Set $oPlayer.Settings.autoStart to true once at the start of the program instead of issuing $oPlayer.Controls.Play every time a file is loaded.

Version 3.0.1.0 - February 26, 2021
1. Streamlined procedures which synchronize media controls of zPlayer and Windows Media Player. New code is shorter and more readable.
2. Added a submenu item(Copy file name) in playlist context menu.

Version 3.0.0.8 - February 21, 2021
1. Changed design of main window so that the file name label control dynamically adjusts its position as the string size of the file name changes.
2. Added a menu and hot key in the main and video windows. Turn UI Full Screen On/Off (Ctrl+Alt+u) will toggle the full-screen mode of video window on and off.
3. zPlayer controls such as pause/play, repeat(loop) and volume level are now synchronized with WMP-intrinsic media controls in video window.
4. Changed the way repeat function works: Instead of loading the same file again after its play is complete, it now uses $oPlayer.Settings.setMode("loop", True). This makes the transition from end of file to beginning of file very smooth, especially noticeable in video files.

Version 3.0.0.6 - February 13, 2021
1. Changed media length and current position formats from MM:SS to HH:MM:SS. When this player was for audio only, HH was rarely needed.
2. Improved the way the media position indicators work in both main and video windows such that their numbers are changed real time as the slider shuttle is clicked and dragged.
3. The shape of mute control icon was changed for more intuitive look.

Version 3.0.0.5 - February 10, 2021
1. Media controls have been added to video window. By default it is a small rectangle in the bottom right corner of the video window which can be expanded to a collection of full controls when necessary.
2. mkv was added to default file types. It is recommended that existing zPlayer.ini file be deleted before applying this update.

Version 3.0.0.4 - December 7, 2020
1. A major error was found in "Rescan" function and corrected.

Version 3.0.0.3 - October 7, 2020
1. The file extension was the basis for zPlayer to recognize a video file, but now the existence of video image in the file itself is the basis for recognition of a video file. As a result, there is no need to have two separate keys for audio and video file types to be defined in zPlayer.ini file. Now all audio and video file types are defined under one key named File Types.

Version 3.0.0.2 - August 10, 2020
1. Added context menu in the playlist window with following submenus: Play this file, Delete from playlist, Copy file path, Go to this folder, Search internet
2. Added Reshuffle button to the playlist window. It reshuffles the current shuffled playlist. The button is disabled when the play mode is Sequential.
3. Used _GUICtrlListView_AddItem() instead of GUICtrlCreateListViewItem() to add playlist items, thus avoiding frequent re-creation of playlist window.

Version 3.0.0.1 - August 4, 2020
1. Added a video player
2. Depending on the file types specified by the user in zPlayer.ini file this player can be either audio only, video only or both.

 

Edited by CYCho


What's New in Version 4.0.0.2

Released

1. When a video was paused while being played in maximized (not full screen) window, the image would shrink to a certain size smaller than the GUI for an unknown reason. _ResizeWMP() was added at the end of MyPause() function as an ad hoc measure. This brings the image back to normal size, but there is a short flicker while resizing the image. This problem remains to be solved in the future.


User Feedback

Recommended Comments

Hey, nice player, one thing i think could be improved is the volume function.

The mute function mutes the whole pc sound, instead of just the player, same for the volume adjust,

it adjusts the global system volume instead of just the player volume.

Link to comment
Share on other sites

@careca Many thanks for your comment. I will look if I can do it. I may ask for your help.

PS: I could do it without too much difficulty. New version was uploaded.

Edited by CYCho
Link to comment
Share on other sites

@seadoggie01 It works OK with .wav file in my computer. If you are using Windows 10, please check if Windows Media Player feature has been turned on. You can do it via  ‘Control Panel’ > ‘Programs’ > ‘Programs & Features’ > ‘Turn Windows Features On or Off’' > 'Media Features' > 'Windows Media Player'.

This player is supposed to work with all file types supported by Windows Media Player. FLAC and OGG files can also be played if proper codecs are installed.

Link to comment
Share on other sites

@seadoggie01 That's right. I used to have an input box at the start of the program to define the file types. But I deleted it because I thought it was so rarely used. Now you can define them by editing the zPlayer.ini file as memntioned in the Help. Once in there, it will remain there unless you edit the ini file again. I will have to elaborate this in the readme.txt. Thank you for pointing that out. And thanks for your positive review.

Edited by CYCho
Link to comment
Share on other sites
  • Similar Content

    • By CYCho
      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.
      After I retired from active duty in 2002 I spent much time listening to music. First I started with CD's and LP's, then quickly moved on to mp3 files. I converted many of my CD's to mp3 and I collected many more from various sources which were freely available at the time. As the number of my mp3 files grew, I put them in folders according to their genres and my favorite classifications. I mainly used Windows Media Player to listen to them and I slowly began to dislike wmp because it had massive user interface while I just wanted to listen to music in the background while I was doing other work in the foreground, hopping between folders from time to time. It was the time I was beginning to learn AutoIt and I thought I should make my own player with AutoIt. Coming from a sales career with no experience in programming, it was not an easy task. Somehow, after about 2 years of learning and trying, I had my own audio player which worked with only hotkeys without any graphical interface. I gave it to some of my friends who were not as computer-savvy as I. They liked it but definitely wanted something to clcik with mouse. So I came up with very rude gui which took a form similar to what it is now.
      The attached source files include one au3 file, one icon file and 14 jpg files. The jpg files are used for drawing a graphical player and are fileinstalled in @DocumentsCommonDir folder. This player uses WMPlayer.OCX as its engine and supports all audio file formats supported by wmp and additional codecs installed. I would like to thank @Bilgus for kind answers to my questions and would appreciate it if anyone could review the code and give me any suggestion. This player works for me, but I don't know whether the code is presentable as an example. I am posting this here with a hope to learn much from AutoIt community.
      PS: Video function was added in August 2020. 
      Please see Downloads section of this forum for the latest version of this player.


    • 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...