General discussion

Locked

Using Gifs or AVIs in Delphi 5

By mattreid ·
I would like to know how I could get an animated Gif or an AVI to display in Delphi.

I've gone through the help files with regard to AVIs but the example shown(using both the 'animate' and 'mediaplayer' objects) only works with the file you are told to open, every other one I've tried gives the error "cannot open AVI".

And as far as I know the Gif format is unrecognised in both the 'animate' and 'mediaplayer' objects.

Thanks

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

by atjjensen In reply to Using Gifs or AVIs in Del ...

hmm...well, lets start with AVI's. Here is a little snip of code from an application I have out. It works fine for me displaying multimedia files. Of course there are certain files that I cannot get to play in MS-MediaPlayer iself, and they won't play here either.

procedure TfrmQuestionEditor.sbtnOpenResourceClick(Sender: TObject);
begin
with OpenDialog1 do begin
FileName := '';
Filter := 'All (*.mpg, *.mpeg, *.avi, *.mp3, *.wav)|*.mpg;*.mpeg;*.avi;*.mp3;*.wav|' +
'Video (*.mpg, *.mpeg, *.avi)|*.mpg;*.mpeg;*.avi|' +
'Sound (*.mp3, *.wav)|*.mp3;*.wav';
if execute then begin
edresourceName.Text := Filename;
if cbxResourcePreview.Checked then begin
MediaPlayer1.FileName := Filename;
MediaPlayer1.Open;
MediaPlayer1.Display := pnlDisplay;
MediaPlayer1.DisplayRect := pnlDisplay.ClientRect;
MediaPlayer1.Play;
end; // if checked
end; // if execute;
end; // with
end;

I will go into GIF's in the next message.

Andrew

Collapse -

by atjjensen In reply to Using Gifs or AVIs in Del ...

OK, now for GIF's. You are correct Delphi 5, has no support for GIF file format in the VCL. This is due to some legal issues regarding Copyright at the time it shipped. However, there are any number of freeware, shareware and commercial components available that will give you this capability. I might recommend the following file:
TGif Image V2.2, which you can find at www.torry.net.

This will subclass your TImage component so that it will work with any type of gif image, transparent and animated.

As for opening a GIF file with MEdiaPlayer or TAnimate, neither of these components where intended for opeing GIF files. MediaPlayer should not need an explenation, while TAnimate is just a very trimmed down version of the MEdiaPlayer.

Andrew

Back to Web Development Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums