How to play an audio file during install

Windows Installer cannot play an audio file during the install process. However, in Advanced Installer this can be done by using the Play audio file predefined custom action. This custom action uses the AI_AUDIOFILE_PATH property which must be set to the full path of the audio file. This property can be set from the custom action's Audio File field.

Additionally, you can use the AI_AUDIOFILE_UI property to run the custom action before or after the Install Execution Stage.

Play an audio file during installation

In order to play an audio file during the install process you can follow these steps:

1. go to the Custom Actions page

2. under Wizard Dialogs Stage -> User Selection -> WelcomeDlg, add a Play audio file custom action

3. set its Action field to Play

4. select the "Finish" button on the ExitDialog

5. add a Set installer property value Published control event:

[AI_AUDIOFILE_UI]         Stop                      1

6. make sure that this control event is the first in the list

7. repeat the last two steps for FatalError and UserExit dialogs

Play an audio file when a button is pressed

ImportantThe following article uses options that are available starting with the Enterprise edition and project type.

You can also play an audio file when the user presses a button on a custom dialog:

1. go to the Custom Actions page

2. add a Play audio file custom action without sequence (do not modify its settings)

3. create a new "Set installer property" custom action with sequence before "Wizard Dialogs Stage" -> "Searches"

4. set the "Property" field to AI_AUDIOFILE_UI

5. set the "Value" field to Play (this will let the custom action know that the file will be played in the UI)

6. under Finish Dialogs Stage, create a new "Set installer property" custom action (it will make the installer stop playing the file right before "ExitDialog" is showed)

7. set the "Property" field to AI_AUDIOFILE_UI

8. set the "Value" field to Stop (the "Expression" field can be left empty)

9. in the Dialogs page select the button which will start playing the file

10. under the "Published Events" tab create a new Execute custom action control event which looks like this:

Execute custom action                  PlayAudioFile             AI_INSTALL

11. this control event will start playing the file, so you need to create control events which stops it

12. make sure this control event is the first in the list

13. select the "Finish" button on the ExitDialog

14. add a Set installer property value Published control event:

[AI_AUDIOFILE_UI]         Stop                      1

15. make that this control event is the first in the list

16. Repeat the last two steps for FatalError and UserExit dialogs

NoteThis custom action will not run if the installation does not use a full UI.

Some of the supported audio file formats are: .MP3, .WAV, .WMA and MIDI.

Warning!The file will not be played if its content does not match its extension (for example a .WMA file renamed to .MP3).