To play an AAC audio file in C#, you can use the MediaPlayer
class from the Windows Media Player COM API.
First, add a reference to the Interop.WMPLib
assembly in your project. You can find it under the COM tab in the Add Reference dialog.
Then, you can create an instance of the MediaPlayer
class and call its URL
property to load the AAC file, and its controls.play
method to start playback.
Here's some sample code to get you started:
main.cs212 chars12 lines
Make sure to replace "path/to/your/file.aac"
with the actual path to your AAC file. Also, keep in mind that this approach requires Windows Media Player to be installed on the system where your program is running.
gistlibby LogSnag