[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How to Stream a MP3 file using C#

Posted on 2011-10-31
2
Medium Priority
?
454 Views
Last Modified: 2012-05-12
Hi there

Does anyone have any code in C# that will stream a MP3 file based on a filelocation I give it?

also it must be a asp.net app
thanks
0
Comment
Question by:mousemat24
  • 2
2 Comments
 
LVL 6

Expert Comment

by:nbkbar7
ID: 37058266

Not Tested but something like this should work...

[DllImport("aygshell.dll", SetLastError = true)]
private static extern IntPtr SndPlaySync(string pszSoundFile, uint
dwFlags);

You can then use it as follows

SndPlaySync(@"\path\to\my\sound.mp3", 0);
0
 
LVL 6

Accepted Solution

by:
nbkbar7 earned 2000 total points
ID: 37058276
Also here's an link to some usable code using NAudio an open source sound lib

http://stackoverflow.com/questions/184683/play-audio-from-a-stream-using-c-sharp
NAudio (open source) http://naudio.codeplex.com/
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Integration Management Part 2
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question