mirror of
https://github.com/status-im/react-native-camera.git
synced 2026-09-01 06:01:14 +00:00
fix snapshot orientation when device orientation is locked (#232)
* use device orientation on android only with auto orientation * guard against missing playSoundOnCapture and quality props in options * add video orientation support * use device orientation on ios only with auto orientation
This commit is contained in:
committed by
Zack Story
parent
f9137824a0
commit
0c3dba1ff6
@@ -9,6 +9,7 @@ import android.hardware.Sensor;
|
||||
import android.hardware.SensorEvent;
|
||||
import android.hardware.SensorEventListener;
|
||||
import android.hardware.SensorManager;
|
||||
import android.view.Surface;
|
||||
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
|
||||
@@ -51,13 +52,13 @@ public class RCTSensorOrientationChecker {
|
||||
float y = event.values[1];
|
||||
|
||||
if (x<5 && x>-5 && y > 5)
|
||||
mOrientation = 0;
|
||||
mOrientation = Surface.ROTATION_0; // portrait
|
||||
else if (x<-5 && y<5 && y>-5)
|
||||
mOrientation = 3;
|
||||
mOrientation = Surface.ROTATION_270; // right
|
||||
else if (x<5 && x>-5 && y<-5)
|
||||
mOrientation = 2;
|
||||
mOrientation = Surface.ROTATION_180; // upside down
|
||||
else if (x>5 && y<5 && y>-5)
|
||||
mOrientation = 1;
|
||||
mOrientation = Surface.ROTATION_90; // left
|
||||
|
||||
if (mListener != null) {
|
||||
mListener.orientationEvent();
|
||||
|
||||
Reference in New Issue
Block a user