Solved

Mediaplayer set time format.

Posted on 2001-06-20
5
601 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
  • 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

744 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now