Skip to main content
Participating Frequently
May 27, 2009
Question

DVR w/ FLVPlayback 2.5.0.15 & Custom Publishing Client - Seek Bar Not Working [updated]

  • May 27, 2009
  • 1 reply
  • 1718 views

[ UPDATED to include code and modified language after I discovered that everything works when I use Live Encoder.... ]

Hello.

So I've got the DVRCast application installed, and I am successfully streaming live-DVR content to the updated FLVPlayback component.  I'm able to access the DVR-specific metadata (e.g. "currLen") without any trouble, and so forth.

When I record with the Flash Live Encoder, everything works correctly; the seek bar fills in as more content is published, and the playhead advances slowly across the filled-in section of the seek bar.

But when I do the publishing with a custom client instead of Flash Live Encoder, the seek bar doesn't work right.  Specifically, when I start viewing a stream which is still being broadcast live, the seek bar shows the length of the stream at the moment I started viewing it; however, the seek bar doesn't update correctly as new content continues to be appended to the end of the stream.  What happens instead is that the "playhead" (not sure of the proper terminology here) moves along the seek bar until it reaches the end, and then it just sits at the end -- and the seek bar itself starts expanding to the right, off the edge of the stage!

So I assume the problem here is that I need to add some code to the publishing client.  Here's the meat of the publishing code (from MyDVRPublish.as, which is the document class for MyDVRPublish.fla):

        public function MyDVRPublish()
        {
            nc = new NetConnection();
            nc.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
            nc.connect("rtmp://localhost/DVRCast");
            dvrFlag = true;
            isVideoReady = false;
            streamID = null;
            vid = new Video(640, 480);
            vid.x = 0;
            vid.y = 0;
            vidMonitor.addChild(vid);
            cam = Camera.getCamera();
            cam.setQuality(0,90);
            cam.setMode(640, 480, 30);
            vid.attachCamera(cam);
        }
       
        private function onNetStatus(event:NetStatusEvent):void{
            trace(event.info.code);
            if(event.info.code == "NetConnection.Connect.Success"){
                doRecording("mystream");
            }
        }    
       
        private function doRecording(sID:String) {
            isRecording = true;
            streamID = sID;
            publishCamera();
        }
       
        private function stopRecording() {
            ns.close();
            isRecording = false;
            trace("Finished recording " + streamID);
        }
       
        private function onAsyncError(event:AsyncErrorEvent):void{
                trace(event.text);
        }
                 
        private function publishCamera() {
            ns = new NetStream(nc);
            ns.client = new CustomClient();
            ns.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
            ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR, onAsyncError);
            ns.attachCamera(cam);
            trace("Publishing Stream...");
            ns.publish(streamID, "record");
        }

...What am I missing?

Thanks,

-dan

Message was edited by DanMITRE.

    This topic has been closed for replies.

    1 reply

    June 5, 2009

    Hi Dan,

    What you're seeing is by design: DVR in FLVPlayback is completely bound to the DVRCast specification. The publisher must call DVRSetStreamInfo and send the relevant DVR metadata and timestamps to the DVRCast app. The subscribing client (FLVPlayback 2.5) calls DVRGetStreamInfo to get the  DVR metadata from the server. The server gets some of that DVR metadata from the publishing client and some data is generated at the server.

    In Flash Media Live Encoder 3, when you select the DVR Auto Start option or click the Record button it submits the DVR metadata to the server so it knows to start publishing.

    If you don't use Flash Media Live Encoder you need to replicate it’s functionality in your publishing client.

    Jody

    DanMITREAuthor
    Participating Frequently
    June 5, 2009

    OK.  That's pretty much what I was expecting I might hear.  I have been looking through the DVRCast documentation, though, and am still very foggy on how to actually make a custom client replicate the FMLE's behavior in terms of setting metadata.  Does there exist a simple explanation of how to do this?  I see the DVRSetStreamInfo function, but while its features seem well documented, I don't see any clear description of how to use it practically.

    Thanks,

    -Dan

    June 5, 2009

    Hi Dan,

    Unfortunately, I don't know of a tutorial that builds a custom client that publishes to DVRCast, but Graeme Bull created a great video tutorial that should help:

    http://fmsguru.com/showtutorial.cfm?tutorialID=25

    Before Adobe published the DVRCast app, Graeme played around with FMLE3 and figured out what calls it was making to the server and built his own DVRCast app. I know this is the inverse of what you want to do, but watching him reverse engineer FMLE's calls to the server will show you how to make your own publishing client.

    Also, you check out the DVRCast code at rootinstall\applications\dvrcast_origin\scripts to see exactly what the DVRCast app expects the publishing client to call (and what it expects the subscribing client to call).

    Roughly:

    The DVRCast docs have a code example on page 11 that calls DVRSetStreamInfo. After the publisher calls DVRSetStreamInfo with the name of the DVR stream and calls NetStream.publish("streamname", "record"|"append"), the subscribing client calls DVRGetStreamInfo to get the name of the DVRStream. The subscribing client then passes the name of the DVRStream in a call to DVRSubscribe. Finally, the subscribing client calls NetStream.play("streamname", 0, -1) to play the stream.

    I'll get a tutorial up as soon as I can (unless someone beats me to it), but unfortunately I have to hit some deadlines today on other projects.

    HTH,

    Jody