Playback Methods and Properties

Windows Mobile 6.5
A version of this page is also available for

The Windows Media Player control supports several attributes for manipulating playback of content.

The Windows Media Player control provides two techniques for specifying the media title (clip) to be played:

After either technique is used, what happens next depends on the AutoStart property:

  • If AutoStart is true, the clip begins to play when the FileName property is set to the URL of that clip.
  • If AutoStart is false, playback does not start until the Play method is called.

The Open method opens a file asynchronously; it returns from the call immediately.

This is unlike setting the FileName property that does not return control to your program until the file is open. If the file must be downloaded, setting the FileName property will only wait until the file begins to download, not when it ends downloading.

The Windows Media Player control provides the following VCR-like attributes for controlling stream playback:

  • Play, Stop, and Pause methods, to start, stop, and pause the stream.
  • PlayCount property to set the number of times a file plays.
  • AutoRewind property to determine whether to return to the start of the clip when it stops playing.

The Windows Media Player control provides the following properties for regulating audio.

  • Balance property, for determining the balance of sound between left and right speakers.
  • Volume property, for raising or lowering volume.
  • Mute property, for turning audio on and off.

You can display the Volume and Mute controls on the control bar by setting the ShowControls and the ShowAudioControls properties both to TRUE.

The Windows Media Player control provides the following attributes for scanning:

  • FastForward method, to rapidly scan forward through a clip.
  • FastReverse method, to rapidly scan backward through a clip.
  • Rate property, to change the rate at which playback occurs. Only use the Rate property for media that support playback at multiple rates.

The CanScan and AllowScan properties must be true before a clip can be scanned.

Some types of multimedia streams support seeking to arbitrary times in the presentation, as well as seeking to markers.

A marker is a pointer to a specific time in a multimedia stream file, written into the file at authoring time. The Windows Media Player control can seek directly to the time specified by a marker, enabling viewers to skip forward or backward in the presentation.

Attributes supported for seeking include the following:

  • MarkerCount property, which specifies the total number of markers in the clip.
  • CurrentMarker, GetMarkerName, and GetMarkerTime methods, which retrieve marker information.
  • MarkerHit event, which provides notification when a marker is encountered.
  • CurrentPosition property, which can be used to set playback to a specified point in the clip. CurrentPosition is measured in seconds from the start of the clip.
  • PositionChange event, which notifies your application when the CurrentPosition property is set.

To seek to an arbitrary time, the media must be seekable (the CanSeek property is true).

To seek to a marker, the media must have markers encoded into it (the CanSeekToMarkers property is true).

Community Additions