AudioStreamIndex Property

Gets or sets the index of the audio stream that plays along with the video component. The collection of audio streams is composed at runtime, and represents all audio streams available within the media file.

XAML
<object AudioStreamIndex="integer" .../>
Scripting
value = object.AudioStreamIndex
object.AudioStreamIndex = value

Property Value

integer

The index within the media file of the audio component that plays along with the video component. The index can be unspecified, in which case the value is null.

This property is read/write. The default value is null; see Remarks.

Remarks

If no audio stream index is specifically set, the value of this property is null. A null value means that the media file uses the default audio stream.

If you have previously set AudioStreamIndex to an index value, you can set the value back to null. The behavior is that the initial default audio stream value is cached, and that audio stream will resume.

AudioStreamIndex and AudioStreamCount both specifically refer to a collection of only audio streams. This collection is composed locally at runtime. If you were to examine the actual media, the audio streams might be interleaved with nonaudio stream types, but these other streams will not be part of the collection.

This property can be set in XAML in order to indicate a preference. The value only becomes relevant after MediaOpened is raised.

Applies To

MediaElement

See Also

MediaOpened, Source (MediaElement), Media Overview, Supported Media Formats and Protocols