共用方式為


MFPlayer Sample

Note  This sample was removed in the Windows SDK for Windows 7. You can download the sample from MSDN Code Gallery.

 

Demonstrates some of the playback functions that are omitted from the BasicPlayback Sample, such as:

  • Seeking
  • Rate control (fast forward and rewind)
  • Audio volume and mute controls
  • Video zoom

This sample uses the Media Session for playback. The MFPlayer2 sample shows similar functionality using the IMFPMediaPlayer interface.

Before examining this sample, you might want to review the BasicPlayback Sample, which shows the basic steps required to play a media file by using Media Foundation.

APIs Demonstrated

This sample demonstrates the following Microsoft Media Foundation interfaces:

Usage

The MFPlayer sample builds a dialog-based Windows application.

To play a local media file, select Open File from the File menu. To specify a file by URL, select Open URL from the File menu. The dialog has the following controls:

  • Play/pause button
  • Rewind button
  • Fast-forward button
  • Volume slider
  • Mute button
  • Video zoom slider

When you open a file for playback, you can also specify a custom presenter or custom mixer for the Enhanced Video Renderer (EVR). In the Open File dialog, select the Custom EVR Presenter or Custom EVR Mixer checkbox. Then type the CLSID of the custom presenter or mixer in the edit field. The CLISD must be in canonical form (that is, the format returned by the StringFromGUID2 function).

Requirements

Product Version
Windows SDK Windows Server 2008
Microsoft Windows Windows Vista

 

Downloading the Sample

This sample is available in the following locations.

Location Path/URL
Windows SDK SDK Root\Samples\multimedia\mediafoundation\MFPlayer
MSDN Code Gallery Download from MSDN Code Gallery

 

Media Foundation SDK Samples

Audio/Video Playback