I think this request approaches the problem in reverse.  Unless you know
exactly where the playhead of the FLV should be, then how do you request
a bitmap image of it?  Moreover, this is easier to capture on the client
side than to generate on the server side - however capturing it on the
client side doesn't seem to have any novel way of then storing that back
on the server for future reference.

For example, drag an instance of the FLV Playback component to the stage,
and name it "myPlayBack".  In the ActionScript on frame 1, import these
methods, and create a listener object:


        import mx.video.*;
        import flash.display.BitmapData;
        import flash.geom.Matrix;

        var listenerObject:Object = new Object();


Create a container for the "captured" frame of the FLV, and place it
somewhere on the stage, and reduce it to a thumbnail by scaling it to 25%,
like this:


        this.createEmptyMovieClip("holder_mc", this.getNextHighestDepth());

        holder_mc._xscale = 25;
        holder_mc._yscale = 25;
        holder_mc._x = 200;
        holder_mc._y = 200;


When metadata on the FLV is received, use a listener object to setup the
initial "captured" frame for the "holder_mc" image by setting its width
and height to match that of the FLV metadata:


listenerObject.metadataReceived = function(eventObject:Object):Void {
        myBitmap = new BitmapData(myPlayBack.preferredWidth,
                        myPlayBack.preferredHeight, true, 0x00FFFFFF);
        holder_mc.attachBitmap(myBitmap, 1);
};
myPlayBack.addEventListener("metadataReceived", listenerObject);


Next, by using another listener object to sense when the state of the FLV
playback changes - like seeking to a different playheadTime or pausing the
playback - then we can "capture" that frame of the FLV and draw it to
"myBitmap" which will reflect in the "holder_mc" instance:


listenerObject.stateChange = function(eventObject:Object):Void {
        myBitmap.draw(myPlayBack);
};
myPlayBack.addEventListener("stateChange", listenerObject);


Finally, load in the clip to "myPlayBack" by giving it a content path to
the FLV:


        myPlayBack.contentPath = "/mysite/myvideo.flv";


Now then, wouldn't it be interesting to be able to take the contents of
"holder_mc" - on demand - and save that entire object on the server as a
marker that includes which FLV and the playheadTime it was captured from?

Then it would be useful as a method for allowing people to see marker
points in otherwise long FLV files so that they can more quickly jump to
that point in the playback - using the captured "thumbnail" as a visual
reference.  These markers could be created by someone familiar with the
content - like a teacher who has produced a lecture that has several
important segments - or it could be used for a student to bookmark points
of interest or to mark their progress so they can return to it later.

When the student returns to the site later, their saved markers can be
loaded and displayed.  Or they can work from the standard ones that mark
important segments of the FLV.  Even allowing collaboration for groups to
share their marked points, along with notes or commentary attached to
them, would allow for some interesting possibilities.

Just some thoughts.  I don't know how to go about saving the "holder_mc"
object anywhere so that it is persistent and can be used again.  If anyone
does know how, it would be helpful to know.  I imagine it would involve
shared objects.  =)


Nathan



On Thu, 29 Jun 2006, Ronnie Brito wrote:

> "And another feature-request: Is it possible to request a jpg or another
> screenshot of the flv from the server? and force the browser to download
> the screenshot?"
> 
> this would be a very usefull function
> could be used on whiteboard applications too


_______________________________________________
Red5 mailing list
[email protected]
http://osflash.org/mailman/listinfo/red5_osflash.org

Reply via email to