14 Replies Latest reply on Jan 19, 2012 7:29 AM by leejk

    Trying to modify FLVPlayback component

    NBauland

      I'm disapointed: I try to modify ncmanager file. (I want add parameter when connect method is called). I've edited this file but nothing happens in my application.

      After two hours of headacke, I delete NCManager (I've made a copy on my USB key).

      I try to place a FLVPlayback on my scene : no problem ! I can place it, but it does'nt work as I want.

      So I discover that even I try to change NCManager, this file isn't read.

       

      I need help to understand what I must do when I modify these file. Should I have to put it somewhere ? must I compile them and how ?

       

      Thanks,

       

      N. Bauland.

        • 1. Re: Trying to modify FLVPlayback component
          Amit Kumar Adobe Employee

          Just try to trace it should reach that place in code I have already tried on my side so there is something you are missing on your side so please tell exactly what you are doing.

           

          Client side:

           

          flvplayback_internal function nextConnect(e:TimerEvent=null):void {

          .

          .

          _tryNC[_connTypeCounter].connect( xnURL, _autoSenseBW, "login", "password");

           

           

          Server side code which I used :

          application.onConnect = function(clientObj, a, l, p)
          {
          trace("Client Connected...");
          if (l == "login" && p == "password")
            this.acceptConnection(clientObj);
          else
            this.rejectConnection(clientObj);
          }

          And check if you are getting proper traces on server side and trace value of 2nd parameter it should come as false (value of "a"). I am sure you are missing something.

           

          Regards,

          Amit

          • 2. Re: Trying to modify FLVPlayback component
            NBauland Level 1

            On my server application (FMS) I put:

            application.onConnect = function( p_client, p_autoSenseBW ,p_login,p_password)
            {
            //Add security here
            trace("Auth: " + p_login + ", " + p_password);

             

            When I'm looking in admin console on FMS, I see:

            ...loading completed.
            Auth: undefined, undefined

             

            On my scene's flash file I put:

            Capture.PNG

            Here is the code:

            import flash.events.MouseEvent;

            btn_vod.addEventListener(MouseEvent.CLICK,setVOD);

            function setVOD(evt:MouseEvent):void
            {
            //my_flv.stop();
            my_flv.play("rtmp://svr/vod/sample.flv");
            }

             

            I modify NCManager file in this way: (line code 1250 to 1280)

            flvplayback_internal function nextConnect(e:TimerEvent=null):void {
               //ifdef DEBUG
               //debugTrace("nextConnect()");
               //endif

               var protocol:String;
               var port:String;
               if (_connTypeCounter == 0) {
                protocol = _protocol;
                port = _portNumber;
               } else {
                port = null;
                if (_protocol == "rtmp:/") {
                 protocol = "rtmpt:/"
                } else if (_protocol == "rtmpe:/") {
                 protocol = "rtmpte:/"
                } else {
                 _tryNC.pop();
                 return;
                }
               }
               var xnURL:String = protocol + ((_serverName == null) ? "" : "/" + _serverName + ((port == null) ? "" : (":" + port)) + "/") + ((_wrappedURL == null) ? "" : _wrappedURL + "/") + _appName;
               //ifdef DEBUG
               //debugTrace( "_tryNC[" + _connTypeCounter + "] connecting to room: " + xnURL );
               //endif
               _tryNC[_connTypeCounter].client.pending = true;
              
            _tryNC[_connTypeCounter].connect( xnURL, _autoSenseBW,"test","test");
               if (_connTypeCounter < (_tryNC.length-1)) {
                _connTypeCounter++;
                _tryNCTimer.reset();
                _tryNCTimer.start();

            But nothing  ... I'm going crazy ... I must be forget a step but which one ?

            Is it normal that I put a trace statement in NCManager I never see it appear ?

             

            Don't know if it can help: I use Flash 5 on Windows 7 64 bit

            • 3. Re: Trying to modify FLVPlayback component
              Amit Kumar Adobe Employee

              Are you able to stream video using Flvplayback component? Are you using Flash CS5? Are you tracing  ....loading completed how you are getting that?

               

              Regards,

              Amit

              • 4. Re: Trying to modify FLVPlayback component
                NBauland Level 1

                Are you able to stream video using Flvplayback component?

                Yes because for now I am not rejecting any connection because I cannot pass login parameters. But as I trace login/password on server side application, these parameter appear undefined.

                 

                Are you using Flash CS5? Yes.

                 

                Are you tracing  ....loading completed how you are getting that?

                 

                Sorry I don't undestand what you mean. (my bad english ...)

                • 5. Re: Trying to modify FLVPlayback component
                  Amit Kumar Adobe Employee

                  Drag FLVPlayback component on the stage and and select "Properties" tab and put "vidplayer" as instance name and dont put any other properties and select "Actions" tab and put the below code and try :

                   

                  import flash.utils.setInterval;
                  import flash.utils.setTimeout;
                  import flash.utils.Timer;
                  import flash.events.TimerEvent;
                  import flash.events.*;

                  import fl.video.FLVPlayback;
                  import fl.video.VideoPlayer;
                  import fl.video.VideoEvent;

                  import flash.display.MovieClip;

                  VideoPlayer.iNCManagerClass = fl.video.NCManagerNative;
                  vidplayer.isLive = false;
                  vidplayer.isDVR = false; 
                  vidplayer.dvrSnapToLive = false;
                  vidplayer.source = "rtmp://localhost/test1/sample";

                  var videoplayer:VideoPlayer;
                  var flvplayback:FLVPlayback;
                  flvplayback = FLVPlayback(this.getChildByName("vidplayer"));
                  videoplayer = flvplayback.getVideoPlayer(0);
                  setTimeout(initMonitor,5000);

                  function initMonitor():void
                  {
                  if (videoplayer.netStream!=null)
                  {
                    trace("Video is playing!!");
                  }
                  else
                  {
                    trace("Main.as : " + "Not connected to FMS yet - Trying again ....")
                    setTimeout(initMonitor,5000);
                  }     
                  }

                  1 person found this helpful
                  • 6. Re: Trying to modify FLVPlayback component
                    NBauland Level 1

                    Everything OK: video is playing

                     

                    But in server :

                    Auth: undefined, undefined

                     

                    Can I put trace statement in NCManager to see if .connect(...) line is active, or code in component disable trace statement ?

                     

                    Regards

                    • 7. Re: Trying to modify FLVPlayback component
                      Amit Kumar Adobe Employee

                      Yes you can put trace statement in the "flvplayback_internal function nextConnect(e:TimerEvent=null):void {" method to check if it going through this.

                       

                      -Amit

                      • 8. Re: Trying to modify FLVPlayback component
                        NBauland Level 1

                        The problem comes from where I suspected:

                        NCManager.as seems never read !

                         

                        I put theses lines in NCManager (line added in bold):

                          public function NCManager() {
                           trace("NCManager constructor");

                        and:

                          flvplayback_internal function nextConnect(e:TimerEvent=null):void {
                           trace("NCManager nextConnect");

                         

                        And these one in FLVPlayback:


                          public function FLVPlayback() {
                           trace("FLVPlayback ctor");

                        And there is nothing in output window ... It's amazing !

                        Here is pasth of files:

                        C:\Program Files (x86)\Adobe\Adobe Flash CS5\Common\Configuration\Component Source\ActionScript 3.0\FLVPlayback\fl\video

                         

                        Any ideas ?

                        • 9. Re: Trying to modify FLVPlayback component
                          Amit Kumar Adobe Employee

                          You can do one more thing just copy the whole fl folder from "C:\Program Files (x86)\Adobe\Adobe Flash CS5\Common\Configuration\Component Source\ActionScript 3.0\FLVPlayback"  and paste it in the same folder where your .fla file exists so instead of picking from "C:\Program Files (x86)\Adobe\Adobe Flash CS5\Common\Configuration\Component Source\ActionScript 3.0\FLVPlayback" it will pick from local folder. Just try this out and let me know.

                           

                          -Amit

                          • 10. Re: Trying to modify FLVPlayback component
                            NBauland Level 1

                            Now I have a lot of error:

                            Capture.PNG

                            Access to undefined property AIR/PLAYER.

                             

                            But now, I know it take source file.

                            I've tried to comment all line where theses properties appear but more errors appear.

                             

                            Regards

                            • 11. Re: Trying to modify FLVPlayback component
                              Amit Kumar Adobe Employee

                              You can follow link http://help.adobe.com/en_US/flash/cs/using/WS3e7c64e37a1d85e1e229110db38dec34-7fa4a.html to know more about config constants because your errors are mostly in the lines where conditional compilation has been done based on the config constant whether it is AIR app or using  flash PLAYER to run.

                              You may need to declare these config constants in the actionscript settings. You dont need to comment out them.

                               

                              Regards,

                              Amit

                              1 person found this helpful
                              • 12. Re: Trying to modify FLVPlayback component
                                NBauland Level 1

                                It's finally working, thanks a lot.

                                I could not have test it earlier because Ihave to reinstall Adobe Master CS5: when moving/deleting/replacing file I have deleted some flash file and crash Flash CS5.

                                 

                                Now all is working. So I resume step to personalize a flash component:

                                1. Copy source file from : C:\Program Files (x86)\Adobe\Adobe Flash CS5\Common\Configuration\Component Source\ActionScript 3.0 in same folder as your .FLA file.
                                2. In ActionScript Settings set . on top of search source code location (keep existing one).
                                3. Set config constants eventually.
                                4. Modify which source code you need.
                                • 14. Re: Trying to modify FLVPlayback component
                                  leejk Level 1

                                  Hello,

                                   

                                  I have followed the instructions in this thread but have the following errors when trying to compile:

                                   

                                  Scene 1, Layer 'Layer 1', Frame 11119: Access of possibly undefined property dvrFixedDuration through a reference with static type fl.video:FLVPlayback.

                                   

                                  There is actually 5 of these errors, each for the flvplayback properties dvrIncrement, dvrIncrementVariance, dvrSnapToLive, and isDVR. What is causing this?

                                   

                                  thx