Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    davegri's Avatar
    davegri is online now Excess Access
    Windows 11 Access 2021
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,740

    New Access Media Player, Music and Video

    Click image for larger version. 

Name:	reduced.png 
Views:	34 
Size:	227.5 KB 
ID:	52790

    This is a complete functional Access application to play your Music and Video folder contents in your Windows PC.
    Anyone interested in how to interact with Windows media files utilizing the Windows Media Player ActiveX control will find a wealth of useful code in this app. Many comments are included. This app depends on Windows Media Player Legacy being installed on the target PC. If needed, use Google to find out how to install it. Microsoft has changed the method several times, so be persistent to find the match for your current Windows version/build.
    I have an earlier post on a simple MP3 player here at the forum dated 3/2/2022 at https://www.accessforums.net/showthread.php?t=85480. This app should replace that app.


    Microsoft has released a new Media Player (Note that the Windows prefix has been dropped). It has a more modern user interface and is a bit more intuitive than the old Windows Media Player (WMP).
    But many people (including me) are having trouble with this new player finding the media files on the computer. Microsoft so far has been unresponsive.


    This writeup deals with 3 media players. To keep matters straight, note terminology below.
    1. WMP, Windows Media Player Legacy, around since Windows XP
    2. MP, Media Player, new with Windows 11
    3. DMP, this app.


    I believe DMP has a better UI and better features then either WMP or WP. The UI is just so much easier to grasp and use.
    Both the MP and WMP as well as DMP can coexist on the same machine with no problems that I could detect.
    However, for DMP to function properly, the old WMP is required, as the new MP does not update the Music Library in a suitable fashion, or at all. Nor does MP show or make provisions for visualizations.


    As for DMP, I've added additional tabs for additional functionality. I added MIDI because I have acquired a few dozen MIDI files over the years and added the ability to play them without having to go to VLC.
    Provisions to play videos have also been added.
    Some of the enhancements were to match the new MP, such as the skip forward and backward as well as the Search. DMP will do some things the WP cannot, such as showing the shuffles remaining when in shuffle
    mode and showing the total playing time for all the current items in the listbox. Nor is Most Recorded function available in MP.
    DMP works by reading media metadata in the Music and Video Library (NOT directly from the MP3/4 file itself). The Libraries are not the same entity as the MP3/4 files in your C:\Users\UserName\Music folder. The Music and Video Libraries (In Windows 11 located at C:\Users\Yourusername\AppData\Local\Microsoft\Medi a Player) are created by WMP scanning your Music and Video folders (and subfolders) and creating the Library entities. Any time you make modifications to existing files or add files to your Music or Video folder, you must run WMP to update the Library. If the metadata in your MP3 or MP4 files is missing, incomplete or wrong, it will affect what the DMP app can see, display and play. I keep my metadata tidy with a shareware utility program, MP3Tag. MP3Tag will also manage album cover images and even allow you to use your own image files.


    Playlists: DMP will handle .wpl and .m3u playlists. It will probably be ok with .m3u8 files if you simply change the extension to .m3u. There are a large number of free programs and cloud services that convert playlists from one format to another, as well as converting media file formats.


    Limitations: WMP is picky about which .mp4 video files on your machine that it will add to the Video Library. It balks at large high resolution files. Anything over 4K 30fps is ignored, and some 4K 30fps files are ignored also. This limitation will likely only affect users who create their own highest quality video content. The average user is unlikely to ever have such video files, because the file size required to hold such high fidelity video is enormous; like 187MB for 13 seconds viewing at 4K 60fps, or 3.5GB for 4 1/2 minutes. These video files are simply not practical for everyday viewing and consuming storage space. Content providers must reduce file size and quality of their high resolution videos before posting content on the internet, or even emailing to friends. My ISP will refuse sending email attachments greater than about 30MB.
    Currently, smartphone video, while quite large, does not approach these severe limits. However, GoPro, DJI Drone and DJI Action cameras can.
    Since DMP only looks at the Media Libraries for input, it will never see these large high resolution files.
    In any case, considerations for improved PC performance could be graphics cards, installed RAM, use of SSD, CODECs and Windows settings.


    Other: Sometimes, WMP will not update the Music library after mass changes to an attribute (like Genre, for example) after an update with a utility such as MP3Tag. Sometimes even a simple change can be ignored. Both WMP and MP appear to have provisions for rebuilding the libraries, but neither works consistently. In fact, I suspect that WP does not use or update the old (WMP) library at all.
    You can save time and trouble by forcing reconstruction of the Library by simply deleting the ENTIRE contents of your AppData's Media Player folder. Really. In Windows 11, mine is at C:\Users\davegri\AppData\Local\Microsoft\Media Player
    After emptying the \Media Player folder, simply open WMP (Legacy) and do nothing with it as it rebuilds the library, which for me takes about 10 minutes for 2451 songs/videos, and you have a fresh pristine Lib.




    If you're curious about the visualization shown, I used WhiteCap from https://www.soundspectrum.com/

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,550
    Dave,
    I modified the path to my music and got the following on refresh.
    This laptop has 16GB RAM.

    No idea where it is getting these from now, but definitely not picking up my music?

    Never mind. i do not have my music in WMP. :-(
    Attached Thumbnails Attached Thumbnails Screenshot 2025-03-01 134504.png   Clipboard01.jpg  
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #3
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,550
    Dave,
    Chucked all my music into WMP and now get this pic and eventually the form.

    Then get the second pic when I click refresh.
    Attached Thumbnails Attached Thumbnails Screenshot 2025-03-01 194542.png   Screenshot 2025-03-01 194851.png  
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  4. #4
    davegri's Avatar
    davegri is online now Excess Access
    Windows 11 Access 2021
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,740
    WGM, Prog loads a copy of whatever metadata file extensions chosen with frmSettings. Metadata is in tblAllMediaMetadata. If prog is unable to create that file content from the media libraries (Music and Video), or the metadata is garbage, then it can't work.
    What are the file extensions of your music files in the Music folder? I have .mp3 and .flac in mine, and choose those in the settings form.
    Also, try running WMP Legacy for a few minutes so that it can build your music library. It also has settings to tell it where your Music and Video folders are located if not in default.
    Then see if WMP Legacy shows any authors, genres, etc., and can it play them? The libraries must be present and intact for WMP or DMP to work properly.

    Perhaps you could try rebuilding the Libraries by deleting the contents as described in Post#1
    Last edited by davegri; 03-02-2025 at 08:49 AM. Reason: thoughts

  5. #5
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,550
    I only use mp3. I will try what you suggest, as it looks a neat program.
    I am using Windows Media Player Legacy.

    I have over 25K songs, over 128GB of music.

    Edit: I did not know " was not allowed in Meta data? After I accepted a few warnings about that the media library read speeded up.
    Is there an option to ignore these, as I can see myself with a good few messages to accept.

    Edit: I found the message and commented it out for me.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  6. #6
    davegri's Avatar
    davegri is online now Excess Access
    Windows 11 Access 2021
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,740
    WGM, sounds like progress. I only had one " in my metadata, so a warning was OK, as it was little trouble to fix the metadata for a single file.

  7. #7
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,550
    Dave,
    Perhaps consider an enhancement?
    Log all errors to a text file and advise if errors found, or open at the end?

    Not code or logic errors, just metadata issues?

    I have lots , plus I am getting syntax errors in sql for the update. yet to track that down. Will report back when I do.

    Just FYI, the count to n of x goes to 62 very quickly then crawls until around 150 or so, then goes fast again.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  8. #8
    davegri's Avatar
    davegri is online now Excess Access
    Windows 11 Access 2021
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,740
    WGM, as far as logging errors, it's obvious I can't anticipate other users' metadata problems, and I've fixed all that I encountered.
    The syntax errors might be on account of allowing the double quotes to go forward, which I screened out in the original.
    As for the slowdown, I can't fix what I can't replicate. I don't get that behavior.

    If you can find solutions to, and document problems you encounter, I can incorporate those changes into a new version.
    Last edited by davegri; 03-02-2025 at 01:48 PM. Reason: sp

  9. #9
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,550
    Quote Originally Posted by davegri View Post
    WGM, as far as logging errors, it's obvious I can't anticipate other users' metadata problems, and I've fixed all that I encountered.
    The syntax errors might be on account of allowing the double quotes to go forward, which I screened out in the original.
    As for the slowdown, I can't fix what I can't replicate. I don't get that behavior.

    If you can find solutions to, and document problems you encounter, I can incorporate those changes into a new version.
    I understand. I am trying to find the sql errors as I type, but it takes quite a while due to that slowness I mentioned.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  10. #10
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,550
    I have 33809 tracks

    Here is the first SQL error
    Code:
    Insert INTO tblAllMediaMetaData (tmpMediaName, tmpMediaArtist,tmpSourceURL, tmpMediaDuration, tmpMediaGenre,tmpMediaAlbum) Values ("That'll Be the Day","Buddy Holly","D:\Music\Rod Pullis\Buddy Holly - That'll Be the Day.mp3", "02:19", "Oldies", "The "Chirping" Crickets")
    Code is for the moment.
    Code:
    Public Sub subWriteToTable(sSName As String, sAName As String, sURL As String, _
        sDuration As String, sGenre As String, sAlbum As String)
        On Error GoTo Error_Handler
        Dim dq As String: dq = Chr(34)  'double quote
        If (sSName & vbNullString) = vbNullString Then Exit Sub
        'EPS 02/03/25
        If InStr(sAName, dq) > 0 Then
            'MsgBox "The artist metadata for " & Chr(39) & sSName & Chr(39) & _
            " has forbidden embedded double quotes ( " & sAName & " ) - skipping.", _
            vbOKOnly + vbInformation, "B A D  M E T A D A T A  " & DMPID
            Exit Sub
        End If
        'EPS 02/03/25
        If InStr(sSName, dq) > 0 Then
            'MsgBox "The Title metadata for " & Chr(39) & sSName & Chr(39) _
            & " has forbidden embedded double quotes - skipping.", vbOKOnly + vbInformation, "B A D  M E T A D A T A  " & DMPID
            Exit Sub
        End If
        Dim sSQL As String
        DoEvents
        sSQL = "Insert INTO tblAllMediaMetaData (tmpMediaName, tmpMediaArtist,tmpSourceURL, tmpMediaDuration, " _
            & "tmpMediaGenre,tmpMediaAlbum) " _
            & "Values (" & dq & Nz(sSName, "<<Unknown>>") & dq & "," _
            & dq & IIf((sAName & "") = "", "<<Blank>>", sAName) & dq & "," _
            & dq & sURL & dq & ", " _
            & dq & Nz(sDuration, "00:00") & dq & ", " _
            & dq & IIf((sGenre & "") = "", "<<Blank>>", sGenre) & dq & ", " _
            & dq & IIf((sAlbum & "") = "", "<<Blank>>", sAlbum) & dq & ")"
        'Debug.Print sSQL
        DoEvents: DoEvents
        CurrentDb.Execute sSQL, dbFailOnError
        Gcount = Gcount + 1
        If CurrentProject.AllForms("frmwait").IsLoaded = True Then
            Forms!frmwait.txtItems = Gcount
            DoEvents
        End If
    Error_Handler_Exit:
        On Error Resume Next
        Exit Sub
    Error_Handler:
        Select Case Err
            Case Else
                MsgBox "Error " & Err.Number & " (" & Err.Description & ")", _
                vbExclamation, "Error in Sub subWriteToTable of modSearch"
                'EPS 02/03/25
                Debug.Print sSQL
    
    
        End Select
        
        Resume Error_Handler_Exit
        Resume
    End Sub
    So I think the Album needs to be screened as well?

    I am experimenting with
    Code:
            & dq & IIf((sAlbum & "") = "", "<<Blank>>", Replace(sAlbum, """", "'")) & dq & ")"
    Attached Thumbnails Attached Thumbnails Screenshot 2025-03-02 152628.png  
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  11. #11
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,550
    That seemed to fix most of them, but I still got this, but cannot see an error for the SQL?
    Code:
    Insert INTO tblAllMediaMetaData (tmpMediaName, tmpMediaArtist,tmpSourceURL, tmpMediaDuration, tmpMediaGenre,tmpMediaAlbum) Values ("Blink 182 - ","Words Of Wisdom","D:\Music\Words Of Wisdom\The Mark Tom And Travis Show\Blink 182 - .mp3", "11:12", "<<Blank>>", "The Mark Tom And Travis Show")
    Success !
    Attached Thumbnails Attached Thumbnails Screenshot 2025-03-02 164142.png  
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  12. #12
    davegri's Avatar
    davegri is online now Excess Access
    Windows 11 Access 2021
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,740
    It will be difficult to accommodate double quotes. What about when double double quotes occur? Triple double quotes? Since you have no control over original metadata content, anything can happen. Perhaps that was my thinking when I simply notified user and screened out problems so that the problem metadata could be corrected outside the app. Metadata can be quite problematic in that sense and I can see why you might find a problem file creation useful.

  13. #13
    davegri's Avatar
    davegri is online now Excess Access
    Windows 11 Access 2021
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,740
    You can edit metadata (but it has to be imported first) by right clicking on a row in the listbox to get the context menu.
    Really handy for eliminating duplicates.

    Click image for larger version. 

Name:	edit.png 
Views:	24 
Size:	121.9 KB 
ID:	52802

  14. #14
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,550
    This is how long it takes to work on 33809 tracks

    Code:
    Refresh Start 02/03/2025 16:51:55
    Insert INTO tblAllMediaMetaData (tmpMediaName, tmpMediaArtist,tmpSourceURL, tmpMediaDuration, tmpMediaGenre,tmpMediaAlbum) Values ("Blink 182 - ","Words Of Wisdom","D:\Music\Words Of Wisdom\The Mark Tom And Travis Show\Blink 182 - .mp3", "11:12", "<<Blank>>", "The Mark Tom And Travis Show")
    Insert INTO tblAllMediaMetaData (tmpMediaName, tmpMediaArtist,tmpSourceURL, tmpMediaDuration, tmpMediaGenre,tmpMediaAlbum) Values ("MVI_2309","<<Blank>>","F:\Users\Paul\Pictures\Coz Pics\MVI_2309.AVI", "00:20", "<<Blank>>", "<<Blank>>")
    Refresh Finish 02/03/2025 17:19:32
    with now just two error messages.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  15. #15
    davegri's Avatar
    davegri is online now Excess Access
    Windows 11 Access 2021
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,740
    How about this to handle double quotes
    It's not perfect as it will change
    The """"Winner" Takes it All
    to
    The ''''Winner' Takes it All
    but sql will not have trouble with it.

    This will at least allow the entries into tblAllMediaMetadata and you can deal with the aesthetics at your leisure.

    Code:
    Public Sub subWriteToTable(sSName As String, sAName As String, sURL As String, _
        sDuration As String, sGenre As String, sAlbum As String)
        On Error GoTo Error_Handler
        Dim dq As String: dq = Chr(34)  'double quote
        Dim sq As String: sq = Chr(39)  'single quote
        If (sSName & vbNullString) = vbNullString Then Exit Sub
        Do Until InStr(sAName, dq) = 0
            sAName = Replace(sAName, dq, sq)
        Loop
        Do Until InStr(sSName, dq) = 0
            sSName = Replace(sSName, dq, sq)
        Loop
        Do Until InStr(sGenre, dq) = 0
            sGenre = Replace(sGenre, dq, sq)
        Loop
        Do Until InStr(sAlbum, dq) = 0
            sAlbum = Replace(sAlbum, dq, sq)
        Loop
        Dim sSQL As String
        DoEvents
        sSQL = "Insert INTO tblAllMediaMetaData (tmpMediaName, tmpMediaArtist,tmpSourceURL, tmpMediaDuration, " _
    Last edited by davegri; 03-02-2025 at 08:08 PM. Reason: clarif

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 7
    Last Post: 12-29-2024, 11:19 PM
  2. User Friendly Access Media Player for Audio
    By davegri in forum Sample Databases
    Replies: 6
    Last Post: 03-10-2022, 01:30 PM
  3. Using Windows Media Player in Access Form.
    By Miles R in forum Forms
    Replies: 3
    Last Post: 03-05-2021, 12:49 PM
  4. windows media player
    By ksmith in forum Programming
    Replies: 3
    Last Post: 09-20-2011, 12:44 PM
  5. Replies: 1
    Last Post: 08-05-2010, 12:01 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums