Skip to main content
Inspiring
Oct 3, 2016 3:21 PM UTC
Answered

Air 23 SDK Android return from cameraUI incorrect displaystate

Using Air 23 sdk on Android with displaystate of normal (ie. not full screen so you see the Android bar at the top of the app), calling the cameraUI.launch( MediaType.VIDEO ), recording a video and when returning from the recording the displaystate changes to fullscreen where the top part of the app is covered by the Android bar at the top - is there a fix for this? On return from the video recording, tried setting the displaystate to normal, but didn't work, top of app is still covered by the Android top bar.

This topic is closed to new replies. Start a new post to keep the conversation going.
pravishtis
pravishtisCorrect answer
Adobe Employee
Oct 12, 2016 11:14 AM UTC

Hi,

We have tried your code at our end by using stage.displayState after coming back from CameraUI and it is normal. The top of application is starting after the status bar and there's no overlap on our side. We have added a clickHandler to check the stage.displayState -

public function clickHandler(e:Event):void

  {

  trace("click handler");

  trace("\nStageDisplayState: " + stage.displayState);

  }

And it is tracing "normal" when we come back from the recording screen.

Thanks,

Adobe AIR Team

6 replies

Spider22Author
Inspiring
Oct 12, 2016 8:38 PM UTC

Seems to work by uncommenting the this.stage.displayState = StageDisplayState.NORMAL line, in my code as per your response.

Thanks.

Translate
Spider22Author
Inspiring
Oct 6, 2016 3:18 PM UTC

Hi, I have extracted the code as follows. Note that if I introduce a delay before the readData() calls (say for 2 seconds), the issue seems to go away most of the time (not all of the time, but most of the time) and also if I cancel from the cameraUI I do not see the issue. I am wondering if it may be related to resources when returning from the cameraUI to the app? In any case, the code ....

var cameraUI:CameraUI = new CameraUI();
var dataSource:IDataInput;
var imageBytes:ByteArray;

if( CameraUI.isSupported )
{
cameraUI.addEventListener( MediaEvent.COMPLETE, mediaSelected );
cameraUI.addEventListener( Event.CANCEL, browseCanceled );
cameraUI.addEventListener( ErrorEvent.ERROR, mediaError );
cameraUI.launch( MediaType.VIDEO );
}
else
{
trace( "Picture/Video taking is not supported on this device.","1");
}

function browseCanceled( event:Event ):void

{}

function mediaError( event:Event ):void

{}

function mediaSelected( event:MediaEvent ):void
{
//this.stage.displayState = StageDisplayState.NORMAL;
//this.stage.scaleMode = StageScaleMode.EXACT_FIT;
var imagePromise:MediaPromise = event.data;
dataSource = imagePromise.open();
if( imagePromise.isAsync )
{
  var eventSource:IEventDispatcher = dataSource as IEventDispatcher;           
  eventSource.addEventListener( Event.COMPLETE, onTakenMediaLoaded );        
}
else
{
  readData();
}
}
function onTakenMediaLoaded( event:Event ):void
{
readData();
}
function readData():void
{
imageBytes = new ByteArray();
dataSource.readBytes( imageBytes );
temp = File.applicationStorageDirectory.resolvePath("App/library/1.mp4");

     var stream:FileStream = new FileStream();
     stream.open( temp, FileMode.WRITE );
     stream.writeBytes( imageBytes );
     stream.close();

// file stored locally
}

Translate
pravishtis
Adobe Employee
pravishtisCorrect answer
Adobe Employee
Oct 12, 2016 11:14 AM UTC

Hi,

We have tried your code at our end by using stage.displayState after coming back from CameraUI and it is normal. The top of application is starting after the status bar and there's no overlap on our side. We have added a clickHandler to check the stage.displayState -

public function clickHandler(e:Event):void

  {

  trace("click handler");

  trace("\nStageDisplayState: " + stage.displayState);

  }

And it is tracing "normal" when we come back from the recording screen.

Thanks,

Adobe AIR Team

Translate
Spider22Author
Inspiring
Oct 4, 2016 4:17 PM UTC

Hi,

I am testing on Samsung Note and HTC One, running Android 6 and 4.1. I have tried with SDK 22 and see the same issue as with 23.

Thanks.

Translate
pravishtis
Adobe Employee
Adobe Employee
Oct 6, 2016 6:55 AM UTC

Hi,

We have tried the issue at our end but couldn't reproduce. Could you please provide a sample project so that we can investigate the issue. Also, if you could send us a video demonstrating the issue, that will be great.

Thanks,

Adobe AIR Team

Translate
pravishtis
Adobe Employee
Adobe Employee
Oct 4, 2016 11:45 AM UTC

Hi,

Thanks for reporting the issue. Could you please let us know with the following details like :

1. Which device and Android version you are using?

2. Is this issue AIR 23 specific ? or you are facing it on lower versions as well?

These details will help us in investigating further.

Thanks,

Adobe AIR Team

Translate