سؤال

When flash pushed the 12.0.0.70 version to Chrome it broke my video recorder.

According to the patch notes here, one thing was changed that might have broken my flash-based recorder

[3689061] [Video] Resolves an issue injected in Flash Player 11.9.900.170 that caused the video buffer to no longer be filled if the buffer was emptied while playing an RTMP stream

My recorder breaks when it's time to stop the stream and save the video to the Adobe Media Server.

I tried debugging it with the 12.0.0.70 flash debugger, but it doesn't crash when I'm using the debugger. Only when using the non-debugger Chrome version does it crash.

I can't debug it and get any useful information out of my swf, apart from making a bunch of external calls to console.log to see where it fails.

If someone also ran into a similar issue with flash-based, media-server-connected webcam recorders, and can guess at what might fix my problem, I'd be grateful.

I'm building this swf with Flex 4.6.0


Here's the function that stops the video recorder.

public function doStop():void{
            if(status=="paused"){
                doResume();
            }

            rectColor.color=0x000000;
            rectColor.alpha=1;

            var timer:Timer=new Timer(1 * 10);
            timer.addEventListener(TimerEvent.TIMER,function(e:TimerEvent):void{
                timer.stop();
                timer.reset();
                myns.close();
                myTimer.stop();
                if(!thumbBeginning){
                    if(status=="recording"){
                        takeScreenShot();
                    }
                }else{
                    if(status=="recording"){
                        recordingTime = formatTime(realTime);
                        recordingLength = myTimer.currentCount;
                        if(!redoFlag){
                            ExternalInterface.call("CTRecorder.stopOk");
                            myTime.text = formatTime(0);
                            VD1.attachCamera(myCam);
                            setState("ready");
                            status = "stopped, ready"
                            playbackTimer.reset();
                            msg(recordingTime);
                            recording=false;
                            pauseTime=0;
                        }else{
                            pauseTime=0;
                            myTime.text = formatTime(0);
                            VD1.attachCamera(myCam);
                            playbackTimer.reset();
                            msg(recordingTime);
                            recording=false;

                        }
                    }


                    if(shutterGroup.visible){
                        toggleShutter();
                    }

                    myTimer.stop();

                    myTimer.reset();

                    if(redoFlag){
                        doRecord();
                        redoFlag=false;
                        trace("redoFlag turned off");
                    }
                }
                rectColor.alpha=.5;
            });
            timer.start();
        }
هل كانت مفيدة؟

المحلول

This isn't really an answer, but it's too long for a comment.

"I can't debug it" - it only breaks in the release version? Is the release version the pepper plugin (i.e. Chrome's version of Flash), and the debug is the NPAPI plugin (i.e. Adobe's version)?

A likely candidate for where it's breaking is the ExternalInterface.call("CTRecorder.stopOk"); call. Are you testing this locally, or remotely? If locally, then you might be running into this bug: https://code.google.com/p/chromium/issues/detail?id=137734 where the Flash <-> JS communication is broken because of Trusted locations being ignored in PPAPI flash. In any case, try installing the release NPAPI version of Flash and see does it still crash (you can verify which one is running by visiting chrome://plugins/)

To help debugging the release version, you need a logging system - instead of making trace() calls, you call a custom log() function, that, as well as trace()ing, also stores the message somewhere, like in an Array. Then, in your SWF, when you hit a certain key, show a TextField on the screen, and populate it with your log() messages. That way, you'll be able to see trace() statements in release mode.

Also, don't forget to listen to any relative error events and thrown exceptions - ExternalInterface.call() will throw an Error and SecurityError for example. You can also set the marshallExceptions property, which will pass ActionScript exceptions to the browser and JavaScript exceptions to the player: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/external/ExternalInterface.html#marshallExceptions

Finally, add a listener for the UncaughtErrorEvent.UNCAUGHT_ERROR event on your main class, which will catch any uncaught thrown errors (funnily enough), which will at least mean that your app doesn't collapse:

mainClass.loaderInfo.uncaughtErrorEvents.addEventListener( UncaughtErrorEvent.UNCAUGHT_ERROR, this._onUncaughtErrorEvent );
private function _onUncaughtErrorEvent( e:UncaughtErrorEvent ):void
{
    var message:String      = null;
    var stackTrace:String   = null;

    // get the message
    if ( e.error is Error )
    {
        message = ( e.error as Error ).message;
        try { stackTrace = ( e.error as Error ).getStackTrace(); }
        catch ( error:Error ) { stackTrace = "No stack trace"; }
    }
    else if ( e.error is ErrorEvent )
        message = ( e.error as ErrorEvent ).text;
    else
        message = e.error.toString();

    // show an alert
    trace( "An uncaught exception has occurred: " + e.errorID + ": " + e.type + ": " + message + ", stack:\n" + stackTrace );
    e.preventDefault();
}
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top