Solved

Mediaplayer set time format.

Posted on 2001-06-20
5
651 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 100 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Suggested Courses
Course of the Month10 days, 11 hours left to enroll

628 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