how to turn iOS camera on/off

Software: Away3D 4.x

hfeist, Jr. Member
Posted: 23 April 2014 08:10 PM   Total Posts: 37

I’m working on an IOS app in which video from the webcam is displayed on a plane in away3D.

private function liveVideoCamera():void {
   liveCamera 
getCamera(CameraPosition.FRONT); 
   
liveCamera.setMode(102473030);
   
   var 
cameraTexture:WebcamTexture = new WebcamTexture(570,340,8,true,liveCamera,true);
   var 
cameraMaterial:TextureMaterial = new TextureMaterial(cameraTexture);
   
   var 
planeGeom:PlaneGeometry = new PlaneGeometry(57034011falsetrue);
   
cameraScreen = new Mesh(planeGeomcameraMaterial);
   
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.

 

   

gonchar, Newbie
Posted: 23 April 2014 11:45 PM   Total Posts: 7   [ # 1 ]

Hey, have you tried

cameraTexture.stop();
cameraTexture.play(); 

methods?

   

hfeist, Jr. Member
Posted: 23 April 2014 11:56 PM   Total Posts: 37   [ # 2 ]

Works beautifully—thanks so much!

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X