4

I'm current working wits AS3 and Flex 4.6 to create an android application. i'm using the front camera and attach it to a local Video object that i add as an child to an VideoDisplay object.

When i debug on my computer everything is working perfectly, but when i build the project and run it on my Android device my local video display becomes an gray grid. As example i took an picture of the device.Picture of the problem

I wrote this method based on a post here on Stackoverflow to initialize the front and back camera.

private function InitCamera():void {
            var CamCount:int = ( Camera.isSupported ) ? Camera.names.length : 0;
            for( var i:int = 0; i < CamCount; i++ ) {
                var cam:Camera = Camera.getCamera( String( i ) );
                if( cam ) {
                    if( cam.position == CameraPosition.FRONT ) {
                        CamFront = cam;
                        continue;
                    }

                    if( cam.position == CameraPosition.BACK ) {
                        CamBack = cam;
                        continue;
                    }

                    if( cam.position == CameraPosition.UNKNOWN ) {
                        CamFront = cam;
                        continue;
                    }
                }
            }
        }

And i wrote this method to create an Video object, attach the front Camera as the default camera and add the Video as an child to an VideoDisplay:

private function SetUpLocalVideo():void {
            Debug( "Setting up local video" );
            LocalVideo = new Video( this.LVideo.width, this.LVideo.height );
            LocalVideo.attachCamera( CamFront );

            LVideo.addChild( LocalVideo ); <--- this is the VideoDisplay
        }

I've been searching on the internet for an solution, but so far i failed to find any.

Do any one else had this problem before ? can you share you solutions with me ? I appreciate the help.

Thanks.

ketan
  • 19,129
  • 42
  • 60
  • 98
P.G Wisgerhof
  • 732
  • 1
  • 8
  • 27
  • Did you include full camera permissions into your app descriptor? – user1875642 Jan 03 '13 at 16:09
  • Yes in the Main-App XMl is uncommented this line "" – P.G Wisgerhof Jan 04 '13 at 07:29
  • Ok, I tried it on my phone and I could see this bug , but then it stopped to appear. It also seems that this grid is a result of three simultaneous video outputs. I also saw something like that on old crt displays when I tried to set all possible modes with asm. I So, I guess that it may be caused by some conflict with other camera-using apps(like smart rotation), or by improper camera deinitialization during debug sessions interruptions, or by trying to receive input from two cameras at the same time. Do you use real camera resolutions of your device? – user1875642 Jan 04 '13 at 09:00
  • 1
    This bug can also be avoided and fixed with this method http://stackoverflow.com/questions/14547082/raw-camera-display-on-air – guglielmo Mar 15 '13 at 01:12

1 Answers1

1

Set the render mode to direct on your application.xml

<renderMode>direct</renderMode>

If it still doesn't work, change the dpi settings to 240 of your main flex application.

Shankar Narayana Damodaran
  • 68,075
  • 43
  • 96
  • 126