NaturalDuration property
TOC
Collapse the table of content
Expand the table of content

MediaElement.NaturalDuration property

Gets the duration of the media file currently opened.

Syntax


Public ReadOnly Property NaturalDuration As Duration

Property value

Type: Duration

The natural duration of the media. The default value is a Duration structure that evaluates as Automatic, which is the value held if you query this property before MediaOpened.

Remarks

A Duration value has a TimeSpan component.

C# or Visual Basic:  You can use utility methods of System.TimeSpan to get the duration components in whatever format you want. For example you can get TimeSpan.Hours, TimeSpan.Minutes and TimeSpan.Seconds separately.

C++/CX:  The data value of a Duration is a property named TimeSpan. This has a TimeSpan structure value, and that structure has a field named Duration that reports the duration as an int64 that counts in 100-nanosecond units. TimeSpan doesn't have any methods for getting components of the time in hours:minutes:seconds format.

For more info, see Remarks in the Duration reference topic.

Requirements (Windows 10 device family)

Device family

Universal, introduced version 10.0.10240.0

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

Windows.UI.Xaml.Controls
Windows::UI::Xaml::Controls [C++]

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

Windows.UI.Xaml.Controls
Windows::UI::Xaml::Controls [C++]

Metadata

Windows.winmd

See also

MediaElement

 

 

Show:
© 2017 Microsoft