IMFPMediaPlayer::SetPosition method (mfplay.h)

Important  Deprecated. This API may be removed from future releases of Windows. Applications should use the Media Session for playback.

Sets the playback position.


HRESULT SetPosition(
  REFGUID           guidPositionType,
  const PROPVARIANT *pvPositionValue



Unit of time for the playback position. The following value is defined.

Value Meaning
100-nanosecond units.

The value of pvPositionValue must be a LARGE_INTEGER.

  • Variant type (vt): VT_I8
  • Variant member: hVal


New playback position. The meaning and data type of this parameter are indicated by the guidPositionType parameter.

Return value

The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.

Return code Description
The method succeeded.
Invalid argument.
The value of pvPositionValue is not valid.
No media item has been queued.
The object's Shutdown method was called.


If you call this method while playback is stopped, the new position takes effect after playback resumes.

This method completes asynchronously. When the operation completes, the application's IMFPMediaPlayerCallback::OnMediaPlayerEvent callback method is invoked. The event type is MFP_EVENT_TYPE_POSITION_SET.

If playback was started before SetPosition is called, playback resumes at the new position. If playback was paused, the video is refreshed to display the current frame at the new position.

If you make two consecutive calls to SetPosition with guidPositionType equal to MFP_POSITIONTYPE_100NS, and the second call is made before the first call has completed, the second call supersedes the first. The status code for the superseded call is set to S_FALSE in the event data for that call. This behavior prevents excessive latency from repeated calls to SetPosition, as each call may force the media source to perform a relatively lengthy seek operation.


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


Using MFPlay for Audio/Video Playback