Reproducción de archivos MP3 usando C #

I'm looking for a way for playing an MP3 file without any 3rd side playing it(Media Player, etc) Is there any way for doing it? Thank you.

preguntado el 10 de marzo de 12 a las 09:03

2 Respuestas

I have written an open source library called NAudio que puede hacer esto:

private IWavePlayer waveOut;
private Mp3FileReader mp3FileReader;

private void PlayMp3()
    this.waveOut = new WaveOut(); // or new WaveOutEvent() if you are not using WinForms/WPF
    this.mp3FileReader = new Mp3FileReader("myfile.mp3");
    this.waveOut.PlaybackStopped += OnPlaybackStopped;

private void OnPlaybackStopped(object sender, EventArgs e)

respondido 10 mar '12, 09:03

Thank you, I guess that was what I am looking for, the OnPlaybackStopped event is being fired when the song reaches its end? - envase

@idish, NAudio is nicely documented, and for your questions, simply play with it and you will see the answers out. - lex li

I am using NAudio to play mp3 files, it was playing fine but few moments before it stopped playing songs and there isn't any error being thrown. Here is my code - Jamshaid K.

I don't understand why you want to avoid 3rd party libraries. If you're coding in c# you're probably developing for windows, which normally has winmm.dll. So you can import and use mciSendString como en este ejemplo.

However, if you convert the MP3 data to raw data, you can play it using the .NET reproductor de sonido clase.

respondido 10 mar '12, 09:03

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.