So, I'm working on an application that uses the DVR
functionality of FMS 3.5, and am stuck.
The publishing side of the system is working fine, and I can
get a very simple playback working as well (by connecting to the
FMS app, attaching a NetStream to my Video object, and calling
ns.play(streamID, 0, -1).
However, I need a rich UI to control the video playback. The
FLVPlayback component looks like it would fit the bill nicely, but
I can't get it to connect to my stream. I've tried hardcoding all
the parameters via the Component Inspector in Flash CS4 to play
back a specific stream I've recorded, and all I get is a
never-ending buffering bar.
What I really need to do is instantiate an FLVPlayback
component via AS3 and attach a NetStream to it. Or, at the very
least, connect it to a DVR-enabled stream and then script some
controls (e.g. jump-to-a-specific-offset).
Is there an easy-to-follow guide to doing this, or could
anyone give me the 2-minute rundown?
First off, you can't play DVR streams with FLVPlayback 2.5
without the DVRCast application -- and we haven't released it yet.
That should have been clearer in the docs and I'll get them
But you can play a NetStream -- have you checked out the API
docs for FLVPlayback 2.5 -- they install locally when you download
the component. The class you want to look at is FLVPlayback. Set
the NetConnection.connect() info in FLVPlayback.source and specify
the stream in FLVPlayback.play().
Aha, Got it. Setting the source and then calling play() with
no params worked like a charm. Actually, it appears to be playing a
DVR stream just fine... I set vidPlayer.isDVR = true;
vidPlayer.dvrFixedDuration = false; vidPlayer.dvrIncrement = 30;
vidPlayer.dvrIncrementVariance = 60; and then set the source and
called play(), and voila!
The only issue now is that the Seek bar doesn't update if I'm
viewing a stream that's still being recorded, so I wind up with the
seek bar only 'referring' to the video that had already been
recorded when I first started viewing the stream; for all
subsequent video the scrub head just sits at the end of the bar. Is
there a way to force the seek bar to update with the most recently
known video duration?
The seek bar will automatically update itself when you enable
DVR and play back from the DVRCast application. Also, the
dvrIncrement should always be larger than the dvrIncrementVariance.
The variance is the difference between what is playing and what is
the actual or estimated total duration of the stream. The increment
is how much gets tacked onto the current duration when the total
duration is unknown. Ideally, you would use larger numbers for this
too since they are in seconds. For short streams, (like half hour
or less) incrementing by 300 with a variance of 120 should be
fairly sufficient. The component also has it's own mechanisms for
estimating the duration of the stream without having to regularly
poll the server for that information.
There are also a number of fixes with regard to the behavior
of the seek bar in DVR coming with the next build of the