I have been going through the Macromedia VideoSource project… http://www.macromedia.com/devnet/mx/flash/articles/video_player.html
The main thing that intrigues me about the project is that it can create FLV thumbnails on the fly using the VideoThumb.as file included in the project download. Unfortunately, the project was made to be used on Flash Communication Server, and I am using Progressive FLVs on my site. I have been trying to figure out how to convert the VideoThumb.as file to work with progressive FLV instead of streamed FLV.
I must say that I’m quite surprised no one has done this yet, as I think it would be a valuable contribution to the Flash FLV community.
Anyways, as far as the code in the VideoThumb.as file, the main part I don’t understand is this snippet…ok, so it’s a pretty big snippet:smirk:
// str is the suggested string to render from the tree (based on the node)
// node is the entire XMLNode for the row
// sel is the selected state (not usually used)
function setValue(str : String, item, sel)
{
_visible = item != undefined;
if ( !_visible )
return;
label.setValue( item.attributes.name );
// Thumbnail is picked up as the first frame of the playlist
var url = item.attributes.url;
var stream = item.attributes.thumb;
var start = item.attributes.thumbpos;
// If explicit thumb is not specified use the
// start frame of the first stream
if ( stream == undefined ) {
stream = item.childNodes[0].attributes.name;
start = item.childNodes[0].attributes.start;
}
// Give up if we still don't have valid thumb info
if ( stream == undefined )
return;
// Render the thumbnail only if necessary
if ( streamurl == url + "/" + stream )
return;
streamurl = url + "/" + stream;
//trace( streamurl );
nc = new NetConnection();
//nc.onStatus = function( info ) { trace( info.code ); }
nc.connect( url );
ns = new NetStream(nc);
ns.onStatus = function(info) {
if ( info.code == "NetStream.Play.Stop" ) {
nc = null;
ns = null;
}
}
thumb.video.attachVideo(ns);
ns.connect();
ns.play( stream, start, 0 );
}
I understand that most of the function is just grabbing the variables from the XML. And it seems to me that most of the code above would work for Progressive FLV, but I get lost at NetStream, ns.connect, and ns.play… I’m not sure how to convert them to Progressive.
I have attached the VideoThumb.as file and the entire project can be downloaded from http://www.macromedia.com/devnet/mx/flash/articles/video_player.html
If you don’t want to take the time to figure the whole thing out, do you at least know if the Netstream command could be converted to run with Progressive FLV, i.e.
ns = new NetStream(null);
or something along those lines? Thanks!:hugegrin: