Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Display bug with Front Camera, Video and VideoDisplay in Adobe AIR (Flex 4.6.0) for Android

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.

like image 364
P.G Wisgerhof Avatar asked Nov 13 '22 14:11

P.G Wisgerhof


1 Answers

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.

like image 131
Shankar Narayana Damodaran Avatar answered Nov 15 '22 07:11

Shankar Narayana Damodaran