skurt
New Member
Posts: 1
|
Post by skurt on Jan 25, 2005 23:42:42 GMT -5
Are there tutorials on making simple projects such as a video browser or a video presentation? I've been looking everywhere with no luck. Thanks in advance.
|
|
|
Post by Murariu Alexandru on Jan 26, 2005 10:20:14 GMT -5
To display Video in your project you need to use the TMCIObject:
Place a TMCIObject on the form, the use a script like this one: MCIObject1.FileName := RepConst('%SRCDIR%\avi\myfile.avi'); MCIObject1.Open; MCIObject1.Play;
However note that to play the video the target computer needs to have installed the appropriate codec(s).
See the "MCIObject Demo.apb" in the samples directory.
Because you cannot know for sure if a user has the required codec(s) installed, if your project uses video files, it is best to check. Bellow is a sample script that checks if the computer has or not the required codec(s), and if not how to install:
function CanPlayVideo(File : string) : boolean; var RM : string; RC : integer; begin if not FileExists(File) then begin result := True; exit; end; // check if file exists SendMCIString('open "'+FILE+'" alias MPEG',RM,RC); result := (RC = 0); //Any non-zero code means that the file cannot be played. if result then SendMCIString('close MPEG',RM,RC); end;
procedure Form1OnCreate(Sender: TObject); begin if not CanPlayVideo(RepConst('%SRCDIR%\avi\somemovie.avi')) then begin if MsgBox('To run this project you must install some stupid codec.%nInstall the codec?','Codec needed.',mb_iconquestion or mb_yesno)=idyes then begin FileExec(RepConst('%SRCDIR%\CODEC\stupidcodec.exe'),false,true); end else application.Terminate; end; end;
This answer helps you? What exactly do you have in mind?
|
|