This project is read-only.

Selecting audio streams

Topics: Windows 8 Xaml
Jan 17, 2013 at 4:58 AM


Our app is written using XAML/C# and the Player Framework.

For various reasons, the app offers an audio stream selection interface outside the video player page.  When the MediaPlayer object opens the media, I'd like to enumerate existing audio streams and select the one selected by the user.

E.g. an mp4 might offer a stereo AAC track and a multi-channel AC3 track.  Both are playable by MF, so both will show up in the AvailableAudioStreams property.

Unfortunately, the only information offered by the AudioStream class are name and language.  Not codec or stream index.  So there's no obvious way to correlate to the metadata we have (from pre-analysis) about the video.

Are the AudioStream instances sorted by index, by any chance?  That would at least give us a fighting chance of correlating.  Or is there some other way we should be doing this?


Jan 21, 2013 at 10:12 PM

Unfortunately, the MediaElement doesn't provide much info about the tracks available (just language and index).

However, you can count on the AvailableAudioStreams collection to be sorted by index.

Jan 29, 2013 at 12:27 AM

Relying on index order seems to work.

Thanks, Tim!