Get the Flash Player to see this player.
Flash Image Rotator Module by Joomlashack.
Fractal
Fractal
Fractal
Fractal
Fractal

Home Tutorials Adobe Director eBook
Lesson 12: Video Lingo E-mail

Goal

In this exercise you will learn how to use Lingo to control and play QuickTime video and sound files in your Director Movies.

Background:

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.

QuickTime Properties Panel

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.

Lingo to Play video

There are two Lingo properties you will need to control the playback of QuickTime in Director: movieRate and currentTime.

.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 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).

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
spacersprite(1).movieRate = 1
end

The following behavior stops a QuickTime movie.

-- stops a QuickTime movie
on mouseUp me
spacersprite(1).movieRate = 0
end

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
spacersprite(1).currentTime = 0
end

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
spacertrace(sprite(1).duration)
end

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
spacerspacer-- convert time units to seconds for comparison
spacerspacerif sprite(me.spriteNum).currentTime/1000 < sprite(me.spriteNum).duration/60 then
spacerspacerspacer-- stay on the current frame
spacerspacerspacer_movie.go(_movie.frame)
spacerspacerelse
spacerspacer-- go to next marker
spacerspacerspacer_movie.goNext()
spacerend if
end

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
spacer-- set volume to half
spacersprite(1).volume = 128
end

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)

Exercise:

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.

Table of Contents

Trackback(0)
Comments (0)Add Comment

Write comment

busy