Showcase and discover digital art at yex

Follow Design Stacks

Subscribe to our free newsletter to get all our latest tutorials and articles delivered directly to your inbox!

Using Mini FLV Files

Using Mini FLV Files

The down-and-dirty approach to grabbing thumbnails without any extra files is to attach the FLV file to a scaled-down video object, and pause the video on the first frame. This is an efficient approach for streaming video using Flash Communication Server, because only the video data needed for that frame is transferred. However, when using progressive download, the entire full-size video is loaded. If you have only very short videos, you may want to use this method. Below is the code you need to change in the file that is part of the ZIP file that accompanies this tutorial to use this method:

78 nc = new NetConnection();
79 nc.connect( null );
80 ns = new NetStream(nc);
81 ns.onStatus = function(info) {
80 if ( info.code == "NetStream.Play.Stop" ) {
81 nc = null;
82 ns = null;
83 }
84 }
86 streamurl );
88 ns.pause();

Here you create a new NetConnection object, and attach a new NetStream object to it. Note the NetConnection object is null for progressive video. The NetStream object is then attached to the object and the stream is set to play, then pause on frame 2, displaying a single frame for your thumbnail. Just remember, although this video pauses, it continues to load in the background, potentially slowing down your application’s performance.

A more robust solution is to load JPEG files instead. Next, I’ll outline some different ways to create them, and walk you through the code that adds them to your playlist.