Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>If you don't mind including <strong>Microsoft.VisualBasic.dll</strong> in your project, you can do it this way:</p> <pre><code>var audio = new Microsoft.VisualBasic.Devices.Audio(); audio.Play("some file path"); </code></pre> <p>If you want to do more complex stuff, the easiest way I know of is to use the <strong>Windows Media Player API</strong>. You add the DLL and then work with it. The API is kind of clunky, but it does work; I've used it to make my own music player wrapper around Windows Media Player for personal use. Here are some helpful links to get you started:</p> <p><a href="http://blogs.msdn.com/coding4fun/archive/2006/10/31/913360.aspx" rel="nofollow noreferrer">Building a Web Site with ASP .NET 2.0 to Navigate Your Music Library</a></p> <p><a href="http://msdn.microsoft.com/en-us/library/bb249259.aspx" rel="nofollow noreferrer">Windows Media Object Model</a></p> <p><a href="http://blogs.msdn.com/vbteam/archive/2007/10/30/let-the-music-play-matt-gertz.aspx" rel="nofollow noreferrer">Let the Music Play!</a></p> <p><strong>EDIT:</strong></p> <p>Since I wrote this, I've found an easier way, if you don't mind including WPF classes in your code. WPF (.NET 3.0 and forward) has a <a href="http://msdn.microsoft.com/en-us/library/system.windows.media.mediaplayer.aspx" rel="nofollow noreferrer">MediaPlayer</a> class that's a wrapper around Windows Media Player. This means you don't have to write your own wrapper, which is nice since, as I mentioned above, the WMP API is rather clunky and hard to use.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload