public boolean setUpCameraForVrMode ( final int fpsMode ) { cameraSetUpStatus = false ; this . fpsMode = fpsMode ; if ( ! isCameraOpen ) { Log . e ( TAG , "Camera is not open" ) ; return false ; } if ( fpsMode < 0 || fpsMode > 2 ) { Log . e ( TAG , "Invalid fpsMode: %d. It can only take values 0, 1, or 2." , fpsMode ) ; } else { Parameters params = camera . getParameters ( ) ; // check if the device supports vr mode preview if ( "true" . equalsIgnoreCase ( params . get ( "vrmode-supported" ) ) ) { Log . v ( TAG , "VR Mode supported!" ) ; // set vr mode params . set ( "vrmode" , 1 ) ; // true if the apps intend to record videos using // MediaRecorder params . setRecordingHint ( true ) ; // set preview size // params.setPreviewSize(640, 480); // set fast-fps-mode: 0 for 30fps, 1 for 60 fps, // 2 for 120 fps params . set ( "fast-fps-mode" , fpsMode ) ; switch ( fpsMode ) { case 0 : // 30 fps params . setPreviewFpsRange ( 30000 , 30000 ) ; break ; case 1 : // 60 fps params . setPreviewFpsRange ( 60000 , 60000 ) ; break ; case 2 : // 120 fps params . setPreviewFpsRange ( 120000 , 120000 ) ; break ; default : } // for auto focus params . set ( "focus-mode" , "continuous-video" ) ; params . setVideoStabilization ( false ) ; if ( "true" . equalsIgnoreCase ( params . get ( "ois-supported" ) ) ) { params . set ( "ois" , "center" ) ; } camera . setParameters ( params ) ; cameraSetUpStatus = true ; } } return cameraSetUpStatus ; }
Configure high fps settings in the camera for VR mode