Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with MediaPlayer

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
How is it possible to change the FileName at run-time, so that the video is changed by clicking a button?

I used this code, but the video in the Panel didn't change to the next videoclip.

procedure TsomeForm.NextClick(Sender: TObject);
var
videofile:string;
begin
{Prepare for video}
Videofile:= X;
If FileExists(Videofile)
then MediaPlayer1.filename:= Videofile;
end;


X is a proper file name e.g. C:\xyz\xyz.mpeg

Your help will be greatly appreciated.
 
Code:
  If FileExists(Videofile) then begin
    MediaPlayer1.Close;
    MediaPlayer1.filename:= Videofile;
    MediaPlayer1.Open;
  end;
It is the act of opening the file that makes the media player look at its filetype and figure out how to play it (playing a .wav is obviously different from playing an .mpeg), and actually refresh itself into an appropriate form. -- Doug Burbidge mailto:dougburbidge@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top