Take the 2-minute tour ×

The WinRT API surface in Windows 8 seems to have the ability to load and save Playlists, and capture audio. What I'm looking for is somewhat simpler: does WinRT have the ability to play audio from a file? If not, what's the recommended API for native code (C++) to play audio from a file in a Windows 8 metro app?

share|improve this question

1 Answer 1

up vote 8 down vote accepted

If you're in a WWA, you want to use the HTML tag to play audio. In xaml, you want to use a MediaElement.

If you're using low level C++, you want to use the MediaFoundation APIs.

share|improve this answer
Thanks! I'm using C++. I found the documentation for MediaFoundation and I'm going to try that. If it works, I'll select this as the accepted answer. –  Zach Oct 11 '11 at 3:21
You may also want to look at the MediaElement, it may be easier to use. –  Larry Osterman Oct 11 '11 at 3:40
In this case I'm using C++/WinRT, but not XAML, in a DirectX-based metro app. –  Zach Apr 13 '12 at 18:39
Ah, then you're pretty much stuck with Media Foundation. –  Larry Osterman Apr 14 '12 at 17:09

Your Answer


