Highlighted

Really Odd Crash

l4nc3rr

22-07-2010

There's a really odd bug / crash that happens under these very specific circumstances.  Unfortunately I can't upload an FLA here, so I've provided a download link from a 3rd party site.  If you don't feel comfortable with that, I've listed the steps to recreate the error below.

(Note: Don't click the giant download buttons, click where it says "Save file to your PC: click here")

http://www.2shared.com/file/qJWkGney/PrivateVideoChat.html
http://www.2shared.com/file/M5tNwwRL/PrivateVideoChatExample.html

If you don't feel comfortable with that, here's a description on how to recreate the error:

1. Create a new AS3 FLA

2. Under AS3 Settings -> Library Path, import the flash only player 10 AFCSFlash.swc

3. Import rpc.swc from the FLEX sdk into the library path

4. Create a movie clip and put text object in it.  Don't put it on the stage -- leave it in the library.

And then to make it work with the document class...

5. Add a Button component and name the instance connectButton

6. Add a TextInput component and name the instance connectSessionID

7. Add another TextInput component and name the instance myCSessionID

8. Create the document class and link it to the FLA

9. Add your developer credentials (where the constants are defined)

The document class is this:

package {
    import com.adobe.rtc.authentication.AdobeHSAuthenticator;
    import com.adobe.rtc.collaboration.AudioPublisher;
    import com.adobe.rtc.collaboration.AudioSubscriber;
    import com.adobe.rtc.collaboration.WebcamPublisher;
    import com.adobe.rtc.collaboration.WebcamSubscriber;
    import com.adobe.rtc.events.SessionEvent;
    import com.adobe.rtc.session.ConnectSession;
   
    import fl.controls.Button;
    import fl.controls.TextInput;
   
    import flash.display.Sprite;
    import flash.events.MouseEvent;
   
    public class PrivateVideoChatExample extends Sprite {
       
        protected const USERNAME:String = "";
        protected const PASSWORD:String = "";
        protected const ROOM_URL:String = "";
       
        protected var _cSession:ConnectSession = new ConnectSession();
       
        protected var _webcamPublisher:WebcamPublisher = new WebcamPublisher();
        protected var _localWebcamSubscriber:WebcamSubscriber = new WebcamSubscriber();
        protected var _audioPublisher:AudioPublisher = new AudioPublisher();
        protected var _audioSubscriber:AudioSubscriber;
       
        public var connectButton:Button;
        public var connectSessionID:TextInput;
        public var myCSessionID:TextInput;
       
        public function PrivateVideoChatExample() {
            var authenticator = new AdobeHSAuthenticator();
            authenticator.userName = this.USERNAME;
            authenticator.password = this.PASSWORD;
           
            this._cSession.roomURL = this.ROOM_URL;
            this._cSession.authenticator = authenticator;
            this._cSession.login();
           
            this._cSession.addEventListener(SessionEvent.SYNCHRONIZATION_CHANGE, this.onLogin);
            this.connectButton.addEventListener(MouseEvent.CLICK, this.connectTo);
        }
       
        protected function connectTo(event:MouseEvent) {
            if(this._cSession.userManager.getUserDescriptor(this.connectSessionID.text)) {
                this.createNewPrivateChat(this.connectSessionID.text);
            }
        }
       
        public function onLogin(event:SessionEvent):void {
            this.myCSessionID.text = this._cSession.userManager.myUserID;
           
           
            this._audioPublisher.publish();
            this._webcamPublisher.publish();
           
            this._localWebcamSubscriber.subscribe();
           
        }
       
        public function createNewPrivateChat(userID:String) {
            this._audioSubscriber = new AudioSubscriber();
            trace("Hasn't crashed yet....!");
            this._audioSubscriber.subscribe();
            this._audioSubscriber.publisherIDs = new Array(userID);
            trace("Aaaaannnndddd...boom.");
        }
    }
}

You'll notice if you do any of the following it'll work fine:

1. Replace the player 10 AFCSFlash.swc with the player 9 AFCSFlash.swc in the library path

2. Remove the rpc.swc from the library path

3. Remove the MovieClip with the text object in it

4. Comment out the line "this._audioSubscriber.publisherIDs = new Array(userID);"

Edit: Oh yeah, and to use the application you copy your session ID (from the myCSessionID TextInput) and paste it into the the connectSessionID TextInput in another instance of the swf file (or into the same one -- you get the same results).

I was able to replicate this on another computer using the files above, so I don't think it's my environment that's causing the error.

I have this version of Flash installed: 10,1,53,64