.NET Framework Developer Center > .NET Development Forums > .NET Base Class Library > C# code to auto detect and play audio files from the CDROM Drive with Media Player
Ask a questionAsk a question
 

AnswerC# code to auto detect and play audio files from the CDROM Drive with Media Player

  • Tuesday, November 03, 2009 4:02 PMonce3007 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hello All,

    I'm using Media Player in my C# code to play audio files. What I would like is the code that will allow 'Media Player to auto detect and play audio files from the CDROM Drive' without the need to specify the name of audio file like this: axWindowsMediaPlayer1.URL = drive:\wave.wma.

    I hope this is possible in C#.

Answers

All Replies

  • Tuesday, November 03, 2009 10:48 PMMr. Javaman Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I've never used the media player but have used System.IO.File classes.  Your program can access the drive and get a listing of all the files.  From that list your program can plug the media player at will.  I'm sure the media player has some type of queueing mechanism.  Just send the list of files over to the media player would be my guess.
    Javaman
  • Tuesday, November 03, 2009 10:53 PMMr. Javaman Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
  • Wednesday, November 04, 2009 2:20 PMonce3007 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thanks for the link.

    From the link I got the code below but I'm sure of how to use it, does any one have a sample code that will guide me.

    axWindowsMediaPlayer1.currentPlaylist = axWindowsMediaPlayer1.mediaCollection.getByName("mediafile");
  • Friday, November 06, 2009 1:48 PMonce3007 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    I have managed to find a way in C# code to auto detect and play audio files from the CDROM Drive with Media Player

    • Marked As Answer byonce3007 Friday, November 06, 2009 1:48 PM
    •