I'm working with a XNA game and I want my program to load music files from libary/music so I can play that music in the game. It would be great if the mediaplayer class could play a playlist of all the music in library/music.
|
Generally, in order to play an MP3 in XNA it has to go through the Content Pipeline. If you want to learn how to do it, a quick search turned up this tutorial. Now, to your question: Single SongTo play an MP3, you need to pass an instance of a I have never used it before, and it may only work for the Silverlight framework on Windows Phone, but you can give it a try.If I had to guess, I would assume it would work like this. Keep in mind that the file will have to exist. If it doesn't you will get an error. If you are distributing this game, Use the Content Pipeline. It is much better.
I see there was a question on StackOverflow, and the answer looks like he is on a Windows PC. Maybe that will help get you there. PlaylistYou mention wanting a playlist, well MediaPlayer.Play can also take a SongCollection, and it will just loop through each song. |
|||||||||||
|
|
As a follow up on this other question you can load all the mp3s in a directory into a
You can look in the Music folder by setting directory to the following:
There's also a known bug where |
|||
|
|