Board index » delphi » playing sequential mpeg files

playing sequential mpeg files

I am writing a program to play some video mpegs but i have run into a
problem.
here is the code:
procedure TForm1.Button1Click(Sender: TObject);
begin
with form1.mediaplayer1 do
     begin
          wait:=true;
          filename:='c:\imagine\mpgproject\zebsoft.mpv';
          open;
          displayrect:=rect(0,0,480,360);
          play;
          filename:='c:\imagine\mpgproject\presents.mpv';
          open;
          displayrect:=rect(0,0,480,360);
          play;
     end;
end;
when i prees button1 the first mpg should play and then the second mpeg
should play.
but only the second one plays!!.i thought that setting wait:=true would
make the program
wait for the first one to finish playing.any help appreciated..steven
 

Re:playing sequential mpeg files


try this
procedure TForm1.Button1Click(Sender: TObject);
  begin
    with form1.mediaplayer1 do
      begin
           filename:='c:\imagine\mpgproject\zebsoft.mpv';
           open;
           displayrect:=rect(0,0,480,360);
           play;
      end;
 end;

procedure TForm1.MediaPlayer1Notify(Sender: TObject);
begin
  with MediaPlayer1 do
    if NotifyValue = nvSuccessful then
      begin
        filename:='c:\imagine\mpgproject\presents.mpv';
       open;
       displayrect:=rect(0,0,480,360);
       play;
     end;

This should work

L8tr
Daniel

Steven Smith heeft geschreven in bericht <3674A81B.7DAFF...@nw.com.au>...

Quote
>I am writing a program to play some video mpegs but i have run into a
>problem.
>here is the code:
>procedure TForm1.Button1Click(Sender: TObject);
>begin
>with form1.mediaplayer1 do
>     begin
>          wait:=true;
>          filename:='c:\imagine\mpgproject\zebsoft.mpv';
>          open;
>          displayrect:=rect(0,0,480,360);
>          play;
>          filename:='c:\imagine\mpgproject\presents.mpv';
>          open;
>          displayrect:=rect(0,0,480,360);
>          play;
>     end;
>end;
>when i prees button1 the first mpg should play and then the second mpeg
>should play.
>but only the second one plays!!.i thought that setting wait:=true would
>make the program
>wait for the first one to finish playing.any help appreciated..steven

Re:playing sequential mpeg files


yes ,this works for 2 files but i will be looking at playing more than
2.still it is a start
so i will persevere from this..thanks
Quote
Daniel Kraaij wrote:
> try this
> procedure TForm1.Button1Click(Sender: TObject);
>   begin
>     with form1.mediaplayer1 do
>       begin
>            filename:='c:\imagine\mpgproject\zebsoft.mpv';
>            open;
>            displayrect:=rect(0,0,480,360);
>            play;
>       end;
>  end;

> procedure TForm1.MediaPlayer1Notify(Sender: TObject);
> begin
>   with MediaPlayer1 do
>     if NotifyValue = nvSuccessful then
>       begin
>         filename:='c:\imagine\mpgproject\presents.mpv';
>        open;
>        displayrect:=rect(0,0,480,360);
>        play;
>      end;

> This should work

> L8tr
> Daniel

> Steven Smith heeft geschreven in bericht <3674A81B.7DAFF...@nw.com.au>...
> >I am writing a program to play some video mpegs but i have run into a
> >problem.
> >here is the code:
> >procedure TForm1.Button1Click(Sender: TObject);
> >begin
> >with form1.mediaplayer1 do
> >     begin
> >          wait:=true;
> >          filename:='c:\imagine\mpgproject\zebsoft.mpv';
> >          open;
> >          displayrect:=rect(0,0,480,360);
> >          play;
> >          filename:='c:\imagine\mpgproject\presents.mpv';
> >          open;
> >          displayrect:=rect(0,0,480,360);
> >          play;
> >     end;
> >end;
> >when i prees button1 the first mpg should play and then the second mpeg
> >should play.
> >but only the second one plays!!.i thought that setting wait:=true would
> >make the program
> >wait for the first one to finish playing.any help appreciated..steven

Other Threads