Adding Audio and Video to a Project
Audio Resources
bell.wav | applause.wav | audio.mp3
(Right-click on each and choose to "save link as...")
Video Resource
Lloyd's MOOC in 3 Minutes
Right-click this link to download video.
Introduction
Projects can be greatly enhanced by adding audio and video appropriately. During the workshop, Lloyd will demonstrate a few techniques.
Playing Simple .WAV Audio Files
If you want to add short sound effects to a project, the simplest way to do this is with the "Play" command. Note: The "play" command only works with .wav files, which are uncompressed audio files. If you have longer audio files, such as background music stored as .mp3 files, you will need to use the QuickTime Player technique shown below.
First, you have to choose to import the audio file using the"Import as Control..." option under the File menu.
on mouseUp
play "applause.wav"
end mouseUp
Playing Video with the QuickTime Player
In this example, you need to first add the QuickTime Player to a card, and give the player the name of "vid". Here is code to add to a button that will give the user to opportunity to choose a video:
on mouseUp
answer file "Choose a video file to play:"
if it is empty then
exit mouseUp
end if
set the fileName of player "vid" to it
end mouseUp
Playing Audio with the QuickTime Player
This example shows how to play a .mp3 audio file. You first need to add the QuickTime Player to a card. I named the player "audio" in the example. Then you navigate the player to an audio file stored on your computer.
To play the audio with script, add this code to a button:
on mouseUp
start player "audio"
end mouseUp
When you are sure it is working, then can then click on the QuickTime Player and choose to hide it by turning off "visible" in the basic properties of its property inspector.