Freigeben über


MediaElement.AudioStreamIndex Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

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

Namespace:  System.Windows.Controls
Assembly:  System.Windows (in System.Windows.dll)

Syntax

'Declaration
Public Property AudioStreamIndex As Nullable(Of Integer)
public Nullable<int> AudioStreamIndex { get; set; }
<MediaElement AudioStreamIndex="int"/>

Property Value

Type: System.Nullable<Int32>
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. The default value is nulla null reference (Nothing in Visual Basic) (see the "Remarks" section).

Remarks

Dependency property identifier field: AudioStreamIndexProperty

If no audio stream index is specifically set, the value of this property is nulla null reference (Nothing in Visual Basic). A nulla null reference (Nothing in Visual Basic) 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 nulla null reference (Nothing in Visual Basic). 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 run time. If you were to examine the actual media, the audio streams might be interleaved with non-audio 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 becomes relevant only after the MediaOpened event has been raised.

Platform Notes

Silverlight for Windows Phone Silverlight for Windows Phone

 This property always returns zero in Silverlight for Windows Phone.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.