MediaPlayer + 7 files one after other

Can anybody provide some code - I have 7 avi files and at a certain stage I want to play them all one after the other with no breaks and no physically clicking on the play button. I don't want 7 mediaplayers, 7timers, 7 gauges etc.
I am displaying the on a panel.
Oh and I'm using D4 with update3.

Cheers
Chris
LVL 1
xpherAsked:
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.

xpherAuthor Commented:
Sorry should be I'm displaying AVI on a panel.

Chris
0
intheCommented:
Hi Chris,
here is some code i did for a test on another quetion a while ago also using the panel to display avi,not perfect but seems to work well enough using a stringlist to hold the filenames

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls,MPlayer, ExtCtrls;

type
  TForm1 = class(TForm)
    MediaPlayer1: TMediaPlayer;
    Label1: TLabel;
    Label2: TLabel;
    Button1: TButton;
    Panel1: TPanel;
    procedure Button1Click(Sender: TObject);
    procedure MediaPlayer1Notify(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
 sl:tstringlist;
 i:integer;
  implementation

{$R *.DFM}


procedure TForm1.FormCreate(Sender: TObject);
begin
sl:=tstringlist.create;
sl.Add('tape1.avi');
sl.Add('tape2.avi');
sl.Add('tape3.avi'); {or could = memo1.lines[0];}
sl.add('tape4.avi');{or could be loaded from opendialog.filenames}
sl.add('tape5.avi');
sl.add('tape6.avi');
sl.add('tape7.avi');
i:= sl.count;
label1.caption:='Now Playing';
label2.Caption:='';
button1.caption:='Play Movies';
end;

procedure TForm1.Button1Click(Sender: TObject);
  begin
 if i = 0 then
  begin
  mediaplayer1.close ;
  label2.caption:='Finished';
  i:=sl.count;
  end
 else begin
 dec(i);
 mediaplayer1.FileName:=sl.Strings[i];
 label2.caption:=mediaplayer1.filename;
 Mediaplayer1.Open;
 Mediaplayer1.Play;
 end;
end;

procedure TForm1.MediaPlayer1Notify(Sender: TObject);
begin
with MediaPlayer1 do
    if NotifyValue = nvSuccessful then begin
     stop;
    end;
   panel1.Repaint;
   button1.Click;

 end;

 end.


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
xpherAuthor Commented:
Thanks Barry, only thing I had to change was the order of adding to StringList. I had to add tape7.avi first down to tape1.avi otherwise the avi's were played in the reverse order.

Cheers
Chris :))
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

xpherAuthor Commented:
Barry
Decided to use .mpg files, (not a problem in itself), but I would like to call them from a res file. Do you know how to do this for same scenario as above??

If you can provide some help it would be appreciated, and I will obviously give points. (is 100 enougn?)

Cheers
Chris
0
intheCommented:
just a couple o questions
are you still using the tmediaplayer to play them ?then should be able to do pretty much the same as for avi.

how have you saved the mpgs in res file..rc_data ?
0
xpherAuthor Commented:
Still using TMediaPlayer.

Haven't saved in res file or rc_data cos not sure what to do with mpg not being one of standard for res file, also not sure for 7 files as above. I know how to use res files for bitmaps etc. so I'm not totally blind on idea, just amateurish (polite word for thick!)

Cheers
Chris ;)
0
intheCommented:
hehe about to go to bed but a quick comment :
i never ever seen anyone save mpg file in res (that why i asked "how have you saved the mpgs in res file.. rc_data ", im presuming rc_data wil do trick i'll be back in 6 hours or so to do some digging on the matter and test some ideas ,i trawled dejanews yesterday but didnt find a solution just plenty o questions which was a bit worrying ;-)
once they are in the res it should be ok from there to play etc but pretty definite youll need to extract them to disk first before playing ...
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.