tribby
asked on
Progress Loading/Playing AVI
How can I know and show the progress of loading and playing an AVI files from TMediaPlayer?
Only by using a TTimer.
ASKER
What tells me the progress..how much to go loading..playing..etc?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Anyone know how to show the progress for the actual loading?
from fmxutils.pas
function GetFileSize(const FileName: string): LongInt;
var
SearchRec: TSearchRec;
begin
if FindFirst(ExpandFileName(F ileName), 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..
function GetFileSize(const FileName: string): LongInt;
var
SearchRec: TSearchRec;
begin
if FindFirst(ExpandFileName(F
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..
ASKER
Ok..but what returns how much of the AVI is loaded so far...that will just give me the total to load.
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
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
ASKER
That at leaast gave me 1/2 of what I wanted..thank you.