15 Replies Latest reply on Nov 14, 2009 4:28 PM by Brunofenzl

    Flash examples for WebcamPublisher

    Gadi Srebnik

      Hi,

      Is there examples how to use Camera stream without WebCamera Flex's pod?

      I would like to test integration within existing flash project so flex is not and option here.

      In documentation there's metion that all funcitonality is available from flash & flex.

       

      any help would be welcome

       

      regards,

      gadi

        • 1. Re: Flash examples for WebcamPublisher
          Hironmay Level 4

          Yes , you can use WebcamPublisher and WebcamSubscriber. You can use the AFCSFlash swcs instead of the flex ones. I don't think there is an example given but will try to add them next time.

           

          Thanks

          Regards

          Hironmay Basu

          1 person found this helpful
          • 2. Re: Flash examples for WebcamPublisher
            Gadi Srebnik Level 1

            Thank you.

             

            I started using AFCSFlash swc and  I cant feagure how do I accossiate Camera to the WebcamPublisher.

            when I try this:

             

            webcamPublisher = new WebcamPublisher();
            webcamPublisher.connectSession = sess;

             

            methods setUserRole and publish for WebcamPublisher failed : TypeError: Error #1009: Cannot access a property or method of a null object reference.

            on the webcamPublisher object.

            • 3. Re: Flash examples for WebcamPublisher
              aponnusa Adobe Employee

              Hi,

               

              Can you try

               

              webcamPublisher = new WebcamPublisher();
              webcamPublisher.connectSession = sess;
              
              _webCamSubscriber= new WebcamSubscriber();
              _webCamSubscriber.connectSession =  sess;
              
               webcamPublisher.subscribe();
               webcamPublisher.publish();
              
               _webCamSubscriber.webcamPublisher = webcamPublisher;
               _webCamSubscriber.subscribe();
              

               

              Adding the WebCamSubscriber to your sprite or Container should do the trick. Please let me know if you need further assistance.

               

              Thanks

              Arun

              • 4. Re: Flash examples for WebcamPublisher
                Gadi Srebnik Level 1

                Thanks you.

                 

                also have some new conclutions of my own:

                - creation of WebcamPublisher can be done like that, but need to set connectSession only after session connection

                - publish can run only after subscribe() finished, no event here so I used interval otherwise got some errors.

                 

                I think there are too many wrappers to the stream, availability of raw stream just as used on FMS and Stratus

                is important to simplify and to be more accurate in video implementation, and I would like to see that in future versions.

                 

                Thanks,

                gadi

                • 5. Re: Flash examples for WebcamPublisher
                  Nigel Pegg Level 4

                  Thanks for the feedback gadi,

                   

                    It does sound like we could improve this workflow quite a bit - ideally, you wouldn't need to manage the connectsession so explicitly, and we can make it so that publish doesn't require a subscribe() (I don't even know why you have to subscribe a publisher at all).

                   

                    We'll fix this up for the next build.

                     thanks!

                     nigel

                  • 6. Re: Flash examples for WebcamPublisher
                    Brunofenzl Level 1

                    Hi Nigel and other users!

                     

                    I´m also strugling to get things working with flash...

                    I´m able to connect to the server but i didn´t find out how to add any output to the display list. I´m using the Flash CS4 IDE to build my app.

                    In the docs I saw that ..pods.WebCamera doesn´t exist for Flash, I just found CameraModel...

                    How can I subscribe the camera and output something to the display list?

                     

                    thanks in advance,

                    Bruno

                     

                    Edit:

                     

                    I´ll post my code so anybody can take a look...

                     

                    import com.adobe.rtc.session.ConnectSession;
                    import com.adobe.rtc.authentication.AdobeHSAuthenticator;
                    import com.adobe.rtc.collaboration.WebcamPublisher;
                    import com.adobe.rtc.collaboration.WebcamSubscriber;
                    import com.adobe.rtc.pods.cameraClasses.CameraModel;

                     

                    import flash.media.Camera;
                    import flash.media.Video;

                     

                    var container:Sprite;
                    var auth:AdobeHSAuthenticator;
                    var session:ConnectSession;
                    var publisher:WebcamPublisher;
                    var subs:WebcamSubscriber;
                    var cam:CameraModel;

                     

                    auth = new AdobeHSAuthenticator();
                    auth.userName = "myUserName";
                    auth.password = "myPassword";

                     

                    session = new ConnectSession();
                    session.roomURL = "https://connectnow.acrobat.com/myName/someRoom";
                    session.authenticator = auth;
                    try{
                        session.login();   
                    }catch(e:Error){
                        trace(e);
                    }

                     

                    publisher = new WebcamPublisher();
                    publisher.connectSession = session;
                    publisher.subscribe();
                    publisher.publish();

                     

                    subs = new WebcamSubscriber();
                    subs.connectSession = session;
                    subs.webcamPublisher = publisher;
                    subs.subscribe();

                     

                    cam = new CameraModel();
                    cam.subscribe();

                     

                    container = new Sprite;
                    addChild(container);
                    container.addChild(subs);

                    • 7. Re: Flash examples for WebcamPublisher
                      aponnusa Adobe Employee

                      Hi Brunofenzi,

                       

                      I just modified your code a bit, and it seems to work.

                       

                      import com.adobe.rtc.session.ConnectSession;
                      import com.adobe.rtc.authentication.AdobeHSAuthenticator;
                      import com.adobe.rtc.collaboration.WebcamPublisher;
                      import com.adobe.rtc.collaboration.WebcamSubscriber;
                      import com.adobe.rtc.pods.cameraClasses.CameraModel;
                      import com.adobe.rtc.events.SessionEvent;
                      
                       
                      
                      import flash.media.Camera;
                      import flash.media.Video;
                      
                       
                      
                      var container:Sprite;
                      var auth:AdobeHSAuthenticator;
                      var session:ConnectSession;
                      var publisher:WebcamPublisher;
                      var subs:WebcamSubscriber;
                      var cam:CameraModel;
                      
                       
                      
                      auth = new AdobeHSAuthenticator();
                      auth.userName = "FlexyLite";
                      
                       
                      
                      session = new ConnectSession();
                      session.roomURL = "https://connectnow.acrobat.com/myName/someRoom";
                      session.authenticator = auth;
                      session.addEventListener(SessionEvent.SYNCHRONIZATION_CHANGE, onLogin);
                      try{
                          session.login();   
                      }catch(e:Error){
                          trace(e);
                      }
                      
                      
                      function onLogin(p_evt:SessionEvent):void
                      {
                           publisher = new WebcamPublisher();
                           publisher.connectSession = session;
                           publisher.subscribe();
                           publisher.publish();
                           
                           subs = new WebcamSubscriber();
                           subs.connectSession = session;
                           subs.webcamPublisher = publisher;
                           subs.subscribe();
                           subs.width = 50;
                           subs.height = 50;
                           addChild(subs);
                      }
                      

                       

                      Initially it may not have worked because the WebcamSubscriber subscribed before the session is logged.So your code worked after I added an event-listener.

                       

                      Thanks

                      Arun

                      • 8. Re: Flash examples for WebcamPublisher
                        Brunofenzl Level 1

                        Hi Aponnusa!

                         

                        Many thanks!

                        I really don´t know where I would find this information...

                        many thanks again, and have a nice weekend!

                         

                        bruno

                        • 9. Re: Flash examples for WebcamPublisher
                          kameturtle Level 1

                          Hi,

                          I think I'm messing up something pretty simple here, but I keep getting:

                          Type was not found or was not a compile-time constant: SessionEvent

                          I have the import com.adobe.rtc.events.SessionEvent; listed.

                          Any help appreciated, thanks.

                          Graeme

                          • 10. Re: Flash examples for WebcamPublisher
                            aponnusa Adobe Employee

                            Hi,

                             

                            I verified that the SessionEvent (import com.adobe.rtc.events.SessionEvent) is present in the SDKs (both Flash Player 9 & Flash Player 10). Can you try re-building your project or posting your code or mailing the swc's you are using.

                             

                            Thanks

                            Arun

                            • 11. Re: Flash examples for WebcamPublisher
                              kameturtle Level 1

                              Thanks for the quick reply.

                              I'm very new to this and trying to get my initial settings correct and that's likely where my mistake is. I've only just figured out that I needed to add the afcs.swc as a library path. I've just done that adding the player9\afcs.swc

                              Now I get...

                              1046: Type was not found or was not a compile-time constant: [mx.core]::IMXMLObject.

                              I'm using the code from the example above which apparently works, changing to my own username and roomname.

                              At one point I tried one of the flex examples to connect to my room and that worked ok, but I want to work with flash.

                              Thanks!

                              Graeme

                              • 12. Re: Flash examples for WebcamPublisher
                                Brunofenzl Level 1

                                Hi KameTurtle!

                                 

                                Are you sure you are using the right swc? it seems the classes you are using have some flex dependencies.

                                I made a copy of the FP9 (for flash) package and set it in my flash preferences. I´m not using the SWC, just the package...

                                 

                                hope it helps!

                                bruno

                                • 13. Re: Flash examples for WebcamPublisher
                                  kameturtle Level 1

                                  Aha! Thanks for that, you're quite right. I had to add a library path to the flashOnly swc. So now I can login.

                                  Thanks again,

                                  Graeme

                                  • 14. Re: Flash examples for WebcamPublisher
                                    Nigel Pegg Level 4

                                    grazie Bruno - I love when folks help each other =). It's also nice to see so many trying the FlashOnly SDK. We're definitely spending more time with it, adding more examples and making it easier to work with, so keep feedback coming.

                                     

                                      nigel

                                    • 15. Re: Flash examples for WebcamPublisher
                                      Brunofenzl Level 1

                                      that´s community