13.08.2012 Views

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 25: Working with video<br />

Flash Player 9 and later, Adobe AIR 1.0 and later<br />

Flash video is one of the standout technologies on the Internet. However, the traditional pres<strong>en</strong>tation of video—in a<br />

rectangular scre<strong>en</strong> with a progress bar and control buttons underneath—is only one possible use of video. Through<br />

ActionScript, you have fine-tuned access to and control over video loading, pres<strong>en</strong>tation, and playback.<br />

Basics of video<br />

Flash Player 9 and later, Adobe AIR 1.0 and later<br />

One important capability of Adobe® Flash® Player and Adobe® AIR is the ability to display and manipulate video<br />

information with ActionScript in the same way that you can manipulate other visual cont<strong>en</strong>t such as images,<br />

animation, text, and so on. Wh<strong>en</strong> you create a Flash Video (FLV) file in Adobe Flash CS4 Professional, you have the<br />

option to select a skin that includes common playback controls. However, there is no reason you need to limit yourself<br />

to the options available. Using ActionScript, you have fine-tuned control over loading, displaying, and playback of<br />

video—meaning you could create your own video player skin, or use your video in any less traditional way that you<br />

want. Working with video in ActionScript involves working with a combination of several classes:<br />

Video class: The classic video cont<strong>en</strong>t box on the Stage is an instance of the Video class. The Video class is a display<br />

object, so it can be manipulated using the same techniques that can be applied to other display objects, such as<br />

positioning, applying transformations, applying filters and bl<strong>en</strong>ding modes, and so forth.<br />

StageVideo class: The Video class typically uses software decoding and r<strong>en</strong>dering. Wh<strong>en</strong> GPU hardware<br />

acceleration is available on a device, your application can take best advantage of hardware accelerated pres<strong>en</strong>tation<br />

by switching to the StageVideo class. The StageVideo API includes a set of ev<strong>en</strong>ts that tell your code wh<strong>en</strong> to switch<br />

betwe<strong>en</strong> StageVideo and Video objects. Stage video imposes some minor restrictions on video playback. If your<br />

application accepts those limitations, implem<strong>en</strong>t the StageVideo API. See “<strong>Guide</strong>lines and limitations” on page 513.<br />

NetStream class: Wh<strong>en</strong> you’re loading a video file to be controlled by ActionScript, a NetStream instance repres<strong>en</strong>ts<br />

the source of the video cont<strong>en</strong>t—in this case, a stream of video data. Using a NetStream instance also involves using<br />

a NetConnection object, which is the connection to the video file—like the tunnel that the video data is fed through.<br />

Camera class: Wh<strong>en</strong> you’re working with video data from a camera connected to the user’s computer, a Camera<br />

instance repres<strong>en</strong>ts the source of the video cont<strong>en</strong>t—the user’s camera and the video data it makes available.<br />

Wh<strong>en</strong> you’re loading external video, you can load the file from a standard web server for progressive download, or you<br />

can work with streaming video delivered by a specialized server such as Adobe’s Flash® Media Server.<br />

Important concepts and terms<br />

Cue point A marker that can be placed at a specific mom<strong>en</strong>t in time in a video file, for example to act like a bookmark<br />

for locating that point in time, or to provide additional data that is associated with that mom<strong>en</strong>t in time.<br />

Encoding The process of taking video data in one format and converting it to another video data format; for example,<br />

taking a high-resolution source video and converting it to a format that’s suitable for Internet delivery.<br />

Frame A single segm<strong>en</strong>t of video information; each frame is like a still image repres<strong>en</strong>ting a snapshot of a mom<strong>en</strong>t in<br />

time. By playing frames in sequ<strong>en</strong>ce at high speed, the illusion of motion is created.<br />

Last updated 6/6/2012<br />

474

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!