Since the introduction of 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 lower to be able to view your video, or when you must have one single file that encapsulates the video and the Flash 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:
- If your video content changes, you must reopen Flash, re-embed the video, recheck and possibly rework any navigation and or associated content, and then republish the SWF file to make the change.
- During authoring, each time you want to preview or test part or all of your Flash content, you must publish the entire video file. This can add significant time to the authoring process.
- For web delivery, the entire video file must be downloaded from the web server before video playback can begin.
- At runtime, the entire video file must fit into the local memory of the playback system.
- After approximately 120 seconds of continuous video playback, users may experience audio synchronization problems.
- File length is limited to a maximum duration of no greater than 16,000 frames.
- The video frame rate and Flash Timeline frame rate must be the same (because they share the same time base).
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.
About external progressive download
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 Flash 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 CS3 Professional, the FLVPlayback component provides support for both progressive download and streaming video files. This component is easy to "skin" or customize, so that you can make your video player match your site design. See Dan Carr's article, Skinning the ActionScript 3.0 FLVPlayback component, for more details.
Flash CS3 Professional also includes a set of behaviors that can be used in conjunction with media components to create automated interactions between video sequences and slides in a project. Note that behaviors are available in Flash CS3 if your file is set to use ActionScript 2.0. (For details on using ActionScript 2.0 and video components, see the reference guide using the Flash Help panel. For more information on using video behaviors in Flash Professional 8 or with an ActionScript 2.0 file in Flash CS3 Professional, see Dan Carr's article, Controlling Flash video with the FLVPlayback behaviors.)
Using external progressive video files has the following advantages over using embedded video:
- During authoring, you need to publish only the SWF interface for previewing or testing part or all of your Flash content. This results in faster preview times and quicker turnaround on iterative experimentation.
- While using an ActionScript 2.0 file, the video begins playing as soon as the first segment has been downloaded and cached to the local disk.
- While using an ActionScript 3.0 file, the video begins playing only when enough of it has downloaded so that it can play the FLV file from start to finish. This behavior can be altered using ActionScript.
- At runtime, video files are loaded from the local disk into the SWF file, with no limitation on file size or duration. There are no audio synchronization issues or memory restrictions.
- The frame rate of the video file can be different from the frame rate of the SWF file, allowing for greater flexibility in setting up a project.
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.
About streaming video
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 Flash 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:
- The video starts playing sooner than it does using other approaches.
- Streaming uses less of the client's memory and disk space, because the clients don't need to download the entire file.
- It makes more efficient use of network resources, because only the parts of the video that are viewed are sent to the client.
- It provides more secure delivery of media, because media does not get saved to the client's cache when streamed. Flash Media Server also allows for encrypted streaming, providing an additional level of security.
- It provides better tracking, reporting, and logging ability—important features for industries such as video ad serving.
- It allows you to deliver and record live video and audio, or capture video from a client's webcam or digital video camera.
- It enables multiway and multiuser streaming for creating video chat, video messaging, and video conferencing applications.
- It provides programmatic control of streams (server scripting) for the creation of server-side playlists, synchronization of streams, smarter delivery adjusted to client connection speed, and application creation.
- It provides advanced monitoring and reporting on traffic and throughput.
Customers who do not want the difficulty and expense of 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. For more information, visit the Flash Video Streaming Service page on Adobe.com.
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,