I am using the latest air 3.5 sdk to build an video application. But I find that the front camera can not render correctly in spark.VideoDisplay, while the back camera is ok.
My deivce is galaxy nexus, android 4.1.2, the code is below:
protected function init(event:FlexEvent):void
{
cam = getFrontCamera();
if (cam != null)
{
videoDisplay.videoObject.attachCamera(cam);
}
}
public function getFrontCamera():Camera
{
if (Camera.isSupported == false)
{
return null;
}
var numCameras:int = Camera.names.length;
var frontCam:Camera;
for (var i:int = 0; i < numCameras; i++)
{
frontCam = Camera.getCamera(Camera.names[i]);
if (frontCam.position == CameraPosition.FRONT)
{
break;
}
frontCam = null;
}
return frontCam;
}
<s:VideoDisplay id="videoDisplay" x="0" y="0" width="100%" height="100%" creationComplete="init(event)">
<s:source>
<s:DynamicStreamingVideoSource host="" streamType="live">
<s:DynamicStreamingVideoItem />
</s:DynamicStreamingVideoSource>
</s:source>
</s:VideoDisplay>
The camera result below:
Any help will be appreciate.