Skip to main content
Participating Frequently
February 25, 2009
Answered

Scripting FLVPlayback 2.5 for DVR

  • February 25, 2009
  • 6 replies
  • 3061 views
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?

Many thanks!
-Dan
    This topic has been closed for replies.
    Correct answer
    Oh sorry about that, I didn't see the title.

    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 updated.

    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().

    Jody

    6 replies

    February 27, 2009
    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 FLVPlayback 2.5.
    DanMITREAuthor
    Participating Frequently
    March 9, 2009
    Any idea when the next build will be appearing?
    February 27, 2009
    Hi Dan,

    Could be a bug -- I passed this thread to an eng who'll probably be checking in later.

    Jody
    DanMITREAuthor
    Participating Frequently
    February 25, 2009
    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?

    d
    Correct answer
    February 25, 2009
    Oh sorry about that, I didn't see the title.

    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 updated.

    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().

    Jody
    DanMITREAuthor
    Participating Frequently
    February 25, 2009
    Yep, hence the title of my post, "scripting FLVPlayback 2.5" :) I've never used Flex, and want to do my UI design in Flash CS4, though, so the MXML file isn't of much help to me.

    Is there some way to attach a NetStream object to the FLVPlayback component? If so, that's what I'd ideally like to do.
    February 25, 2009
    Did you download the FLVPlayback 2.5 component? The 1.0 version doesn't support DVR playback. You can get v2.5 from http://www.adobe.com/go/fms_tools

    The download includes docs and a sample mxml file.

    HTH,
    Jody