?
Solved

Mediaplayer set time format.

Posted on 2001-06-20
5
Medium Priority
?
668 Views
Last Modified: 2010-04-06
I use this mediaplayer and try and set the time into normal minutes : seconds format but the results look really odd... like 153:940. Plus I was curious how I can make this refresh to show the time count down not just display the length one time.

type
  MSFRec = record
    Minutes: byte;
    Seconds: byte;
    Frames: byte;
    NotUsed: byte;
  end;

procedure TfrmMain.Song;
var
  TheLength: LongInt;
begin
MediaPlayer1.TimeFormat := tfMSF;
TheLength := MediaPlayer1.Length;
with MSFRec(TheLength) do
begin
  len := IntToStr(Minutes); {Display Minutes }
  len := len + ':' + IntToStr(Seconds); {Display Seconds}
end;
lblLen.Caption := len;
0
Comment
Question by:Dsys
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 1

Accepted Solution

by:
Dennis9 earned 400 total points
ID: 6210505
Hi.
This should do the job (I hope):

//Add this function
function MilliSecondsToString(MilliSeconds: integer): string;
var i1, i2: integer;
begin
i1:=(MilliSeconds div 1000) div 60; i2:=(MilliSeconds div 1000)-(i1*60);
Result:=FormatFloat('00',i1)+':'+FormatFloat('00',i2);
end;

//Put in a Label and a timer, in the ontimer add this
Label1.caption := (MilliSecondsToString(MediaPlayer1.Length)+' - '+(MilliSecondsToString(MediaPlayer1.Position)));

//Remember to enable the timer when the Medieplayer knows what file to play


Dennis

0
 
LVL 17

Expert Comment

by:geobul
ID: 6210761
Hi,
The problem obviously is that tfMilliseconds format is supported by your device and the others are not.

Regards, Geo
0
 

Author Comment

by:Dsys
ID: 6212649
This did not work. The data is still showing up in an odd format. 234:240 and so forth...

I do not know what will work to make it show real minutes and real seconds?

geobul what do you propose?
0
 

Author Comment

by:Dsys
ID: 6212666
Oh wait a second here I was too quick to judge. Your idea might work and I did something wrong... let me try something else.
0
 

Author Comment

by:Dsys
ID: 6212672
ok so your idea was great and I had goofed up. Sorry. Thanks for the help.

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question