How to Stream a MP3 file using C#

Posted on 2011-10-31
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 app
Question by:mousemat24
    LVL 6

    Expert Comment


    Not Tested but something like this should work...

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

    You can then use it as follows

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

    Accepted Solution

    Also here's an link to some usable code using NAudio an open source sound lib
    NAudio (open source)

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Join & Write a Comment

    Suggested Solutions

    Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
    Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
    This video discusses moving either the default database or any database to a new volume.
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    755 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

    Need Help in Real-Time?

    Connect with top rated Experts

    25 Experts available now in Live!

    Get 1:1 Help Now