Thread: How do I play multiple mp3 files after another in C++ ?

  1. #1
    Registered User
    Join Date
    Jun 2017
    Posts
    9

    How do I play multiple mp3 files after another in C++ ?

    Hello there
    I want to play multiple mp3 files after another. I have tried with ShellExecute(); but its just playing one mp3 file with my default mp3 player. I want to play multiple mp3 files with my default player. How can I do this ? can we play a playlist of Windows media player with c++ ? any example code and explanation will help me a lot



    thanks in advance.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    38,706
    M3U - Wikipedia
    Create an M3U file containing the list of files you want to play, then point your media player at it using ShellExecute()
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Jun 2017
    Posts
    9
    Quote Originally Posted by Salem View Post
    M3U - Wikipedia
    Create an M3U file containing the list of files you want to play, then point your media player at it using ShellExecute()
    Thank you very much for the info....

  4. #4
    Registered User
    Join Date
    Jun 2017
    Posts
    2
    You can create a playlist and use that to play files sequentially. Here is sample code to do so:



    WMPLib.IWMPPlaylist playlist = player.playlistCollection.newPlaylist("NewPlaylist ");

    // Add files to playlist. You can make use of a loop to add multiple files
    WMPLib.IWMPMedia fileMedia = player.newMedia(filePath);
    playlist.appendItem(fileMedia);

    player.currentPlaylist = playlist;
    player.Ctlcontrols.play();

    Another approach will be to use PlayStateChanged event handler.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how to play play and stop wav files
    By cnu_sree in forum Linux Programming
    Replies: 4
    Last Post: 08-14-2006, 11:11 PM
  2. JetAudio won't play .dat files
    By LogicError in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 05-25-2005, 08:35 AM
  3. Play music files in C#
    By redintegra in forum C# Programming
    Replies: 1
    Last Post: 04-08-2005, 09:57 AM
  4. How to play Mpeg/AVI files
    By Unregistered in forum C++ Programming
    Replies: 2
    Last Post: 04-03-2002, 11:14 AM
  5. Play .wav files?
    By Hydro in forum C++ Programming
    Replies: 6
    Last Post: 02-24-2002, 02:40 PM

Tags for this Thread