Skip to main content
Known Participant
May 4, 2011
Question

onTimeCoordInfo not found Error while doing DVR

  • May 4, 2011
  • 1 reply
  • 2539 views

While streaming the DVR i get the following error "ReferenceError: Error #1069: Property onTimeCoordInfo not found on dvrlive and there is no default value." here i have attached the code i did am i want to do anything more? i didnt use any server side code. Any help appreciated thanks in advance.

DVR publishing script

public function DVR():void
        {
            nc = new NetConnection();
            nc.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
            nc.connect("rtmp://192.168.172.111/dvr");      
        }

       
        private function onNetStatus(event:NetStatusEvent):void{

            trace(event.info.code);

            switch(event.info.code){                
                case "NetConnection.Connect.Success":
                    publishCamera();
                    displayPublishingVideo();                     
                    break;
            }
        }
       
      
       
         private function displayPublishingVideo():void {
            vid = new Video(cam.width, cam.height);
            vid1.x = 10;
            vid1.y = 10;            
            vid.attachCamera(cam);
            vid1.width=cam.width;
            vid1.height=cam.height;
            vid1.addChild(vid);
            this.addChild(vid1);
        }
       
        private function publishCamera():void {
            cam = Camera.getCamera();
            mic = Microphone.getMicrophone();
            ns = new NetStream(nc);
            ns.client = this;
            ns.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
          
            ns.attachCamera(cam);           
            ns.attachAudio(mic);
            // Publish the stream to the server
          
            ns.publish("video", "record");
           
        }

Streaming side

public function DVR():void
        {
            nc = new NetConnection();
            nc.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
            nc.connect("rtmp://192.168.172.111/dvr");           
        }


       
private function onNetStatus(event:NetStatusEvent):void{
            trace(event.info.code);

            switch(event.info.code){
                
                case "NetConnection.Connect.Success":                    
                    displayVideoPlay();                   
                    break;

          }

     }

public function onMetaData(info:Object):void {
            trace("metadata:duration = " + info.duration);
            stamp = getTimer();
            trace("stamp: " + stamp);            
            duration = info.duration;
        }

private function displayVideoPlay():void
        {
            nsPlayer = new NetStream(nc);


            nsPlayer.client = this;
            nsPlayer.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);

            nsPlayer.play("video", 0, -1);
            vidPlayer = new Video(200,150);            
            vidPlayer.attachNetStream(nsPlayer);
           
            vidPlay1.width=200;
            vidPlay1.height=100;
            vidPlay1.x=350;
            vidPlay1.addChild(vidPlayer);
            this.addChild(vidPlay1);                    
           
        }

    This topic has been closed for replies.

    1 reply

    Adobe Employee
    May 4, 2011

    In Streaming side script you need to add the timecoord handler as below:

    private function displayVideoPlay():void
            {
                nsPlayer = new NetStream(nc);


                //nsPlayer.client = this;
                nsPlayer.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);

                client = new Object();
                ns.client = client;
                client.onTimeCoordInfo = timeCoordHandler;

                nsPlayer.play("video", 0, -1);
                vidPlayer = new Video(200,150);            
                vidPlayer.attachNetStream(nsPlayer);
               
                vidPlay1.width=200;
                vidPlay1.height=100;
                vidPlay1.x=350;
                vidPlay1.addChild(vidPlayer);
                this.addChild(vidPlay1);                    
               
            }

    function timeCoordHandler(timeObj:Object):void{
         

    }

    Regards,

    Amit

    Known Participant
    May 4, 2011

    Thanks for your reply Dear Amith Kumar

    but if i use nsPlayer.client=client ; i am unable to access the metadata, if i use nsPlayer.client=this i am able to access the metadata. could i use nsPlayer.client=this; or i must to use nsPlayer.client=client;

    Thanks and Regards,

    G.Thirumalai murugan

    Adobe Employee
    May 5, 2011

    If you are using nsPlayer.client = this; then you just need to add the onTimeCoordInfo handler method like onMetaData and nothing else:

    private function displayVideoPlay():void
    {
                nsPlayer = new NetStream(nc);


                nsPlayer.client = this;
                nsPlayer.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);

                //client = new Object();
                //ns.client = client;
                //client.onTimeCoordInfo = timeCoordHandler;

                nsPlayer.play("video", 0, -1);
                vidPlayer = new Video(200,150);            
                vidPlayer.attachNetStream(nsPlayer);
               
                vidPlay1.width=200;
                vidPlay1.height=100;
                vidPlay1.x=350;
                vidPlay1.addChild(vidPlayer);
                this.addChild(vidPlay1);                    
               
    }

    public function onTimeCoordInfo(info:Object):void {

    }

    Regards,

    Amit