[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

MediaPlayer + 7 files one after other

Posted on 2000-01-16
7
Medium Priority
?
126 Views
Last Modified: 2010-04-06
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
0
Comment
Question by:xpher
  • 4
  • 3
7 Comments
 
LVL 1

Author Comment

by:xpher
ID: 2357417
Sorry should be I'm displaying AVI on a panel.

Chris
0
 
LVL 17

Accepted Solution

by:
inthe earned 600 total points
ID: 2357425
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
 
LVL 1

Author Comment

by:xpher
ID: 2357544
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
Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

 
LVL 1

Author Comment

by:xpher
ID: 2360316
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
 
LVL 17

Expert Comment

by:inthe
ID: 2360989
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
 
LVL 1

Author Comment

by:xpher
ID: 2361662
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
 
LVL 17

Expert Comment

by:inthe
ID: 2361783
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

Featured Post

Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Planning to migrate your EDB file(s) to a new or an existing Outlook PST file? This video will guide you how to convert EDB file(s) to PST. Besides this, it also describes, how one can easily search any item(s) from multiple folders or mailboxes…
There may be issues when you are trying to access Outlook or send & receive emails or due to Outlook crash which leads to corrupt or damaged PST file. To eliminate the corruption from your PST file, you need to repair the corrupt Outlook PST file. U…
Suggested Courses

612 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question