23 February 2011
You should have a basic knowledge of the Flash Professional user interface and a basic knowledge of working with FLA files. Certain features, such as H.264 codec support, are available only in Flash Player 9.0.115 and later.
One of the most important concepts to grasp when you're starting out is the way you deliver your video. By default, video delivered to Adobe Flash Player downloads progressively into the browser's cache, similar to the way images download when you view any website containing graphics. You can also stream video to Flash Player by adding a streaming server to the mix. Understanding these delivery method differences will save you some confusion along the way.
Flash CS5 Professional lets you deliver on-demand video in the following ways:
Live video requires streaming. For more information, see Detailed comparison of delivery options.
Since the introduction of Macromedia Flash MX and Flash Player 6, multimedia developers have been able to embed video within SWF files by importing video and placing it on the Timeline in the Flash authoring tool. When the SWF file is published, the video is fully contained in that file. This approach requires only a normal web server to deliver the video.
However, embedded video is recommended only when you want visitors who have Flash Player 5 or earlier to be able to view your video, or when you must have one single file that encapsulates the video and the content, or when your video clip is under five seconds long. In all other cases, embedded video is not recommended.
There are some benefits to using embedded video, such as the ability to see the individual video frames on the Flash Timeline and create overlays and interactions with the aid of the Flash design tools.
However, embedded video has some limitations:
Therefore, the embedded-video approach is recommended only in specific cases as described above; and even in those cases, you should use it only when you want to deploy very short clips of video, when the quality of that video is not very important, and when the video content is unlikely to change very often.
Flash Player 7 introduced a new technique called progressive download, which enables developers to use ActionScript commands to feed external video files into a SWF file and play them back at runtime. More specifically, you can use the netConnection and netStream objects in ActionScript to set the video file to play back, and to control the Play, Pause, Seek (to a timecode), and Close behaviors and the buffer time and size for a given video file.
In this method, the video content (FLV or MPEG-4 file) is kept external to the other content and the video playback controls. Because of this, it's relatively easy to add or change content without republishing the SWF file.
Flash Professional (starting with Flash MX Professional 2004) also includes video components that you can use to quickly add a full-featured video playback control to your Flash project. In Flash Professional CS5, the FLVPlayback component provides support for both progressive download and streaming video files as well as expanded support for dynamic streaming with the Flash Media Server. This component is easy to "skin" or customize, so that you can make your video player match your site design. See Skinning the ActionScript 3 FLVPlayback component for more details.
Flash Professional CS5 includes the new Code Snippets panel which contains basic ActionScript commands that can be applied to an FLVPlayback component instance without writing the code from scratch. The code snippets can be used with the ActionScript 3 video component.
Using external progressive video files has the following advantages over using embedded video:
Note: A video file will always download progressively when loaded directly from the server; it is delivered through an HTTP request just like a normal web page or any other downloadable document. Flash Media Server is required to have the option of streaming the file.
The most complete, consistent, and robust delivery option is to stream video and audio files from a server running Flash Media Server. In streaming, each client opens a persistent connection back to the video server, and there is a tight relationship between the video being delivered and the client interaction. This approach lets you deliver features such as bandwidth detection to serve up the right size video, quality of service metrics, detailed tracking and reporting statistics, and a whole range of interactive features along with the video experience.
As with progressive download, with this method the video content (FLV or MPEG-4 file) is kept external to the other content and the video playback controls. It is, therefore, relatively easy to add or change content without the need to republish the SWF file. Further, because there is a persistent connection between client and server when streaming, the video content can be changed based on feedback from the user or the application. For example, you can switch to a lower bit rate video if you notice quality-of-service degradation.
This approach also has other advantages, including the following:
Users who are not interested in buying and maintaining server hardware and Flash Media Server software can get all the benefits of streaming video and MP3 files with the Flash Video Streaming Service. This service is a load-balanced, redundant deployment of Flash Media Server, hosted by an Adobe-authorized Content Delivery Network partner.
Note: The Flash Media Development Server is a free edition of the steaming server that developers can use as a free resource for developing streaming video applications.
Included with the Flash Media Server family of products is Adobe Flash Media Live Encoder, which is capable of integrating with plug-and-play cameras and microphones to allow you to capture audio and video while streaming it to Flash Media Server. For more information on streaming video and broadcasting live video, see the Flash Media Server Developer Center.
Table 2 provides a comparison of the characteristics of web video delivery techniques. For more information about deploying video encoded in the H.264 format to Flash Player, read Exploring Flash Player support for high-definition H.264 video and AAC audio.
Table 2. Video delivery techniques in Flash
|Embedded video||Progressive download||Streaming delivery|
|Encoding||By default, the Video Import Wizard prompts you to launch the Adobe Media Encoder if needed to encode video using the On2 VP6 video codec for use with Flash Player 8 and later. Alternatively, FLV files (encoded elsewhere using On2 VP6 or Sorenson Spark codecs) can be imported and placed on the Timeline (re-encoding is not necessary). F4V and H.264 files cannot be embedded on the Timeline.||FLV files are encoded during export from various professional editing and encoding applications, through the Video Import Wizard in Flash Professional 8 and later, or the video files can be encoded with the stand-alone Adobe Media Encoder. Adobe Media Encoder can encode standard FLV video using the On2 VP6 codec or HD video using the H.264 video codec in F4V or H.264 format for Flash Player 9.0.115 or later.
Note: Adobe Media Encoder no longer supports encoding FLV video using the Sorenson Spark codec. However, FLV files previously encoded with Spark can be viewed in the Flash Player or imported into the Timeline.
Note: These options require Flash Professional 8 or later.
Flash CS3 Professional and later also support MPEG-4 formats encoded using the H.264 codec. This is a widely used format with many third-party encoding tools available.
|Same as progressive delivery. In addition, bandwidth detection capabilities in streaming enable you to detect client connection and feed the appropriately encoded video. You can capture live video feeds from client-side webcams or digital video (DV) cameras and control live encoding variables programmatically.|
|File size||SWF files contain video and audio streams and the user interface, resulting in a single, larger file size. SWF files can load each other, enabling you to break up individual video clips into multiple files.||SWF and FLV files are kept separate resulting in a smaller SWF file size.||Same as progressive download.|
|Timeline access||When embedded in the Timeline, video appears on individual keyframes and can be treated like any other object on the Stage. Ideal for creating interactions based on individual keyframes of video.||Video is played back only at runtime. Individual keyframes are not visible on the Timeline.||Same as progressive download.|
|Publishing||Each time the content is published or tested the entire video file is republished. Changes to video files require manually reimporting the files into the Timeline.||Video files are only referenced at runtime. Publishing does not require referencing the video file directly, and is much faster than the embedded video approach. Video files can be updated or modified without changing the SWF files for a project.||Same as progressive download. You can dynamically pull videos from virtual locations, such as your SAN or the Flash Video Streaming Service CDN.|
|Frame rate||Video frame rate and SWF frame rate must be the same.||The video file can have a different frame rate than the SWF file, allowing for separate timings between video and the other Flash content.||Same as progressive download. Live video capture has programmable control over frame rate.|
|ActionScript access||Video playback and control is achieved by controlling the SWF content's playback on the Timeline. Flash Professional CS5 provides several code snippets designed to control video, audio, and timeline playback in an ActionScript 3 file.||You can use the netStream object in ActionScript to Load, Play, Pause, and Seek through multiple external video files. You can also use the programming API of the FLVPlayback component to easily create a range of custom video features.||Same as progressive download. You can also use server-side ActionScript to provide additional functionality such as synchronization of streams, server-side playlists, smart delivery adjusted to client connection speed, and more.|
|Components||No video-specific components.||You can use media components (Flash MX Professional 2004 or later) or the FLVPlayback component (Flash Professional 8 or later) to set up and display external video files together with transport controls (Play, Pause, and Search).||You can use media components (Flash MX Professional 2004 or later) or the FLVPlayback component (Flash Professional 8 or later) with video streamed from Flash Media Server or Flash Video Streaming Service. Also, you can use Flash Media Server communication components for streaming live and multiway video. Note that many FVSS providers supply custom components as well.|
|Web delivery||The SWF file progressively downloads, unless you embed it in a movie clip. In that case, the entire video must be downloaded to the client and loaded into memory before it plays back.||Video files are progressively downloaded, cached, and then played from the local disk. The entire video clip need not fit in memory.||Video files are streamed from Flash Media Server, played on the client's machine, and then discarded from memory in a play-as-you-go method. The video is never cached.|
|Performance||Audio and video synchronization is limited after approximately 120 seconds of video. Total file duration is limited to available RAM on the playback system.||Improved performance over embedded SWF video, with bigger and longer video and reliable audio synchronization. Provides best image quality, which is limited only by the amount of available hard drive space on the playback system.||Provides the best performance from a web delivery perspective, with optimal bit rate delivery on an as-needed basis to as many customers as necessary. Image quality limited to bit rates that can be delivered in real time and performance can be improved using dynamic streaming classes.|
|Usage||Shorter video clips (less than 1 minute) that are smaller (less than 320 × 240), and have a lower frame rate (12 frames per second (fps)).||Longer video clips that are larger (720 × 480 and greater) and have a higher frame rate (up to 30 fps).||Large quantities of video, very long video clips, and live and multiway streaming (such as webcam chats and live event broadcasts).|
|Compatibility||Flash Player 6 and later (On2 VP6 codec requires Flash Player 8 or later.)||Flash Player 8 for On2 VP6 codec, Flash Player 9,0,115,0 or later for H.264.||Flash Player 6 and later. Flash Player 9,0,115,0 or later with Flash Media Server 3 (or later) for H.264.|
For more information on video delivery methods, please refer to Import video for streaming or progressive download in the Using Flash CS4 Professional online documentation. Also be sure to check out other sections in the Video Learning Guide for Flash.