user34537
user34537

Reputation:

Play OGG, MP4 in .NET

I'd like to make a quick and dirty simple media player in .NET. I have no idea how I may play music, pause, etc. I want to support ogg, mp3 and if possible mp4.

How do I actually playback the sound? Min requirements: Play, pause/resume, stop supporting mp3 and ogg (vorbis)

Upvotes: 1

Views: 7564

Answers (3)

Eden
Eden

Reputation: 4206

For playing ogg file you can try oggsharp it is written in pure C# without any external dependencies.

For MP4 you should go with directshow

Upvotes: 0

MusiGenesis
MusiGenesis

Reputation: 75386

NAudio is an excellent open-source library for .Net that you can use to play MP3 files. NVorbis can be used to play .ogg files.

Upvotes: 1

Brad
Brad

Reputation: 163548

Since you need to support a variety of codecs, I recommend libVLC. It's what powers VLC, and can handle just about any codec and playback option you can imagine. There are a few .NET wrappers available:

You could also ditch the fancy wrapper, and call functions via straight-up imports. If you don't need all the abstraction, this may be the way to go.

See these related StackOverflow posts:

I recently had a project where I simply executed VLC in the background, receiving it's output via STDIO. For what I was going, this was easier, as my command to VLC was fire-and-forget.

Upvotes: 5

Related Questions