Board index » delphi » Mp3 Track Length with TMediaPlayer

Mp3 Track Length with TMediaPlayer

Maybe you can find something here

http://www.dv.co.yu/mpgscript/download.htm

Quote
Ian Lamb wrote:

> Hi,

> I need to extract the length of an mp3 from it's header information using
> TMediaPlayer properties
> (e.g Position, Length etc..)

> But I have heard that this is a complicated procedure, due to the format an
> mp3 has..
> (i.e header & Frames)

> Can anybody point me in the right direction
> (Articles , source, components etc...)

> Thanks

--

This one was dead black, and in this, nothing moved.

 

Re:Mp3 Track Length with TMediaPlayer


Thanks for the tip Jellowe..

It works fine

Many Thanks
Ian..

Quote
"Jellowe" <j...@pirchworld.com> wrote in message

news:3DB1B38C.385414C3@pirchworld.com...
Quote
> Maybe you can find something here

> http://www.dv.co.yu/mpgscript/download.htm

> Ian Lamb wrote:

> > Hi,

> > I need to extract the length of an mp3 from it's header information
using
> > TMediaPlayer properties
> > (e.g Position, Length etc..)

> > But I have heard that this is a complicated procedure, due to the format
an
> > mp3 has..
> > (i.e header & Frames)

> > Can anybody point me in the right direction
> > (Articles , source, components etc...)

> > Thanks

> --

> This one was dead black, and in this, nothing moved.

Re:Mp3 Track Length with TMediaPlayer


TheTrackLength property contains the information you want.

Here is an example that displays the track time in an edit box.
The "%.2" notation in the format string is used to ensure that there
will be a leading zero on minutes and seconds.  Otherwise, a track
length of 03:06 might look like 3.6.  Only the leading zero on seconds
is important for this purpose.

Hope this helps.

dick

procedure TForm1.Button1Click(Sender: TObject);
Var
  Min,Sec : Integer;
begin
  MediaPlayer1.FileName := Edit1.Text;
  MediaPlayer1.Open;
  MediaPlayer1.TimeFormat := tfMilliseconds;
  Sec := MediaPlayer1.TrackLength[1] Div 1000;
  Min := Sec Div 60;
  Sec := Sec Mod 60;
  MediaPlayer1.Close;
  Edit2.Text := Format('Track Time = %.2d:%.2d',[Min,Sec]);
end;

On Sat, 19 Oct 2002 19:43:49 +0100, "Ian Lamb"

Quote
<shadow...@tiscali.co.uk> wrote:
>Hi,

>I need to extract the length of an mp3 from it's header information using
>TMediaPlayer properties
>(e.g Position, Length etc..)

>But I have heard that this is a complicated procedure, due to the format an
>mp3 has..
>(i.e header & Frames)

>Can anybody point me in the right direction
>(Articles , source, components etc...)

>Thanks

Other Threads