How to play any media format using C#

.NET programming topics
Post Reply
User avatar
Enigma
Lieutenant
Lieutenant
Posts: 74
Joined: Sun Jan 16, 2011 12:40 am
Location: Colombo, Sri Lanka

How to play any media format using C#

Post by Enigma » Tue Feb 01, 2011 1:51 am

Hi
In .net most of the time you use SoundPlayer class to play media content. But what if you want to play a mp3 file or video file?? This code shows how to play any media format using C#. I’m using a library called “Quatrz.dll”. This is a very powerful library which is powered by Direct Show. You can find this library in C:\Windows\System32 directory. All you have to do is open up the VS and create a new project. In the solution explorer, right click on the Reference-> Add Reference -> Go to “Browse” tab and give the Quatrz.dll path. (in C:\Windows\System32\ Quatrz.dll ).

I have commented the code. Guys please note that I couldn’t test this thoroughly. So this may have bugs.

Hope this will help you :mrgreen:
scrnshot.jpg
scrnshot.jpg (135.3 KiB) Viewed 4322 times
soundtest.zip
(785.82 KiB) Downloaded 345 times
Enigma
User avatar
Saman
Lieutenant Colonel
Lieutenant Colonel
Posts: 828
Joined: Fri Jul 31, 2009 10:32 pm
Location: Mount Lavinia

Re: How to play any media format using C#

Post by Saman » Tue Feb 01, 2011 1:12 pm

Ohh.. This is awesome... Thanks Enigma!!!
User avatar
Nipuna
Moderator
Moderator
Posts: 2729
Joined: Mon Jan 04, 2010 8:02 pm
Location: Deraniyagala,SRI LANKA

Re: How to play any media format using C#

Post by Nipuna » Tue Feb 01, 2011 8:04 pm

Hey Man

You are Doing Great Work for Us :)

Keep it Up Buddy.
Post Reply

Return to “.NET Programming”