Click here to Skip to main content
15,885,309 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am creating an app for windows mobile 6.1. I want to play mp3 songs through my app. I open the mp3 songs list through openFileDialog, and select a mp3 file. Then I convert the the file into stream and tries to play it with SoundPlayer. But I am geting the following error.

"The Wave header is corrupt."

I am using following code to convert the file into stream and playing the stream :

currentSoundTrack = ofdSound.FileName;
FileStream fileStream = File.OpenRead(currentSoundTrack);
byte[] fileBytes = new byte[fileStream.Length];
Stream fileStreamNew = new MemoryStream(fileBytes);
SoundPlayer sPlayer = new SoundPlayer(fileStreamNew);
sPlayer.Play();

An after sPlayer.Play() I am getting the above error. Please tell me what is the problem with this code? and how I can make it to work ?
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900