Skip navigation
Adll___
Currently Being Moderated

DVR with fms3 , how to make it work?

Apr 30, 2009 4:17 AM

Hi

 

I am trying to look for documentation on how the DVR functionality is working in fms3. It seems that I need to implement som server-side scripting to make DVR even work. In Flash Live Encoder there is an option to Record DVR, but it when I press the button, all I get is:

 

Thu Apr 30 2009 13:15:38 : Start DVR command received

Thu Apr 30 2009 13:15:38 : Requested DVR command has been successfully issued to Primary FMS server for stream ob1stream

Thu Apr 30 2009 13:15:38 : Primary - Network Status: NetConnection.Call.Failed error Method not found (DVRSetStreamInfo).

Does anyone know how to make this work?
Best Regards Niclas
 
Replies
  • Currently Being Moderated
    May 2, 2009 9:16 AM   in reply to Adll___

    Looking at your question, it seems there are two issues: -

    1. You are using FMS 3, and for DVR you need FMS 3.5

    2. You need to have DVRCast application on server side or your own custom application which have neccessary handlers namely DVRSetStreamInfo and DVRGetStreamInfo defined.  (DVRCast is still in pre-release and hopefully would be released soon, if you access to Adobe pre-release you can download DVRCast application from there)

     

    Now if you want to just see DVR functionality is working, you do following steps:

    1. Install FMS 3.5. (You can use Development Server if you just want give it a try or simply buy FMIS 3.5, its worth it )

    2. Create an application named "mydvr_app" with main.asc having following simple code:

     

    application.onConnect = function(myClient){

     

         return true;

    }

     

    application.onPublish = function(myClient,myStream){

     

         myStream.record( );

     

    }

     

    application.onUnpublish = function(myClient,myStream){

     

         myStream.record(false);

    }

     

    3. Download FLVPlayback 2.5 from http://www.adobe.com/products/flashmediaserver/tool_downloads/. Read the documentation in it how to use it. Create a simple client using FLVPlayback 2.5.

     

    4. Open any publisher client or simply use FMLE which you have, connect to "mydvr_app" on your FMS 3.5 and publish stream by name "mydvr_stream", if you are using FMLE 3.0 , just click on Start to publish (dont use DVR Record as it expects certain handlers to be defined on your server-side application as i mentioned earlier)

     

    5. Open client created using FLVPlayback 2.5, give source as "rtmp://<server-ip>/mydvr_app/mydvr_stream.flv". Compile the client and run it.

     

    Once you do all above steps, you will DVR in action

     

    I will try to write more in detail later with respect how you can define your own server-side application if you want to use "DVR Record" of FMLE 3.0

     

    Hope it answers your question. Please do post if something is remaining unanswered or if you wan to know more details.

     
    |
    Mark as:
  • Currently Being Moderated
    May 4, 2009 12:30 AM   in reply to Adll___

    Hrmmm.....the simplest way is to just have a button that seeks to different time periods while its recording live......and play from there....you dont need server side scripts or all that other mess....

    learn about it here....

     

    http://www.adobe.com/devnet/flashmediaserver/articles/live_dvr_pt1_05. html

     

    just go thru and read that

    then again...thats with FMS 3.5....lol read it anyway

     
    |
    Mark as:
  • Currently Being Moderated
    May 4, 2009 8:39 AM   in reply to SE_0208

    Hmmm, I tried your walk-through,  SE, but alas, no go.   I can see that a .flv file is being created in the default directory on the Flash Media Server, but no video can be seen in the FLVPlayback component 2.5 .

     

    The code snippet you provided for the main.asc file... is that all that needs to be in that file, or should it be pasted in among a bunch of other pre-existing main.asc code?

     
    |
    Mark as:
  • Currently Being Moderated
    May 4, 2009 8:55 AM   in reply to mrwizzer2

    well....i'm sort of a control freak...lol so i dont use the flvplayback component...its a hassel after alot of custom coding....i prefer to make it work like i want from what i code so i just use the video object and create my own buttons......

    now doing it that way...being that i've done it before.....all i had to do was create a button that seeks to s previous time in the recording.....

    lets say you want to go back 10 seconds in time while viewing a live stream you would have a button that basically does this

     

      ns.seek( ns.time - history ); //history would be a variable that represents the 10 secs or whatever time

    that would be the simplest way....just have a file recording and in the client swf....create a seek button tha
    performs the above operation on click...like

    seek_button.addEventListener(MouseEvent.CLICK, doSeek);

    public function doSeek(event:MouseEvent):void
    {
        
    ns.seek( ns.time - 10 );

    }

    you dont have to touch the main.asc code or anything like that......

     
    |
    Mark as:
  • Currently Being Moderated
    May 4, 2009 9:13 AM   in reply to ghost31379

    Turning my attention to your original post, Ghost...

     

    I walked through the tutorial you indicated on Understanding Live DVR, but, as usual, couldn't get it to work.  Even using the tutorials "Completed" versions that should theoretically be pristine, I'm getting a "NC STATUS: NetConnection.Connect.Failed" error.

     

    One thing that grabs my attention... there's no mention of a main.asc file anywhere, and since we created the directory from scratch, there therefore is no main.asc file in that directory, (which I assumed there always needs to be, no?)

     

    Do I need to copy and paste another main.asc from some other directory?

     
    |
    Mark as:
  • Currently Being Moderated
    May 4, 2009 9:40 AM   in reply to mrwizzer2

    well ....let me start from the beginning......you dont need to touch main.asc or even have one at all.....as for as the recorder goes....you just need it recording to a file on server....not sure about pressing all those buttons in Flash Media Encoder just make sure the stream is being recorded to file and thats it for the recording side of the equation.....i couldnt find the simple file i created a while back to give you an example but either way.....

     

    the viewing side/client swf......you need it to connect to the same netstream string that you use in the recording swf or flash Media Encoder....if you using the flashMediaEncoder its the part that says "save to file" connect to that same folder and play that file in your player....and create the seek button and click......it will go back 10 secs......to return to current time....you would make another button that seeks to a ridiculously high number that doesnt exist so it goes to the most current time......

     

    the error you gave leads me to believe you're not connecting to the right folder.....like you connecting to a folder that doesnt exist.....

    if you want to....or if you connecting to a folder that you created in the application folder then it should be something like this

     

    application/video/streams/myvids

     

    thats the folder structure......but when you connect....you would connect

     

    rtmp://localhost/video/myvids

     

    then the play function would play

     

    stream.play("yourvideo");

     

    ps....you dont use the "streams" folder in your connection string when connecting but it must be there to work correctly

     
    |
    Mark as:
  • Currently Being Moderated
    May 4, 2009 9:48 AM   in reply to ghost31379

    Thanks for the speedy reply, Ghost. 

     

    Ok, my first question is this...

     

    You indicate I should be trying to attach to the directory that is selected in Flash Media Live Encoder's "Save to File" field.  Which is currently saving a file to my local hard drive.

     

    Should it instead be saving a file to the Flash Media Server?  Otherwise, how would anyone connect to a file that resides on my computer and not a server?

     
    |
    Mark as:
  • Currently Being Moderated
    May 4, 2009 9:59 AM   in reply to mrwizzer2

    well i dont know where you server is located.....so i was just using an example as if your server was on your local computer....if its not then you should be connecting to the servers location......i usually write mine like so

     

    rtmp://ipaddress/video/myvids

     

    using the actuall IP address to the server where i put "ipaddress" .....the player and the encoder should be connecting to the same folder and playing the same file......and if you're using flashMediaEncoder..... the "FMSUrl" has to be changed to the address of the server like i wrote above....

     
    |
    Mark as:
  • Currently Being Moderated
    May 4, 2009 10:10 AM   in reply to ghost31379

    Bare with me, let's back up a step...

     

    When you say

    "...if you using the flashMediaEncoder its the part that says "save to file" connect to that same folder and play that file in your player"

     

    I'm assuming you're meaning the field I've indicated with a red circle,  correct?

    Attachments:
     
    |
    Mark as:
  • Currently Being Moderated
    May 4, 2009 10:23 AM   in reply to mrwizzer2

    ...because my first impression was that I should have the player connecting to the file created/specififed in the fields above it, (in my screenshot example: rtmp://flash.scoe.net/dvr/myDVR )

     

    But that's not the case?  I should instead have the player connect to the file created in the "Save to File" field?  (In my case: "sample.flv")

     

     
    |
    Mark as:
  • Currently Being Moderated
    May 4, 2009 10:46 AM   in reply to mrwizzer2

    ok.....can that what i said about the FlashMediaLive Encoder.....this is why i customize and create my own stuff......for some odd reason the save function on there points to a local drive on your/my computer.....that is lame!.....and that dvr junk at the bottom isnt working either.....this is why i dont use it...because its a hassle to learn how someone else's program that you wont care to use eventually....its too many extra steps...lol like i said...i have control issues

     

    you will do better to just create your own encoder.....and publishing from there.....then follow the steps like i outlined....

    there is an example on how to create your own publisher.....in the flash media server documentation....i suggest use that....and set it to record so you know where the file is going.....i try to post something on process maybe later if you still need help.....but right now i'm under the gun at work ....

     

    so i gotta get back to coding...

     
    |
    Mark as:
  • Currently Being Moderated
    May 4, 2009 12:57 PM   in reply to Adll___

    ok i'm back for a second......so uhhh....class is in session here is a basic example of a video encoder

    use this to stream your video while recording.....what makes it record?and not live? this line here:

      ns.publish("thefilename", "record");

     

    the second parameter.....to make it stream live without recording it to file you change it to "live"....the first parameter is what you name your file...

    after this you use your client player to connect to the same connection as outlined.....and to play the same file ..ie   stream.play("thefilename");

     

    package
    {
        import flash.display.*;
        import flash.media.*;
        import flash.net.*;
        import flash.events.*;
       
       
       
        public class SimpleEncoder extends Sprite
        {
            var nc:NetConnection;
            var ns:NetStream;
            var mic:Microphone;
            var video:Video = new Video();
            var camera:Camera;
           
            public function SimpleEncoder():void
            {
                NetConnection.defaultObjectEncoding = 0;
                nc = new NetConnection;
                nc.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
                nc.connect("rtmp://localhost/video/myvids");
               
            }
           
            private function publishLiveStream():void
            {
                ns = new NetStream(nc);
                ns.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
                ns.client = this;
                camera = Camera.getCamera();
                mic = Microphone.getMicrophone();
               
                if (camera != null){
                    camera.addEventListener(ActivityEvent.ACTIVITY, activityHandler);
                    video = new Video();
                    video.attachCamera(camera);
                    ns.attachCamera(camera);
                }
                if (mic != null) {
                    mic.addEventListener(ActivityEvent.ACTIVITY, activityHandler);
                    ns.attachAudio(mic);
                }
                if (camera != null || mic != null)
                {
                // start publishing
                // triggers NetStream.Publish.Start
                // "thefilename" is the name of the file you use after you connect to stream in client player   stream.play("thefilename");
                ns.publish("thefilename", "record");
                }
                else
                {
                    trace("Please check your camera and microphone");
                }
                addChild(video);
            }

     

           
            public function onBWDone():void
            {
               
            }
           
            private function netStatusHandler(event:NetStatusEvent):void
            {
                trace(event.info.code);
                switch (event.info.code)
                {
                    case "NetStream.Buffer.Full":
                        break;
                    case "NetStream.Buffer.Empty":
                        break;
                    case "NetConnection.Connect.Success":
                        trace("Congratulations! you're connected");
                        publishLiveStream();
                       
                        break;
                    case "NetConnection.Connect.Failed":
                    case "NetConnection.Connect.Rejected":
                       // trace ("Oops! the connection was rejected");
                        break;
                    case "NetStream.Play.Stop":
                        break;
                    case "NetStream.Play.StreamNotFound":
                        trace("The server could not find the stream you specified");
                        break;
                    case "NetStream.Publish.BadName":
                        break;
                    case "NetStream.Publish.Start":
                }
            }
           
            private function statusHandler(event:StatusEvent):void {
                trace("statusHandler: " + event);
                trace(mic.activityLevel);
            }
           
            private function activityHandler(event:ActivityEvent):void
            {
                //trace(mic.activityLevel);
            }
           
            public function onFault(e:Object)
            {
                //trace(e.info);
                //nc.close();
            }
           
           
           
        }//end class
    }//end package

     

    thelegendaryghost

     
    |
    Mark as:
  • Currently Being Moderated
    May 4, 2009 1:14 PM   in reply to ghost31379

    Wow, I appreciate the detailed info, Ghost.

     

    But somehow, it's still not working for me.  : /

     

    Could you attach a screen grab of your Flash Media Live Encoder settings (assuming you are using FMLE), as well as your source settings in the video player .fla file?

     

    I'll get to the bottom of this one way or another!  ; )

     

    Thanks again for your help.

     
    |
    Mark as:
  • Currently Being Moderated
    May 4, 2009 2:20 PM   in reply to Adll___

    you know what....i failed to ask you what was your experience level with flash .....

    create a new actionscript file in in flash and paste that code there......and save the the file as   SimpleEncoder.as   ....(the name of the class).....then Create a new fla file...name it "test.fla" save the file in the same directory as the   SimpleEncoder.as   file created from the code i pasted....

    ok then inside of the    test.fla   file....at the bottom bar where it says "Document Class"....insert     SimpleEncoder    with the extension part ".as".....

    then ctrl+enter to preview.....or just goto the top menu and click preview.....then it should connect and show you..yourself ......i usually use my local computer first to test things out to see if it works to lessen the possibility of potential problems.....just incase.....

     
    |
    Mark as:
  • Currently Being Moderated
    May 5, 2009 9:47 AM   in reply to ghost31379

    Now _that's_ what I like to see: detailed info so one's sure not to miss anything.  Thanks for taking the time to be so specific, Ghost.  I'm pretty versed in Actionscript 2, but I'll admit, this transition to Actionscript 3 has been rough.  All this stuff about using external .as files and classes and importing classes, yikes, it feels very foreign to me.

     

    Getting back to your fine tutelage... alas, it's still not working for me.  : (

     

    One question... do I need to add a video component to the .fla file?  I'm thinking not since you don't appear to be a fan of components, but I don't know what else I could be missing.

     

    Could you attach a copy of your Flash Files so I can analyze them?  (And maybe a screen grab of your FMLE settings -- with names changed to protect the innocent if necessary?)  ; )

     

    Thanks for sticking with me, Ghost.

     
    |
    Mark as:
  • Currently Being Moderated
    May 5, 2009 9:55 AM   in reply to ghost31379

    Oh yeah, what was your answer to the question re: "Save to File"?  Is that really the name of the file I should be trying to link to?

     
    |
    Mark as:
  • Currently Being Moderated
    May 5, 2009 1:46 PM   in reply to mrwizzer2

    that code i put up there eliminates FMLE altogether.....that code is a basic encoder made with flash....so you record with that swf......

    and on your client player....you connect to FMS using the same netconnection...and you play the same file in your stream player.......so the code for the client player will be similar...and instead of publishing to the stream....you'll be playing the stream.....

     

    as far as the .fla goes.....you dont put anything inside of it....just add the actionscript...".as" file into the document class.....everything is created with code in that example....Its a little strange at first...and believe me i know...i use to code as2 myself and it took me awhile to get away from coding on the timeline .......but after coding as3 for some time now....as3 is alot better and more flexible to me.....i only use my .fla files like a compiler....and the objects i create inside the fla when i do create it.....i link it with actionscript and control it with the .as files...

     

    and from looking at the way i told you to do it.....you dont include the ".as" when you put it in the Document Class inside the .fla i guess that update/edit junk didnt work......because i typed that up wrong.......so put   SimpleEncoder     without the extension on it....

     
    |
    Mark as:
  • Currently Being Moderated
    May 22, 2009 4:16 PM   in reply to ghost31379

    Today we have released DVRCast which will enable DVR functions within FLVPlayback and within Flash Media Live Encoder.

     

    You can also now download an update to FLVPlayback 2.5 (v2.5.0.15) from http://www.adobe.com/go/fms_tools/

     

    Read more here:

    http://blogs.adobe.com/ktowes/

     

    Learn more from the Developer Connection:

    http://www.adobe.com/devnet/flashmediaserver/articles/live_dvr_pt2.htm l

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 20, 2009 8:28 AM   in reply to ktowes (Product Mgr)

    Has anyone gotten DVRcast_edge to work. I able to get DVRCast_ origin n to work but if I point o DVRCast_Edge (and it is pointing at DVRCast_ origin and connected) I just get 'Stream Not Found' . The DVR Player works fine when I point to DVR_cast_ origin. The docs don't go over edge well.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 20, 2009 7:58 PM   in reply to tvman

    Have you configured your host.ini on dvrcast_edge properly? The entry should

    be as follows:

     

     

     

    See if this works

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 21, 2009 4:14 AM   in reply to SE_0208

    I don't see what wrote above but I did get edge to work but only with the client code (flex example test)that came with DvrCast. I can see I need to make some specail Dvrcast calls before I play the stream. Next thing I want to see is how failover works. If I have two sreams going to two origins (primary, secondary) and I try to kill primary stream I just get 'play.complete', Even when I kill primary stream by pulling plug on it I can't see failover. How does failover work for DVR?

     

    Thanks

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points