IMFPMediaPlayer::SetRate 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 rate.

Syntax

HRESULT SetRate(
  [in] float flRate
);

Parameters

[in] flRate

Playback rate. The playback rate is expressed as a ratio of the current rate to the normal rate. For example, 1.0 indicates normal playback speed, 0.5 indicates half speed, and 2.0 indicates twice speed. Positive values indicate forward playback, and negative values indicate reverse playback.

Return value

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

Return code Description
S_OK
The method succeeded.
MF_E_OUT_OF_RANGE
The flRate parameter is zero.
MF_E_SHUTDOWN
The object's Shutdown method was called.

Remarks

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

The method sets the nearest supported rate, which will depend on the underlying media source. For example, if flRate is 50 and the source's maximum rate is 8× normal rate, the method will set the rate to 8.0. The actual rate is indicated in the event data for the MFP_EVENT_TYPE_RATE_SET event.

To find the range of supported rates, call IMFPMediaPlayer::GetSupportedRates.

This method does not support playback rates of zero, although Media Foundation defines a meaning for zero rates in some other contexts.

The new rate applies only to the current media item. Setting a new media item resets the playback rate to 1.0.

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

IMFPMediaPlayer

Using MFPlay for Audio/Video Playback