- NSIS Discussion
- Play a video in NSIS Installer
Archive: Play a video in NSIS Installer
herdell
13th September 2010 14:08 UTC
Play a video in NSIS Installer
Hi, I've found a tool made in nsis that play a video in the main page. I'm very curious, cause I don't know any plugin able to do something like this.
Can anyone take a look in this program I post here how to this? I'll attach the file below.
EDIT: I uploaded in megaupload, cause I can't attach the files here.
The file contain a virus. I'll upload a clean file later. Sorry.
The name of the video using in this installer, is: "ý«€" just rename it and open in any video player. You can find it in PLUGINSDIR o extracting this installer.
I'm waiting fot answers, thanx...
Animaether
13th September 2010 14:23 UTC
You forgot to include the link. Not that it would help much, as 'decompiling' an installer is tough at best. Why not ask the authors of the installer in question?
If I wanted to do something like that - without programming something myself or poking at the System plugin - I'd probably check if http://nsis.sourceforge.net/NsWeb_plug-in would allow me to display a page that has the video as an embedded object.
herdell
13th September 2010 14:48 UTC
Originally posted by Animaether
You forgot to include the link. Not that it would help much, as 'decompiling' an installer is tough at best. Why not ask the authors of the installer in question?
If I wanted to do something like that - without programming something myself or poking at the System plugin - I'd probably check if http://nsis.sourceforge.net/NsWeb_plug-in would allow me to display a page that has the video as an embedded object.
I have no idea who made this installer, and my pc os with virus, so, I'll upload it later.
herdell
15th September 2010 01:17 UTC
Sorry for the double post, but here don't appear the 'Edit' button this time, so, I can't edit my posts. Here is the link clean of virus. Plese, check it out ,if you can.
http://www.megaupload.com/?d=2JHSCSC8
And this is the video used by the installer:
http://www.megaupload.com/?d=11A2TIVX
You can also find it in the $PLUGINSDIR folder when the installer is running.
If an admin edit my first post with this link, will be great. Thanx...
Animaether
15th September 2010 07:44 UTC
They're creating a SysAnimate32 control.. probably just through nsDialogs.
http://msdn.microsoft.com/en-us/libr...8VS.85%29.aspx
herdell
17th September 2010 23:41 UTC
Can you make me a nsis example file?
Animaether
18th September 2010 08:42 UTC
Originally posted by herdell
Can you make me a nsis example file?
"."
>!addplugindir "."
>!include "nsDialogs.nsh"
>!include "LogicLib.nsh"
>!include "WinCore.nsh"
>!include "WinMessages.nsh"
>OutFile "$%temp%\temp.exe"
>Section
SectionEnd
>!define ACS_CENTER 0x0001
>!define ACS_AUTOPLAY 0x0004
>!define /math ACM_OPENA ${WM_USER} + 100
>!define /math ACM_OPENW ${WM_USER} + 103
>!define ACM_OPEN ${ACM_OPENA} ; lets use the ANSI one.
!
define /math ACM_PLAY ${WM_USER} + 101
>!define /math ACM_STOP ${WM_USER} + 102
Page Custom customPage
>Var dialog
>Var hwnd
>Var null
>Var animationControl
>Function customPage
nsDialogs::Create 1018
Pop $dialog
${If} $dialog == error
Abort
${EndIf}
/* match dimentions to that of your AVI, otherwise it will center within control */
nsDialogs::CreateControl "SysAnimate32" ${ACS_CENTER}|${ACS_AUTOPLAY}|${WS_VISIBLE}|${WS_CHILD} "" 0 0 422 132 ''
Pop $animationControl
SetOutPath $PluginsDir
File "test.avi"
StrCpy $1 "$PluginsDir\test.avi"
StrLen $2 $1
System::Call '*(&t$2 "$1") i.r0'
SendMessage $animationControl ${ACM_OPEN} 0 $0
System::Free $0
${NSD_CreateButton} 0 150 64 32 "***91; ***93;"
Pop $hwnd
${NSD_OnClick} $hwnd animation.stop
${NSD_CreateButton} 72 150 64 32 "|>"
Pop $hwnd
${NSD_OnClick} $hwnd animation.play
${NSD_CreateButton} 144 150 64 32 "|> (x3)"
Pop $hwnd
${NSD_OnClick} $hwnd animation.play3
${NSD_CreateButton} 216 150 64 32 "oo"
Pop $hwnd
${NSD_OnClick} $hwnd animation.loop
${NSD_CreateButton} 288 150 64 32 "???"
Pop $hwnd
${NSD_OnClick} $hwnd animation.twitchy
InitPluginsDir
nsDialogs::Show
FunctionEnd
>Function animation.stop
Pop $null
SendMessage $animationControl${ACM_STOP} 0 0
FunctionEnd
>Function animation.play
Pop $null
${MAKELONG} $0 $1 0 -1
/* $0 = output variable
$1 = temporary variable used by ${MAKELONG}
$2 = start frame
$3 = end frame (-1 = end of video) */
SendMessage $animationControl ${ACM_PLAY} 1 $0
/* 1 = play once */
>FunctionEnd
>Function animation.play3
Pop $null
${MAKELONG} $0 $1 0 -1
SendMessage $animationControl${ACM_PLAY} 3 $0
/* 1 = play three times */
>FunctionEnd
>Function animation.loop
Pop $null
${MAKELONG} $0 $1 0 -1
SendMessage $animationControl${ACM_PLAY} -1 $0
/* 1 = play indefinitely */
>FunctionEnd
>Function animation.twitchy
Pop $null
StrCpy $R2 0
${NSD_CreateTimer} animation.twitchy.next 1000
FunctionEnd
>Function animation.twitchy.next
/* there's 86 frames in the animation */
${If} $R2 < 76
IntOp $R3 $R2+ 10
${MAKELONG} $0 $1 $R2 $R3
SendMessage $animationControl${ACM_PLAY} -1 $0
IntOp $R2 $R2+ 10
${Else}
${NSD_KillTimer} animation.twitchy.next
SendMessage $animationControl${ACM_STOP} 0 0
${EndIf}
>FunctionEnd
>
Note that the AVI should -not- have a sound stream in it, or supposedly the control will refuse to play the video. I'm not sure what restrictions there are on the video codec used, but the example installer used an 8bit RLE video which works... re-encoding that to MS-VIDEO1 (a common, albeit old, codec on the Windows platform) and trying with that didn't work. So you may have to find an authoring suite or converter tool that lets you encode to 8bit MS-RLE for your own videos.
herdell
20th September 2010 15:10 UTC
thanx dude, I'll try.
herdell
27th January 2011 22:45 UTC
I'm back here to another question:
How to show the video during the installation files in the system?
I want that just only during the installation files, the video plays in loop and the window of NSIS still hide, showing only the video, and after finish the installation of the files, the video stops to play, and the window of NSIS appear again in the finish page.
I know how to do this using images, but I've tried with videos using the script provided above by: Animaether, but I can't handle this, cause this is too complex to me.
Someone can help?
This is the video that I want to use in the script (if someone write one to me):
http://www.mediafire.com/?rl2kw12xv6fo6bk
Thanx...
stass
2nd November 2013 10:41 UTC
Code of Animaether why it does not work ... I can not play the files DivX, xVid...
The reason ?
Why there is no plug-in for video playback ?
Highcoder
2nd November 2013 16:34 UTC
AVI is a container for different video formats (codecs). His code work with 8-bit RLE AVIs that has NO audio stream. I think the code for DivX and xVid will be much more complex.
...Note that the AVI should -not- have a sound stream in it, or supposedly the control will refuse to play the video. I'm not sure what restrictions there are on the video codec used, but the example installer used an 8bit RLE video which works... re-encoding that to MS-VIDEO1 (a common, albeit old, codec on the Windows platform) and trying with that didn't work. So you may have to find an authoring suite or converter tool that lets you encode to 8bit MS-RLE for your own videos...
stass
3rd November 2013 11:56 UTC
8-bit RLE
This is not the format, and the misunderstanding ... It is a pity that no one has figured out how to play videos in NSIS ...
Highcoder
3rd November 2013 14:00 UTC
You´re right that this explanation was not 100% exact. Runlengthencoding is a simple kompression. An the first AVIs were compressed with MJPEG & RLE. Both of them have very low requirements on hardware. You can create those Videos with VirtualDUB i think...