Expand my Community achievements bar.

¿How can I publish a Camera with a different UserID?

Avatar

Level 1

First of all, Happy New Year 2011!


I've tried WebcamPublisher webCamPub.publish("userPublisher") method to publish a WebCam to a room with a different user that the "myUserId" logged at the session, but the subscribers attached to the room they never receive the video. If I check the Room console I can see the new  user has been created and the camera stream assigned. If i use the normal Publisher-Subscriber example with webCamPub.publish() everything works correctly. One difference, on the normal example when I publish the Publisher, the Flash Player Configuration will ask me permision to access the Camera, but on my new code i will never be asked for this access. It looks like if a Camera start is needed to be executed. ¿What am i missing?

Here is my specific code

           private function onCreationComplete():void


                {

                    cSession.roomManager.autoPromote = true ;

                    cSession.roomManager.guestsHaveToKnock = false ;

                   

                    userPub1= new UserDescriptor();

                    userPub1.userID="userPublisher";

                    userPub1.displayName="userPublisher";

                    userPub1.role=100;  //Tried also with 50 obtaining the same behaviour

                   

                   

                    cSession.userManager.createUser(userPub1);

                   

                    sharedProperty = new SharedProperty();

                    sharedProperty.isSessionDependent = true ;

                    sharedProperty.sharedID = "webcamShare" ;

                    sharedProperty.connectSession = cSession ;

                    sharedProperty.subscribe();

                    sharedProperty.addEventListener(SharedPropertyEvent.CHANGE,onChange);

                   

                   

                   

                }


I've tried to create the Publisher  on two different methods.

            private function onChange(p_evt:SharedPropertyEvent):void
                {
                   
                    if ( webCamPub != null ) {
                        webCamPub.close();
                        webCamPub. = null ;
                    }
                   
                    webCamPub = new WebcamPublisher();
                    webCamPub.connectSession=cSession;
                    webCamPub.sharedID="webcamShare";
                    webCamPub.publish("userPublisher");

                }

           
            private function onBtnClick(p_evt:MouseEvent):void
                {
                    if ( p_evt.currentTarget.label == "Start" ) {
                        webCamPub.connectSession=cSession;
                        webCamPub.sharedID="webcamShare";
                        webCamPub.publish("userPublisher");
                        webCamPub.initialize();
                    }
                }

Here also is a part of the code of the Webcam example that is working ok.

............
if ( p_evt.currentTarget.label == "Start" ) {
                        webCamPub.connectSession=cSession;
                        webCamPub.sharedID="webcamShare";
                        webCamPub.publish();
..................


<rtc:ConnectSessionContainer id="cSession" authenticator="{auth}" width="100%"
         height="100%" roomURL="https://collaboration.adobelivecycle.com/xxxx/yyyyy">
         <mx:Panel title="Webcam Example" width="100%" height="100%"
                    paddingTop="10" paddingLeft="10" paddingRight="10" paddingBottom="10" creationComplete="onCreationComplete()">
              <rtc:WebcamPublisher id="webCamPub" width="10" height="5" resolutionFactor="5"/>
            <mx:VBox width="100%" height="100%" id="clickedContainer"/>
                <mx:HBox horizontalGap="10" verticalGap="15" paddingLeft="10" paddingTop="10" paddingBottom="10" paddingRight="10" width="100%" height="25%">
                <mx:Repeater id="rp" dataProvider="{cSession.userManager.userCollection}" width="100%" height="100%" >
                <mx:VBox id="vbox1" width="100%" height="15%" horizontalAlign="center" horizontalGap="5">
                            <rtc:WebcamSubscriber id="ws1" webcamPublisher="{webCamPub}" width="100%" height="100%" publisherIDs="{[(rp.currentItem as UserDescriptor).userID]}" click="onClick(event)" userBooted="onBooted(event)" streamChange="onCameraPause(event)"/>
                        <mx:Button id="b1" label="Start"  click="onBtnClick(event)"  visible="{(rp.currentItem as UserDescriptor).userID==cSession.userManager.myUserID}" />
                       </mx:VBox>
               
                </mx:Repeater>   
            </mx:HBox>
    </mx:Panel>
</rtc:ConnectSessionContainer
>

I can attach my complete code if you think is usefull. Thanks in advance.

0 Replies