how to play mp3 files in windows mobile 6.1 ? RRS feed

  • Question

  • Hi,

       I am trying to play mp3 files in windows mobile 6.1 . I get the path of mp3 files through openfiledialog. Then I am trying to convert the selected mp3 files into bytes, but I am not getting how I can convert that. I tried to convert it but the code converts the path of file into bytes. 

        Can anyone tell me how I can convert the selected mp3 file into bytes and then stream in windows mobile 6.1 app : 

        following is the code that I wrote for my task


                    ofdSound = new OpenFileDialog();
                    this.ofdSound.Filter = "MP3 files|*.mp3";
                    if (ofdSound.ShowDialog() == DialogResult.OK)

                        if (File.Exists(ofdSound.FileName))
                            currentSoundTrack = ofdSound.FileName;

                            byte[] filenames = Encoding.Default.GetBytes(currentSoundTrack);

                            Stream stream = new MemoryStream(filenames);
                            SoundPlayer sndplayr = new SoundPlayer(stream);
                            sndplayr.Stream.Position = 0;
                            sndplayr.Stream = null;
                            sndplayr.Stream = stream;
                            sndplayr.Stream.Seek(0, SeekOrigin.Begin);
                            sndplayr.Stream.Write(filenames, 0, filenames.Length);

    Tuesday, July 29, 2014 10:05 AM