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.
I have written an open source library called NAudio that can do this:
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.Init(mp3FileReader);
this.waveOut.Play();
this.waveOut.PlaybackStopped += OnPlaybackStopped;
}
private void OnPlaybackStopped(object sender, EventArgs e)
{
this.waveOut.Dispose();
this.mp3FileReader.Dispose();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With