Results 1 to 21 of 21

Thread: [RESOLVED] Open multiple MP3 files in Windows Media Player?

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,070

    Resolved [RESOLVED] Open multiple MP3 files in Windows Media Player?

    Hey,

    I'm creating a kind of 'playlist manager' application where the user can create his own music playlist and then play it from my application. However, I don't want to give my application any playback features itself, as there are already so many media players around. Instead, I just want to open the files in the current playlist in the media player of the user's choice.

    I have a list of MP3 files (their filenames), how do I now open these files simultaneously in, for example, Windows Media Player?

    I can get it to play one song, using this command (and Process.Start)
    Code:
    wmplayer.exe /play "D:\Music\Artist\Song1.mp3"
    But I cannot get it to play multiple songs... I tried just listing all the songs in the arguments, separated by a comma or semicolon or... anything I could think of, but nothing worked. It just plays the first song in the list and nothing else.
    Code:
    wmplayer.exe /play "D:\Music\Artist\Song1.mp3","D:\Music\Artist2\Song3.mp3","D:\Music\Artist43\Song23.mp3"
    Surely this must be possible? You can open multiple files in windows itself simply by selecting them and opening them at the same time. I'm pretty sure the filenames of the selected files will then be in the arguments of wmplayer so that it can open them, but I just don't know in what format... Can I see this somehow?

    Thanks!

  2. #2
    Stack Overflow mod​erator
    Join Date
    May 2008
    Location
    British Columbia, Canada
    Posts
    2,824

    Re: Open multiple MP3 files in Windows Media Player?

    Have you tried space-separated? I'm pretty sure that's it

    If not, you can just add the WMP COM component to your application and build your own song queue box.

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,070

    Re: Open multiple MP3 files in Windows Media Player?

    Nope, that doesn't work either.

    Here's my code:
    vb.net Code:
    1. Private Sub playButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles playButton.Click
    2.     Dim files = New List(Of String)
    3.     For Each audioFile As AudioFile In Me.Playlist
    4.         files.Add(audioFile.FullName)
    5.     Next
    6.  
    7.     Dim args As String = "/play """ + String.Join(""" """, files.ToArray()) & """"
    8.     Dim p As New ProcessStartInfo("wmplayer.exe", args)
    9.     Process.Start(p)
    10. End Sub

    And here's the exact string that I sent as the arguments ("args"):
    Code:
    /play "D:\Music\Deadmau5\01 Alone With You.mp3" "D:\Music\Deadmau5\02 Arguru (EDX's 5un5hine Remix).mp3" "D:\Music\Deadmau5\03 Bye Friend.mp3" "D:\Music\Deadmau5\04 Clockwork.mp3" "D:\Music\Deadmau5\05 Complications.mp3" "D:\Music\Deadmau5\06 Everything After.mp3" "D:\Music\Deadmau5\07 Everything Before.mp3" "D:\Music\Deadmau5\08 Faxing Berlin.mp3" "D:\Music\Deadmau5\09 Ghosts N Stuff.mp3" "D:\Music\Deadmau5\10 Hi Friend Feat Mc Flipside (Instrumental Mix).mp3" "D:\Music\Deadmau5\11 Hi Friend Feat Mc Flipside (Vocal Mix).mp3" "D:\Music\Deadmau5\12 I Remember (Vocal Mix).mp3" "D:\Music\Deadmau5\13 Jaded.mp3" "D:\Music\Deadmau5\14 Not Exactly.mp3" "D:\Music\Deadmau5\15 Secondary Complications.mp3" "D:\Music\Deadmau5\16 Slip.mp3" "D:\Music\Deadmau5\17 Some Kind Of Blue.mp3" "D:\Music\Deadmau5\18 We Fail.mp3" "D:\Music\Deadmau5\19 I Remember Feat Kaskade (Instrumental Mix).mp3" "D:\Music\Deadmau5\Deadmau5 & Kaskade - I Remember (D Dub Edit).mp3" "D:\Music\Deadmau5\Deadmau5 & Kaskade - Move For Me.mp3" "D:\Music\Deadmau5\Deadmau5 - Ghosts n Stuff.mp3" "D:\Music\Deadmau5\Deadmau5 - Not Exactly(1).mp3" "D:\Music\Deadmau5\Deadmau5 - Sex, Lies & Audiotape (Original Mix).mp3" "D:\Music\Deadmau5\Deadmau5 - The Reward is Cheese.mp3" "D:\Music\Deadmau5\Deadmau5 ft. Kaskade - I Remember.mp3" "D:\Music\Deadmau5\Fragma vs P Diddy - Toca's Last Night (Deadmau5 Remix).mp3"
    (Not my favorite choice of music but the D was first in the list )

    Still it only plays the first one, it doesn't open them all like it would if I would select all files in explorer and opened them.

    And I don't really want to play them myself, I'd also like to allow the user to open the playlist in other applications like Winamp. I guess I'll have to figure out how to open multiple files in Winamp too, but I gotta start somewhere, and it doesn't even work in WMP yet lol.


    Perhaps the only other option is to create a playlist (wpl file I think) and open that. I know how to open a playlist, but actually creating one might be a bit harder. It looks like an ordinary XML file but there is some kind of GUID after every song and I've no idea what it means, if I can leave it out, etc...

  4. #4
    Stack Overflow mod​erator
    Join Date
    May 2008
    Location
    British Columbia, Canada
    Posts
    2,824

    Re: Open multiple MP3 files in Windows Media Player?

    I would normally check this myself, but I'm on a Linux computer right now :P Sorry.

    What does it say in the Registry for playing it? Is it just wmplayer /play %L ? Or is it wmplayer %L or something else?

    (Like in HKEY_CLASSES_ROOT\.mp3, look for the CLSID, find that in CLSID and look for the default value in Open or whatever it is...)

  5. #5

  6. #6
    Stack Overflow mod​erator
    Join Date
    May 2008
    Location
    British Columbia, Canada
    Posts
    2,824

    Re: Open multiple MP3 files in Windows Media Player?

    Use Find Next (Ctrl+F) and look for "WMP11.AssocFile.MP3" in Keys (not Values).

  7. #7

  8. #8
    Stack Overflow mod​erator
    Join Date
    May 2008
    Location
    British Columbia, Canada
    Posts
    2,824

    Re: Open multiple MP3 files in Windows Media Player?

    What's the parent of that key?

  9. #9

  10. #10
    Stack Overflow mod​erator
    Join Date
    May 2008
    Location
    British Columbia, Canada
    Posts
    2,824

    Re: Open multiple MP3 files in Windows Media Player?

    Oh. Missed that ... using Find Next, is there another one? If not... I can't help you so good luck

  11. #11

  12. #12
    Stack Overflow mod​erator
    Join Date
    May 2008
    Location
    British Columbia, Canada
    Posts
    2,824

    Re: Open multiple MP3 files in Windows Media Player?

    Ah okay. Sorry. I'll take a look on Windows XP, see if that reveals anything. I think it works differently.

  13. #13
    Stack Overflow mod​erator
    Join Date
    May 2008
    Location
    British Columbia, Canada
    Posts
    2,824

    Re: Open multiple MP3 files in Windows Media Player?

    Found it!!! It is:
    Code:
    "C:\Program Files\Windows Media Player\wmplayer.exe" /prefetch:5 /Open "%L"
    So try that string, replacing "%L" with the list. I tried:
    "C:\WINDOWS\Media\onestop.mid" "C:\WINDOWS\Media\flourish.mid"
    And it only opened the first one, but try some different separators.

    In the meantime, I'm going to make an experimental application to see what format the arguments are.
    Last edited by minitech; Jul 21st, 2010 at 02:36 PM.

  14. #14

    Thread Starter
    PowerPoster
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,070

    Re: Open multiple MP3 files in Windows Media Player?

    Sorry mate, but it still doesn't work

    I tried every separator I could imagine, space, comma, tab, semicolon, etc. I even tried replacing the prefetch:number by the number of songs (had no idea what the 5 stood for), but whatever I try it comes up only with the first song...

  15. #15
    Stack Overflow mod​erator
    Join Date
    May 2008
    Location
    British Columbia, Canada
    Posts
    2,824

    Re: Open multiple MP3 files in Windows Media Player?

    Ah, okay...
    I just made a project to show command-line arguments:
    Code:
    Sub Main()
         Console.WriteLine("""" & String.Join(""" """, Environment.GetCommandLineArgs()) & """")
    End Sub
    Then I added the appropriate registry keys for PersistentHandler, the default value, the testfile file type, and its shell/open/command:
    Code:
    "C:\testapp.exe" "%L"
    and it opened 2 instances. The solution? Run each file separately You need multiple Process.Start calls, one for each MP3 file.

  16. #16
    Stack Overflow mod​erator
    Join Date
    May 2008
    Location
    British Columbia, Canada
    Posts
    2,824

    Re: Open multiple MP3 files in Windows Media Player?

    Ah... that didn't work either Sorry. Finally found it, though - create a .wpl file. The structure is:
    Code:
    <?wpl version="1.0"?>
    <smil>
        <head>
            <meta name="Generator" content="Microsoft Windows Media Player -- 11.0.5721.5268"/>
            <meta name="AverageRating" content="0"/>
            <meta name="TotalDuration" content="88"/>
            <meta name="ItemCount" content="1"/>
            <title>Playlist1</title>
        </head>
        <body>
            <seq>
                <media src="..\..\..\WINDOWS\Media\flourish.mid"/>
            </seq>
        </body>
    </smil>
    Put all media where I've highlighted, then run the file.

  17. #17

    Thread Starter
    PowerPoster
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,070

    Re: Open multiple MP3 files in Windows Media Player?

    I've been doing that, mentioned it in post 3 already, but haven't gotten it to work properly yet. The songs in the playlist are listed using some kind of relative path but I dunno relative to what... Also if I open existing playlists they all have some kind of GUID tag behind them which I've no clue what to do with... Perhaps I've made a silly error before but so far I didn't get it to play the playlist yet. I'll try some more tomorrow.

  18. #18
    Stack Overflow mod​erator
    Join Date
    May 2008
    Location
    British Columbia, Canada
    Posts
    2,824

    Re: Open multiple MP3 files in Windows Media Player?

    Don't use a relative path, then... the paths are relative to the location of wmplayer.exe (C:\Program Files\Windows Media Player (version)\wmplayer.exe) by the way. That file that I put up there has no GUID, and it's the contents of the file exactly, so you don't need the GUID I guess...

  19. #19

    Thread Starter
    PowerPoster
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,070

    Re: Open multiple MP3 files in Windows Media Player?

    Hm, the paths aren't relative to wmplayer.exe for me. The songs are on a completely different drive so they can't be. Oh well I suppose I can use the full paths then.

    What is the version number in the first 'meta name' tag? Does that mean anything? I can't try it right now, but the number is different in my playlists. Is it just the version of WMP, and should it match?

  20. #20
    Stack Overflow mod​erator
    Join Date
    May 2008
    Location
    British Columbia, Canada
    Posts
    2,824

    Re: Open multiple MP3 files in Windows Media Player?

    It doesn't matter - they're backwards-compatible. Just use a low version number.

  21. #21

    Thread Starter
    PowerPoster
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,070

    Re: Open multiple MP3 files in Windows Media Player?

    Thanks, I finally got it to work. If anybody stumbles across this and does now the 'regular' way to open multiple files (without creating a playlist): please tell me, because I would prefer that.

    Thanks for the help minitech. I'd rate you but I need to spread some love first.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width