Monday, March 9, 2009

Media Player Play State in Delphi

Ever wondered or spent lots of time figuring out how to manipulate the Windows Media Player in Delphi. I mean TWindowsMediaPlayer (ActiveX control).

Today I had to retrieve the status of media being played in Media player to find out whether the media is paused or not. After hunting for almost 30 mins I found a way to read the same.

type
WMPPlayState = TOleEnum;
const
wmppsUndefined = $00000000;
wmppsStopped = $00000001;
wmppsPaused = $00000002;
wmppsPlaying = $00000003;
wmppsScanForward = $00000004;
wmppsScanReverse = $00000005;
wmppsBuffering = $00000006;
wmppsWaiting = $00000007;
wmppsMediaEnded = $00000008;
wmppsTransitioning = $00000009;
wmppsReady = $0000000A;
wmppsReconnecting = $0000000B;
wmppsLast = $0000000C;

WMPlayer.playState can be used to retrieve the same. The possible values are the ones mentioned above.

Until Next Time.

No comments:

Post a Comment