Inno Setup - video file with relative path as splash screen -
hello dear community...
i saw topic video splash screen inno setup
video file (with alpha) splash-screen?
the sample code presented tlama ( author of inno media player ) great has little problem & thats : splash video file pointed in code has absolute path : d:\video.avi if want publish setup program other computers absolute path d:\video.avi not work anymore...
therefore asking author ( tlama ) revise script , make video file splash relative path : {src} or {tmp} .
the second revision want ask author :
i want implement closing of video playback clicking client area of window...that not available in above sample code...
so asking tlama ( author of inno media player ) implement 2 asked revisions following code :
[setup] appname=media player project appversion=1.0 defaultdirname={pf}\media player project [files] source: "mediaplayer.dll"; flags: dontcopy [code] const ec_complete = $01; type tdirectshoweventproc = procedure(eventcode, param1, param2: integer); function dsplaymediafile: boolean; external 'dsplaymediafile@files:mediaplayer.dll stdcall'; function dsstopmediaplay: boolean; external 'dsstopmediaplay@files:mediaplayer.dll stdcall'; function dsinitializevideofile(filename: widestring; windowhandle: hwnd; var width, height: integer; callbackproc: tdirectshoweventproc): boolean; external 'dsinitializevideofile@files:mediaplayer.dll stdcall'; var videoform: tsetupform; procedure onmediaplayerevent(eventcode, param1, param2: integer); begin if eventcode = ec_complete videoform.close; end; procedure onvideoformshow(sender: tobject); begin dsplaymediafile; end; procedure onvideoformclose(sender: tobject; var action: tcloseaction); begin dsstopmediaplay; end; procedure initializewizard; var width: integer; height: integer; begin videoform := createcustomform; videoform.caption := 'popup video window'; videoform.borderstyle := bsnone; videoform.formstyle := fsstayontop; videoform.position := poscreencenter; videoform.onshow := @onvideoformshow; videoform.onclose := @onvideoformclose; if dsinitializevideofile('d:\video.avi', videoform.handle, width, height, @onmediaplayerevent) begin videoform.clientwidth := width; videoform.clientheight := height; videoform.showmodal; end; end; procedure deinitializesetup; begin dsstopmediaplay; end;
just swap 'd:\video.avi' expandconstant('{tmp}\video.avi'), prior call extracttemporaryfile.
or if want distribute video alongside setup (eg. on dvd) rather embedded it, use {src} instead of {tmp}, , skip extracttemporaryfile.
to second question. there missing message drain allow ivideowindow forward keyboard , mouse messages window owner. in updated version of library messages dispatched owner, download latest version , add code close video window clicking on it:
[code] procedure onvideoformclick(sender: tobject); begin // it's enough close form owns ivideowindow videoform.close; end; procedure initializewizard; begin videoform := createcustomform; ... videoform.onclick := @onvideoformclick; ... end;
Comments
Post a Comment