I’m working on an IOS app in which video from the iPad's camera is displayed on a plane in an Away3D environment.
private function liveVideoCamera():void {
liveCamera = getCamera(CameraPosition.FRONT);
liveCamera.setMode(1024, 730, 30);
var cameraTexture:WebcamTexture = new WebcamTexture(570,340,8,true,liveCamera,true);
var cameraMaterial:TextureMaterial = new TextureMaterial(cameraTexture);
var planeGeom:PlaneGeometry = new PlaneGeometry(570, 340, 1, 1, false, true);
cameraScreen = new Mesh(planeGeom, cameraMaterial);
cameraScreen.y=210;
cameraScreen.x=wall.x;
cameraScreen.z=wall.z;
cameraScreen.rotationY=90;
scene.addChild(cameraScreen);
}
What I cannot find is a way to turn the camera off. Apple will not allow an app to operate the camera without user permission. The app is a puzzle game with more than one player allowed. I need new players to begin with the camera turned off if a previous player left it turned on.
I have found several suggestions on the web that say to set the video attached to the camera to null. But as you can see there is no video:Video involved in the method. The camera outputs to cameraTexture:WebcamTexture instead.
If liveCamera
is WebcamTexture from Away3D, it has a public method called stop
:)
Otherwise you should use attachCamera(null)
to the video.