C#: WMP, time stamp in milliseconds / tenth of a second

Go To StackoverFlow.com

1

I'm using the WMP (AxWindowsMediaPlayer) in a C# project and would like to extract the exact time stamp up to 0.1 or 0.01 seconds. Is there any way how to accomplish that?

The following won't work as it's too imprecise :-/

player.Ctlcontrols.currentPositionString

I don't think that having a timer running simultaneously is a good solution because I would have to stop and resume it everytime the user pauses the video, and it will eventually become wrong after a few pauses and resumes.

2012-04-05 16:35
by Momro


1

Have you tried using the currentPosition property which returns a double in seconds from start instead of the currentPositionString which returns a string MM:ss format.

The string format will only give you precision to the closest integer value of the second. The currentPosition property which is a double should be giving you fractions of a second.

References

currentPositionString http://msdn.microsoft.com/en-us/library/windows/desktop/dd564739(v=vs.85).aspx

currentPosition http://msdn.microsoft.com/en-us/library/windows/desktop/dd564740(v=vs.85).aspx

2012-04-05 16:44
by Dan P
I feel a bit stupid now ;-) Thank you very much - Momro 2012-04-05 17:11
no worries...sometimes it just takes a second set of eye - Dan P 2012-04-05 17:14
Ads