Previous | Next |
The Seek method seeks to a position that is used as the starting point by the Play or Record methods.
Syntax
HRESULT Seek(
UINT fuMode,
int nOffset
);
Parameters
fuMode
[in] Mode for the seek operation being performed. The fuMode parameter must be one of the following modes.
Mode | Description |
WMDM_SEEK_BEGIN | Seek to a position that is nOffset units after the beginning of the file. |
WMDM_SEEK_CURRENT | Seek to a position that is nOffset units from the current position. |
WMDM_SEEK_END | Seek to a position that is nOffset units before the end of the file. |
nOffset
[in] Number of units of offset by which the seek operation moves the starting position away from the origin specified by fuMode. The units of nOffset are defined by the content. They can be milliseconds for music, pages for electronic books, and so on.
A positive value for nOffset indicates seeking forward through the file. A negative value indicates seeking backward through the file. Any combination of nOffset and fuMode that indicates seeking to a position before the beginning of the file or after the end of the file is invalid, and causes the method to return E_INVALIDARG.
Return Values
If the method succeeds, it returns S_OK. If it fails, it returns an HRESULT error code.
Return code | Description |
E_INVALIDARG | One or more parameters are invalid. |
WMDM_E_NOTSUPPORTED | Seek is not implemented on this device. |
E_FAIL | An unspecified error occurred. |
Remarks
The seek position is defined by passing either an IWMDMStorage interface pointing to a location on a storage medium of the device, or an IWMDMOperation interface that has been implemented to support streaming audio. The IMDSPObjectInfo interface can also be passed to describe some point within the object to which the specified interface points.
For device playback, if Seek is not called before Play, then playback starts at the first audio track on the first storage medium on the media device.
For device recording, if Seek is not called before Record, the record operation fails. Once the Record method is called, subsequent calls to the IMDSPObjectInfo::GetPlayPosition method report the total play length at any time, and equal the value returned from IMDSPObjectInfo::GetTotalLength. The recording length can be limited by calling the IMDSPObjectInfo::SetPlayLength method after returning from the Seek call.
See Also
Previous | Next |