Contents Index Topic Contents | |
Previous Topic: Using the Windows Media Player Control Next Topic: Customizing the User Interface |
Playback Methods and Properties
The Microsoft® Windows Media™ Player control supports several attributes for manipulating playback of content. In addition to methods for playing, pausing, and stopping media content, the Windows Media Player exposes attributes for the following:
- Scanning, analogous to fast-forward and rewind functions on a VCR.
- Seeking, proceeding directly to a particular presentation time marked in the clip.
This article contains the following sections.
Playback
The Windows Media Player control provides two techniques for specifying the media title (clip) to be played. You can set the FileName property, or call the Open method. If the value of the AutoStart property is true, the desired clip begins to play when the FileName property is set to the URL of that clip. If AutoStart is false, the Windows Media Player control does not start playback until the Play method is called. The Open method starts the stream asynchronously, unlike the Play method, which waits for other processes to finish before starting.
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.
Audio Control
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 add controls for handling audio to the control bar by setting the ShowAudioControls property to true.
Scanning
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.
The CanScan and AllowScan properties must be true before a clip can be scanned.
Seeking
Some types of multimedia stream 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 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.
The CanSeek property must be true to seek to an arbitrary time, and the CanSeekToMarkers property must be true to seek to a marker.
Top of Page
© 1999 Microsoft and/or its suppliers. All rights reserved. Terms of Use.