Mega Code Archive

 
Categories / Delphi / VCL
 

Playing mpeg files in delphi apps

Question: How can I play an MPEG file in Delphi apps? Answer: Providing the Windows MMSystem layer has a MPEG decoder installed, you can easily use the MultiMedia play a MPEG file by setting the filename to the path of the MPEG file. Example: procedure TForm1.Button1Click(Sender: TObject); begin MediaPlayer1.Filename := 'C:\DownLoad\rsgrow.mpg'; MediaPlayer1.Open; MediaPlayer1.Display := Panel1; MediaPlayer1.DisplayRect := Panel1.ClientRect; MediaPlayer1.Play; end;