Playback Methods and Properties
The Windows Media Player control supports several attributes for manipulating playback of content.
Once either of the above steps is taken, what happens next depends on the AutoStart property. If AutoStart is true, the desired 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.
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.
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:
- 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 be able to seek to an arbitrary time, the media must be seekable (the CanSeek property is true), and to seek to a marker, the media must have markers encoded into it (the CanSeekToMarkers property is true).
Last updated on Wednesday, April 13, 2005
© 2005 Microsoft Corporation. All rights reserved.