🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.multimedia
Article #117

Controlling Windows Media Player

#117
From: Kevin Saliga
Date: Thu, 21 Apr 2005 13:11
37 lines
3046 bytes
I've posted this once before, but am having lots of trouble finding answers
to this.  I see many places on the internet (when I Google search) of people
having the same issue, but no answers seem readily available.

I have imported the type library for the Windows Media Player (the older
version, not v9, but I believe the issue is in all versions).  This allows
me to control Windows Media Player via a component on my form, and one of
the things I do is control the rate of playback (slower/faster).  I use a
timer to get the CurrentPosition property and display it in mm:ss format on
a label of the form.

When I change the rate of playback to faster than normal, the
CurrentPosition reports a different value than the actual playback.  It
reports a value that is greater that the actual position of the recording.
The result is that my calc on my timer hits the end before the playback
does.  Has anyone had this experience or know why this is happening?

One prior suggestion was that my timer may not be reacting fast enough, but
since it triggers every second, that would mean at most my time would be a
second off.  But this can be 20 or 30 seconds or more - the problem is
exacerbated by the length of the audio file and the amount of time spent at
a faster playback rate.

My timer should at least get a reasonably close estimate - if it fires every
second, it should be within a second each time it fires.  But what is
happening is that the CurrentPosition is returning that it is at the end of
the file 20 to 30 seconds before the media component actually finishes
playback.  So it's not that the timer isn't keeping up - it's reporting that
it's further along in the file's playback than it actually is.  I watch the
time increment in a TLabel component that displays the CurrentPosition, and
the TTimer is incrementing the label with the CurrentPosition, but it's
populating the Caption with a time that's beyond the actual CurrentPosition
of the playback.

I appreciate any insight into this!

Kevin Saliga
Technical Details
Message-ID: <4267a67f@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!transit.nntp.hccnet.nl!transit1.nntp.hccnet.nl!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10d0fc,58a1690bed14f7fd,start
X-Google-Attributes: gid10d0fc,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Kevin Saliga" <ksaliga@emdat.com>
Newsgroups: borland.public.cppbuilder.multimedia
Subject: Controlling Windows Media Player
Date: Thu, 21 Apr 2005 08:11:28 -0500
Lines: 40
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2527
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 68.73.106.25
Message-ID: <4267a67f@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1114089087 68.73.106.25 (21 Apr 2005 06:11:27 -0800)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!transit.nntp.hccnet.nl!transit1.nntp.hccnet.nl!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail