Web video is everywhere—news, sports, entertainment, e-commerce, corporate communications, education, blogs, and social networking are a just few examples. Thanks to sites like YouTube and Hulu, more and more people are going directly to the web for their daily dose of information, and they expect to be entertained.
In this lesson, you’ll learn how to do the following:
• Prepare video for the web
• Import video and sound
• Preview video and sound
• Add video to an application
• Control video playback
• Add sound effects
This lesson will take about 60 minutes to complete. Copy the Lesson08 folder into the lessons folder that you created on your hard drive for these projects (or create it now), if you haven’t already done so. As you work on this lesson, you won’t be preserving the start files; if you need to restore the start files, copy them from the Adobe Flash Catalyst CS5 Classroom in a Book CD.
Most web browsers have Adobe Flash Player installed, making it easier than ever to include Flash video files (FLV and F4V) in a web page. But before you can add video to your rich Internet applications, you must encode it for web delivery.
In Flash Catalyst, encoding involves converting your final edited video footage to a format compatible with Adobe Flash Player. Flash Catalyst supports FLV and F4V video files. FLV and F4V are container formats for Flash video. FLV files generally contain video data that is encoded using the On2 VP6 or Sorenson Spark codec and audio data encoded using an MP3 audio codec. F4V files generally contain video data that is encoded using an H.264 video codec and the AAC audio codec.
A codec is an encoding/decoding algorithm that controls how video files are compressed during encoding, and decompressed during playback.
• H.264 is an MPEG-4–based standard for web delivery. H.264 is recommended for a variety of devices, including high-definition (HD) video, 3GPP cell phones, video iPods, and PlayStation Portable (PSP) devices.
• On2 VP6 is the standard codec for encoding Flash video (FLV) files for Flash Player 8 and higher.
• Sorenson Spark is the required video compression format for Flash Player 6 and 7.
• MP3 is a standard file format on the Internet and on many portable digital audio players.
• Advanced Audio Coding (AAC) is a standardized encoding scheme for digital audio. Designed to be the successor to the MP3 format, AAC generally achieves better sound quality than MP3 at similar bit rates.
There are several applications that you can use to create FLV and F4V files, including Adobe Flash Professional CS5, Adobe Premiere Pro CS5, Adobe After Effects CS5, Adobe Media Encoder, and Sorenson Squeeze.
Each of these programs includes many presets, so most editors will not need to adjust any parameters when preparing their video for the web. You can simply select a format (FLV/F4V) and choose from a collection of presets, such as Web - Medium Quality for Flash 8 and higher. When you choose a preset, the video and audio codec and other settings are set automatically, including picture size, frame rate, bit rate, and so on. You can also begin with a preset, and then modify individual settings, if needed.
Whenever possible, encode a file from its uncompressed form. If you convert a file that has already been compressed using a different format, and then recompress that file into the FLV or F4V format, the previous encoder can introduce video noise.
To explain each format’s unique characteristics goes well beyond the scope of this course. For more information on preparing video for the web, visit the Adobe Developer Connection Video Technology Center online at www.adobe.com/devnet/video.
Adding motion video can turn an otherwise dull site into something engaging and memorable. The first step to adding video or sound to an application is importing the media files into your Flash Catalyst project.
Flash Catalyst supports video files with the .flv and .f4v filename extensions and audio files with the .mp3 filename extension.
When you import a single video file, a new Video Player object is created in the target layer and added to the artboard. The source video is stored in the project library. When you import more than one video file, or an audio file, the files are stored in the library until you decide to use them.
The Import dialog box opens.
The video and sound files you imported appear in the Library panel.
If your video and sound files have similar names, such as video1, video2, and so on, you can quickly identify them by previewing media in the Library panel. It’s a good idea to preview media files before adding them to the application.
A still image appears at the top of the Library panel. The image includes a Play button. If you play the video, Rewind and Pause buttons appear.
A Play button appears at the top of the Library panel. If you play the sound, Rewind and Pause buttons appear.
It sounds like a button click.
There are two ways to add video to the application.
• Import a single video file directly into the current state.
• Drag a video from the Library panel to the artboard in the current state.
When you add a video to the application, the source video is stored in the library and a Video Player object is added to the current state and appears in the Layers panel. The Video Player is a container used to hold and play the video.
The interactive banner application includes a custom component called Image Slider. The Image Slider component includes background images for each page. You are going to replace the background image for the Restaurants page with a short video clip.
The Image Slider component is named Image Slider in the Layers panel, but its component name in the library is CustomComponent1. When you open the Image Slider component in Edit-In-Place mode, the name CustomComponent1 appears in the Breadcrumbs bar.
Removing the still image leaves a gap in the Image Slider. You’ll fill the gap with the restaurants.flv video.
The video includes wireframe video controls below the video in the artboard. The video controls extend below the artboard, but that’s OK because you’re going to replace these with a custom control.
A Video Player object is added to the Layers panel in the Image Slider component.
As with other objects, a video player can exist in more than one state, and it can have a unique set of properties in each state where it exists. You modify Video Player properties in the Properties panel.
You can set the position, size, opacity, and rotation of the video. By default, the wireframe video controls are added below the video. To change which video appears in the controller, you can use the Source link in the Properties panel. This allows you to update the video without going through the steps to add, position, and set properties all over again. The properties apply to the Video Player, not the video file it contains.
The controls below the video player change from the blue wireframe controls to a standard set of black and white controls.
None sizes the video player but not the video picture. If you make the bounding box smaller than the video, the video is cropped.
Letterbox scales uniformly as large as possible without cropping the video. Black or white bars appear around the video if the video is a different aspect ratio than the video player bounding box.
Stretch matches the size of the video picture to the size of the video player window. This does not maintain its height to width ratio. The video is not cropped, but can appear distorted from the non-uniform scaling.
Zoom sizes and crops the video to match the size of the video player while maintaining the video’s height to width ratio.
In the Properties panel, you can set the video to begin playing automatically (Auto Play), loop repeatedly (Loop), or begin with its sound muted (Muted).
You can enter Accessible text, which is recognized by screen readers and other accessibility programs.
If the video includes sound, you can adjust its volume. You can also create a tooltip for the video player.
The text in the video controls change to the color you selected. You can also change the style, opacity, and size of the text.
This removes the video controls below the video player. You’re going to replace these with a custom play/pause button.
Now that you’ve hidden the default video controls, you need to give the user another way of playing and stopping the video in the Restaurants page.
You can use original artwork to create a custom video controller component. The controller can be as simple as a button used to play the video, or it can be a complex custom component that contains separate controls for things like play, pause, rewind, and so on.
Once you define the parts of your controller, you need to add interactions to control video playback. A control can be created from any component or group.
The interactive banner application includes a Play/Pause toggle button that was created earlier. We can use this button to control the video, but the button and the video need to exist together, either at the main application level, or together inside the same component. Right now, the video player containing the restaurants video is located inside the Image Slider component, so we need to add the Toggle Button to the Image Slider.
You are going to move the Toggle Button into the Image Slider component, but to do this it needs to be unlocked.
A message warns you that if you move the Toggle Button, you will lose any effects or interactions that are applied to it. This includes transitions and action sequences. If you want to use the Toggle Button component to control the video inside the Image Slider, you need to place the button inside the Image Slider component.
The Toggle Button is the top layer in the Image Slider component.
You could have deleted the Toggle Button in the main application layers, and then dragged a new instance of the Toggle Button from the Library panel into the Image Slider custom component. But dragging the button from the main application into the component is faster.
Both objects are selected in the artboard.
This component includes the Toggle Button and Video Player. With both objects inside the same component, you can use the Toggle Button to control the Video Player.
You can tell by the Layers panel that you’re editing a custom component (CustomComponent2) that is located inside another custom component (CustomComponent1), which is located in the Lesson08_Banner application.
Having two states makes it possible to change the appearance of the button while the video is playing.
When the video is playing (in the VideoPlaying state), the Toggle Button dims to 50% opacity.
The Toggle Button begins at 100% opacity in the VideoPaused state and fades out to 50% opacity in the VideoPlaying state, creating a smooth transition. You can preview this by clicking the Play Transition button in the Timeline.
With the Video Player and the Toggle Button together in the same component, the Toggle Button can now control the video.
• Play Video, Video Player – restaurants.flv, When In VideoPaused.
• Play Transition To State, VideoPlaying, When In VideoPaused.
• Pause Video, Video Player – restaurants.flv, When In VideoPlaying.
• Play Transition To State, VideoPaused, When In VideoPlaying.
The Toggle Button now includes four On Click interactions.
Notice that when the video finishes playing, the Toggle Button remains at 50% opacity and doesn’t toggle back to the play symbol. There are two problems. The Restaurants Video component is ending in the VideoPlaying state, and the Toggle Button stays selected (pause symbol). It should toggle back to its deselected Up state (play symbol). You’ll fix that next.
The Restaurants Video component is still in edit in Edit-In-Place mode.
To reset the video and Toggle Button after playing, you must do two things:
• Add an interaction that returns the Restaurants Video component to its VideoPaused state.
• Sync the Toggle Button so that its properties in each state match its natural on/off behavior, allowing it to toggle to the correct setting when returning to the VideoPaused state.
On Video Play Complete is the event that will trigger the interaction. This is the only option available because you have a video player selected. Play Transition To State is selected by default, and that’s what you want.
The Video Player will return to the VideoPaused state when the video is finished playing.
By default, the Toggle Button is not selected. This is perfect because the Toggle Button begins in the VideoPaused state and is not selected until someone clicks it.
The Toggle Button begins deselected with its Up state (play symbol) visible. When someone clicks the button, it changes to its Selected Up state (pause symbol).
When the video is playing (after the button is clicked), the button toggles to its Selected Up state but its properties are telling us that it’s not selected. This causes a conflict, and the button loses sync because the button property doesn’t reflect that it is selected while playing. To fix that, we need to change the button’s Selected property to match its Selected Up state when the video is playing.
Now when the video finishes playing, it automatically returns to the VideoPaused state and the button toggles to the play symbol.
Sound effects aren’t just fun. They improve usability by identifying buttons, menus, and other interactive objects.
You can add sound effects to components or groups by adding an action sequence interaction and then adding a Sound Effect to the action sequence in the Timelines panel.
The Top Btns layer includes the top five navigation buttons. You can add sound effects that play when someone clicks a button.
An empty On Button Roll Over action sequence is added to the Timelines panel.
The Select Asset dialog box opens. You can add a sound from the Media category in the library or import a new sound.
The Import dialog box opens to the Adobe Flash Catalyst CS5 sound effects directory.
The Flash Beep.mp3 file is added to the Media category in the library and is selected in the Select Asset dialog box.
The Flash Beep.mp3 sound effect is added to the action sequence.
The sound effect plays.
You can delay the start of the sound by dragging the Sound Effect bar in the Timeline, or by changing its Delay property in the Properties panel.
The duration of the sound effect is 1 second. If the sound was longer than 1 second, you would need to extend its duration to match the length of the audio file. You can do that in the Properties panel or by dragging its resize handle.
The sound plays immediately when the interaction occurs.
The Repeat property expands. You can enter the number of times you want the sound effect to repeat, or choose Forever if you want the sound effect to continue playing without stopping.
The sound effect plays the number of times entered in the Properties panel.
The top navigation button labeled 1 includes three interactions. The first is the On Click interaction that navigates to the Feature page (page 1). A second On Click action sequence plays the button_click.mp3 sound effect. The On Roll Over action sequence plays the Flash Beep.mp3 sound effect.
Notice that when you’re on page 1, the Top Btn 1 sound effects don’t play. That’s because the button is disabled in its target state.
1 How can you import a video file directly to the artboard for the current state in the application (without dragging it from the Library panel)?
2 How do you set a video to play continuously?
3 How can I set a video to begin playing automatically, without requiring someone to click a Play button?
4 By default, what is used to control the playback of video?
5 What rule applies when using a component to control video playback?
1 If you import one video at a time, the video is added to the current state. Importing multiple videos places them in the library only.
2 Select the video player and select Loop in the Properties panel to play a video continuously.
3 Select the video player and select Auto Play in the Properties panel to play a video automatically.
4 By default, the wireframe video controls are added below the video in the video player. In the video player Properties panel, you can change to the standard controls, or hide the controls by choosing None, and then create custom controls using other components.
5 The component and the video player must both be in the main application layers or together inside the same component. For example, a component in the main application layers cannot be used to control a video that is nested inside other components.
6 You can attach sound effects to components and groups.
7 To add a sound effect, select the component or group. Add an action sequence to the component or group. In the Timelines panel, open the Add Action menu and add a Sound Effect.