IMFPMediaPlayer::GetDuration method (mfplay.h)
Gets the playback duration of the current media item.
Syntax
HRESULT GetDuration(
[in] REFGUID guidPositionType,
[out] PROPVARIANT *pvDurationValue
);
Parameters
[in] guidPositionType
Specifies the unit of time for the duration. The following value is defined.
Value | Meaning |
---|---|
|
100-nanosecond units.
The value returned in pvDurationValue is a ULARGE_INTEGER.
|
[out] pvDurationValue
Pointer to a PROPVARIANT that receives the duration.
Return value
This method can return one of these values.
Return code | Description |
---|---|
|
The method succeeded. |
|
The media source does not have a duration. This error can occur with a live source, such as a video camera. |
|
There is no current media item. |
Remarks
This method calculates the playback duration, taking into account the start and stop times for the media item. To set the start and stop times, call IMFPMediaItem::SetStartStopPosition on the media item. To get the actual duration of the underlying media file, regardless of start and stop times, call IMFPMediaItem::GetDuration.
For example, suppose that you load a 30-second audio file and set the start time equal to 2 seconds and stop time equal to 10 seconds. The IMFPMediaItem::GetDuration method will return 30 seconds, but the IMFPMediaPlayer::GetDuration method will return 8 seconds.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 7 [desktop apps only] |
Minimum supported server | Windows Server 2008 R2 [desktop apps only] |
Target Platform | Windows |
Header | mfplay.h |
See also
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for