Air 3.4 official release - stageVideo.attachCamera doesn't display anything
Hello everybody,
since Air 3.4 in no longer in beta phase I've decided to write post about stageVideo.attachCamera method which should work but it just doesn't.
Here's source code:
[SWF(frameRate="60", width="480", height="800")]
public class AttachVideoTest extends Sprite {
private var _camera:Camera;
private var _stageVideo:StageVideo;
public function AttachVideoTest() {
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
initCamera();
stage.addEventListener(StageVideoAvailabilityEvent.STAGE_VIDEO_AVAILABILITY, stageVideoAvailabilityHandler);
}
private function initCamera():void{
_camera = Camera.getCamera();
_camera.setMode(320, 240, 10, false);
}
private function stageVideoAvailabilityHandler(event:StageVideoAvailabilityEvent=null):void {
if(event.availability == StageVideoAvailability.AVAILABLE && stage.stageVideos){
trace("stageVideoAvailabilityHandler, stage.stageVideos: " + stage.stageVideos);
_stageVideo = stage.stageVideos[0];
_stageVideo.viewPort = new Rectangle(0, 0, 320, 240);
_stageVideo.attachCamera(_camera);
}
}
}
The result is just white screen.
I've tested it on
- Samsung Galaxy i9100 with Android 4.0.4 (original rom from samsung, without any mods)
- Nexus S Android 4.0.1
Thank you very much for any he
