In this exercise you will learn how to use Lingo to control and play QuickTime video and sound files in your Director Movies.
Unquestionably, video is an essential part of many multimedia presentations. Director supports a variety of video formats, but the most versatile and useful overall is QuickTime. QuickTime is more that a video format; it is a system-wide media utility and API that allows dozens of audio, image, and video file formats to be displayed, edited, and converted for a multitude of purposes. Director is very QuickTime savvy and takes advantage of the most important QuickTime features so you can easily add video, QT audio, or QTVRs to your Director movies.
Controlling Video with Lingo
The easiest way to play a QuickTime movie in Director is to simply import a QuickTime file and drop it onto the stage. This will make it possible to play your movie, but you will have more playback options if you alter some of the properties of the QuickTime movie. You have the option, for example, to choose to show the standard QuickTime controller at the bottom of the movie, or you may simply have the movie play on its own without a controller. There are 7 properties you may click-alter through the Property Inspector "QuickTime" tab. Each one is described below.
Video - This turns on or off the video track(s) in your movie.
Audio - This turns on or off the audio track(s) in your movie.
Paused - Pauses the movie by default so it only plays when the user, or a Lingo command tells it to play.
DTS - This is the (Direct To Stage) property, and when checked, provides a way to bypass Director's pixel processing for the selected video sprite, which may speed up the rendering of the video to the stage. When DTS is active it essentially "cuts" through the stage image and draws without regard for sprites or ink effects. This may cause flicker if you draw sprites on top of video. Generally, you will need to check DTS only if your movie does not play smoothly. Even DTS may not be enough for a high-bandwidth movie, and the source file may need to be re-coded to work more efficiently within the bandwidth constraints of the medium.
Loop - Plays the movie over and over from beginning to end.
Controls - Displays the standard QuickTime Player movie controls.
Streaming - This allows a movie to be buffered into memory from a remote location so it may be played before all of it is loaded into memory.
Supported Video Formats
Adobe Director is one of the easiest multimedia authoring tools to use to control digital video. Prior to version 11.5, Director supported QuickTime, RealMedia, and AVI formats. More video playback features were added in Director 11.5, offering a great deal of flexibility and control of a variety of video assets.
As of Director 11.5 and newer, Director supports the following video formats:
- H.264-encoded MP4, F4V, and FLV
Lingo to Play Video
Some video formats have unique features that are accessible with specific Lingo methods and properties.
- Here is the official link from Adobe's web site to the methods and properties for QuickTime video files.
- Here is the official link from Adobe's web site to the methods and properties for H.264-encoded video files.
Playing QuickTime Video
There are primarily two Lingo properties you will need to control the playback of QuickTime in Director: movieRate and movieTime.
.movieRate is a property that specifies how the movie plays back.
- A movieRate of 1 plays a movie forward at normal speed.
- A movieRate of .5 plays a movie forward at half its normal speed.
- A movieRate of 0 stops a movie.
- A movieRate of 2 plays a movie double-speed forward.
- A movieRate of -1 plays a movie backward at standard speed.
- A movieRate of -2 plays a movie backward at double-time speed.
You may substitute other numbers for movieRate to get a variety of playback effects. You may also choose to import a sound-only QuickTime movie and play a song or soundtrack backward, or at a fast-forward speed, for a humorous effect. QuickTime movies that are sound-only have playback options that are unavailable using other sound playback Lingo.
.currentTime is a movie property that can be "set or get," meaning you can use it to tell a movie to play at a certain time within the timeline of a movie, or to monitor the elapsed or current playback time for a movie.
- Setting the currentTime of a movie to 0 effectively rewinds the movie instantly to the very beginning.
Using currentTime with the duration property makes it easy to compare the current play time of a movie with the overall duration (or length) of the movie. This is useful for showing the percentage of a movie that has played, or for keeping the Director playhead on a frame until a digital video is finished playing (see example below).
Playing H.264-encoded Video (Flash and MP4)
There are primarily two Lingo properties you will need to control the playback of H.264-encoded video in Director: playRate and seek().
.playRate is a property that specifies how the movie plays back.
- A playRate of 1 plays a movie forward at normal speed.
- A playRate of .5 plays a movie forward at half its normal speed.
- A playRate of 0 stops a movie.
- A playRate of 2 plays a movie double-speed forward.
Digital Video Lingo Examples
The following handler will play a QuickTime movie if the behavior is attached to a button. The movieRate property is used to play the movie forward at normal speed.
-- plays a QuickTime movie in channel 1
on mouseUp me
sprite(1).movieRate = 1
The following behavior stops a QuickTime movie.
-- stops a QuickTime movie
on mouseUp me
sprite(1).movieRate = 0
To rewind a QuickTime movie you set the movieTime property to zero. movieTime is measures in ticks, which are 60ths of a second. (Apparently, as of Director MX 2004, movieTime is deprecated and has been replaced with currentTime. The currentTime property is in milliseconds and it seems to be the best way to ensure future functionality.)
-- rewinds a QuickTime movie
on mouseUp me
sprite(1).currentTime = 0
This behavior gets the length of a movie in ticks (60ths of a second) and displays it in the Message Window:
-- returns the length of a movie in ticks
on mouseUp me
This behavior, when attached to a QuickTime video sprite , makes the playhead stay on a frame until the QuickTime movie is finished playing.
-- hold on current frame until QT movie is finished playing
on exitFrame me
-- convert time units to seconds for comparison
if sprite(me.spriteNum).currentTime/1000 < sprite(me.spriteNum).duration/60 then
-- stay on the current frame
-- go to next marker
To change the volume of a QuickTime movie use the volume property. The range for volume is 0-255, where 0 is mute, and 255 is maximum.
-- change the volume of a movie
on mouseUp me
-- set volume to half
sprite(1).volume = 128
Example Movies to Download:
Alpha Mask Example (4.4 MB)
Animated Movie Example (745 KB)
Play QuickTime MIDI Example (20 KB)
Play Wired QuickTime Content Example (420 KB)
QuickTime Video Logger (1.9 MB)
Using the example movies as a reference, create a Director movie that includes at least two QuickTime movies controlled by Lingo. Experiment with different Lingo commands and properties until you feel comfortable performing some basic manipulations on Director movies with linked QuickTime content.