Progress Loading/Playing AVI

How can I know and show the progress of loading and playing an AVI files from TMediaPlayer?
tribbyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

simonetCommented:
Only by using a TTimer.
0
tribbyAuthor Commented:
What tells me the progress..how much to go loading..playing..etc?
0
intheCommented:
roughly like:

procedure TForm1.FormCreate(Sender: TObject);
begin
mediaplayer1.display := panel1;
timer1.enabled:=false;
timer1.interval := 100;

end;

procedure TForm1.Button1Click(Sender: TObject);
begin
opendialog1.execute;
progressbar1.max := mediaplayer1.Length;
mediaplayer1.FileName:=opendialog1.filename;
mediaplayer1.play;
timer1.enabled:=true;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
progressbar1.position := mediaplayer1.position;
end;


can also use mediaplayer1.tracklenght etc..

Regards Barry
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

tribbyAuthor Commented:
Anyone know how to show the progress for the actual loading?
0
intheCommented:
from fmxutils.pas

function GetFileSize(const FileName: string): LongInt;
var
  SearchRec: TSearchRec;
begin
  if FindFirst(ExpandFileName(FileName), faAnyFile, SearchRec) = 0 then
    Result := SearchRec.Size
  else Result := -1;
end;


div the filesize by 100 for instance and use that with progress bar ..
otherwise you probably looking at a blockread type thing which is more complicated..
0
tribbyAuthor Commented:
Ok..but what returns how much of the AVI is loaded so far...that will just give me the total to load.
0
simonetCommented:
You can't know how much of the AVI file has been loaded because that's not handled by your application, but by Windows instead (the multimedia subsystem).

Like Barry said, you can write the loading procedure yourself (WAY TOO MUCH WORK). Unless you're willing to do that, forget about the ProgressBar.

Now, if you're willing to create the loading procedure, then you must forget about TMediaPlayer. You'll have to look for a solution that works with streaming or playing the AVI file from a memory block (windows can do that but only for Wave files).

Another option, but a dirty, ugly one, is to profile the HD's transfer rate, retrieve the file size and calculate how long it will take to load (considering the file is in contiguous blocks in the HD). Then you upgrade the progress bar according to how long it has taken, rather than how much has been loaded. Again, this is also a very hard-to-implement solution.

Alex
0
tribbyAuthor Commented:
That at leaast gave me 1/2 of what I wanted..thank you.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.