Click here to Skip to main content
15,885,979 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I searched on google and find code to play mp3 files, but the problems is when the files(.mp3) bit rate is more than 192kbps file not play.
My code is(which i found on google) :-

C#
[DllImport("winmm.dll")]
       private static extern long mciSendString(string lpstrCommand, StringBuilder lpstrReturnString, int uReturnLength, int hwndCallback);
       public bool open(string file)
       {
           if (!File.Exists(file))
               return false;
           string command = "open " + file + " type MPEGVideo alias MyMp3";
           mciSendString(command, null, 0, 0);

           return true;
       }

       public void play()
       {
           string command = "play MyMp3";
           mciSendString(command, null, 0, 0);
       }

       public void stop()
       {
           string command = "stop MyMp3";
           mciSendString(command, null, 0, 0);

           command = "close MyMp3";
           mciSendString(command, null, 0, 0);
       }


I need to play all bit rate file in my media player,
so how to play more than 192kbps bit rate files(mp3) in C#??
Posted

1 solution

Try put [STAThread] above the main method of your application, like this:
[STAThread]
static void Main(string[] args) {
...

Good luck!
 
Share this answer
 

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