Commit Graph

271 Commits

Author SHA1 Message Date
cristianoccazinsp
8c6a26f289 fix(android): Fix Objects.equals that is only available after API 19 (#2635) 2019-12-10 11:02:16 -03:00
SaeedZhiany
d8cf6c9c10 feat(android): Load Android Gradle Plugin conditionally (#2623) 2019-12-03 16:09:23 -03:00
Märt Lõhmus
1f8b863947 feat(android): restore state when useCamera2api is enabled (#2603) 2019-12-02 09:28:13 -03:00
Stanimir
72c5624dd3 fix(example): fixes and updates in mlkit example (#2618) 2019-12-02 09:24:12 -03:00
Kyle Johnson
32355f4779 fix(android): barcode option passing to mlkit for Android (#2614)
* pass barcode options to mlkit

* rm doubled FORMAT_ALL_FORMATS
2019-12-01 20:50:57 -03:00
cristianoccazinsp
aa22fd1fff feat(exif): Implement writeExif for iOS, Android improvements (#2577)
* - Improve Android code so skipProcessing is not needed, the code is more in line with iOS, and is "fast" by default. This means that skipProcessing is no longer needed (nor used), and adding additional options will "slow down" the capture as expected, rather than having always a lot of processing. This shouldn't be a breaking change.

- document the writeExif option, and implement it for iOS as well.

* Release CF object which could cause a memleak
2019-11-20 00:22:08 -03:00
cristianoccazinsp
ad9d0840fd fix(android): Possible ANR due to events not fired on the main thread (#2591)
* This is a fix for events possibly being fired not on the main thread, which could cause the whole app to freeze.

* Fire events on the right thread. No need to use UI thread, and fix the still works
2019-11-18 09:52:35 -03:00
cristianoccazinsp
be8a08ce9c fix(android): fix possible crash when attempting to retrieve camera parameters. (#2570) 2019-11-11 11:30:06 -03:00
cristianoccazinsp
87774dd370 feat(android): Android ui thread (#2560)
* Move heavy work to a dedicated background thread. Improves camera initial loading and resumes from background.

Details:

- Use a HandlerThread to delegate heavy tasks to background. The thread is managed by the view, and passed down to the implementation in case it also needs to use it. The view will fire start calls and other possibly heavy operations in this thread to avoid ANRs. Some code sent to this thread:
    - start calls: start is extremely heavy and will cause ANRs on some devices, especially when coming back from background
    - Camera1: some preset changes fire a stop/start sequence. These will now happen in the background thread
    - take picture and start recording (from view class) will also start in this thread

- Add some extra null checks

- View was not properly cleaning up itself on destroy (host destroy event was never fired)

* catch possible errors when starting camera preview. This might still randomly fail on some devices for some reason.

* delay capture in progress until we have resumed/paused preview.

* do not crash the app if set texture setup failed

* more synchronized checks to prevent crashes due to concurrent camera updates

* remove unused imports
2019-11-04 14:53:42 -03:00
cristianoccazinsp
7abc7c2e01 feat(torch): Torch fixes for iOS and a few nil checks. (#2543)
* Torch fixes for iOS and a few nil checks.

- Torch turned on by default should work as expected (turned on after mounting and camera type switch)
- Torch maintained when video recording starts (it will flicked if preset has to change)
- Torch resumed when app comes back from background (it is disabled on session pause)

* Fix Torch mode while recording for Android as well.
2019-10-16 18:09:07 -03:00
cristianoccazinsp
686ed2bea8 fix(android): Add synchronized checks on some code that might cause issues if called concurrently. (#2526)
Add try catch on setDisplayOrientation

Should improve issues from https://github.com/react-native-community/react-native-camera/issues/2525
2019-10-09 11:37:00 -03:00
cristianoccazinsp
612cb65f2a feat(android): Support to enumerate and select Camera devices (#2492)
* Android only: Support to enumerate Camera devices and to select from one of them.

* No need to have the camera in running state if querying for IDs.

* Silly bug, not using string compare. Also, do not run any camera code if the actual camera doesn't change.

* Crash fix when focus coordinates are set to null/undefined not being handled. Notes about not supported flash/focus

* If a camera is not found, set the first available camera just like Camera2 does.

* missing semicolon

* Fixes to Camera2 API:

- First change is related to camera selection by ID. Some more code was required to correctly set the facing flag and characteristics
- Second change fixes a previous issue (unrelated to the PR) that was causing the preview of the camera to look upside down on rotated devices. Device rotation should not affect the display (nor set it). Device rotation should however be used for the final image (and not screen rotation). Some code was borrowed from Camera1.
2019-09-24 10:47:23 -03:00
cristianoccazinsp
702f60862e fix(android): Update Camera1 to not crash on invalid ratio (#2501)
Setting a property ends up with an unhandled exception that cannot be caught easily by RN. This should also make the behaviour consistent with camera startup and Camera2.
2019-09-24 09:32:47 -03:00
cristianoccazinsp
a20eb06139 feat(android): Improve Android Camera1 error and concurrency handling. (#2471)
These changes include the following:
- use atomic boolean for capturing photo flag just like video
- add more exception catching and checks
- raise error instead of failing silently if can't capture photo - improve error handling here
- synchronize stop to avoid race conditions and crashes
- delay params updates (surface) if capturing or recording to avoid bugs
- do not allow video or photo capture if already doing video or photo
2019-09-09 09:15:41 -03:00
luancurti
1d6a2ef945 chore(gradle): upgrade gradle version 2019-09-08 22:01:50 -03:00
cristianoccazinsp
57bf513d5b fix(android): Fix app freeze on app/host pause on Android. Fix is quite simple, recording has to be stopped before the camera preview. (#2467)
Fix taken from: https://stackoverflow.com/questions/8914454/mediarecorder-stop-hanging-with-android-4-0-ics/18876200

TODO: Review Camera2 implementation since it might have the same issue.
2019-09-05 17:59:57 -03:00
cristianoccazinsp
497e4a21d8 fix(android): Add an additional error check to avoid crashes on Android. This fix comes from testing on multiple devices, where for some unknown reason the decode process fails and returns null and the app crashes immediately due to a null pointer exception. This attempts to handle this issue more gracefully. (#2446) 2019-09-02 15:29:17 -03:00
joshslark
0323eaa47b fix(android): android-mlkit barcode bounds are inaccurate (#2462) 2019-09-02 09:42:59 -03:00
Dominik Schwarz
ccd6f0b57c feat(android): Add exposure (brightness) support for iOS and standardize exposure value (#2419)
* Use standardized exposure value between 0 and 1

* Add iOS native exposure control

* Delete logging

* Add documentation + spell fixes

* Update RNCamera.m

* Remove reset of exposure after tap-to-focus
2019-08-22 15:38:53 -03:00
cristianoccazinsp
3407533108 fix(android): This update does two things in order to fix #2420 and #2421. (#2427)
First, it updates the take picture call to capture right away instead of trying to focus again. This will match closer to what the native camera does, and also what the Camera2 does.

Secondly, it removes all calls to resetFocus after capturing and after a given timeout. This was causing issues when using autoFocusPointOfInterest, and it really didn't make sense to use an internal timeout to reset the focus. If anything, the user should do this from the JS side. A new method could also be exposed to do this.

Lastly, it adds some error catching logic to the autoFocus call. There was a chance on some devices that calling autoFocus while the device is capturing a photo that it would fail.

Tested on Google Pixel 2 (Android 9), Motorola G5 (Android 8), Samsung Grand Prime (Android 5?), and LG20 (android 6?). No issues so far.
2019-08-17 18:40:37 -03:00
TVMD
efb6b90036 feat(android): get format for android (#2410) 2019-08-07 17:54:10 -03:00
Dominik Schwarz
c93e92f602 fix(android): use initial exposure value (#2418) 2019-08-07 17:47:43 -03:00
Valentin
c748b4eccc fix(android): Support writing custom Exif tags to modified image file (#2402) 2019-08-02 11:10:10 -03:00
Hanno Fellmann
66e99d8027 fix(exif): writing EXIF data with correct data type (#2396) 2019-08-02 11:09:50 -03:00
Valentin
3786223db2 fix(android): prevent crash when using Camera2 with autoFocusPointOfInterest (#2401) 2019-08-02 11:08:38 -03:00
Laurin Quast
409d2a9eea break(androidX): upgrading to sdk 28 and androidx (#2068) (#2306)
* upgrading to sdk 28 and androidx

* revert attempt to fix build

* fixing build

* build version fix

* updating example app

* manifest update

* using stable release, instead of beta

* androidx migration doc

* migration doc update

* follow on androidx upgrade after rebase
2019-07-14 16:08:03 -03:00
Laurin Quast
72a8d7f34c
fix: revert breaking change upgrading to sdk 28 and androidx
This reverts commit e2a895ad1c.
2019-06-06 21:00:59 +02:00
Antonio Grass
1897633966 fix setParameters error (#2288)
* add try catch runtime in setParameters

* fix add log

* fix log names
2019-06-02 16:21:59 -03:00
Greg Alexander
e2a895ad1c feat(androidX): upgrading to sdk 28 and androidx (#2068)
* upgrading to sdk 28 and androidx

* revert attempt to fix build

* fixing build

* build version fix

* updating example app

* manifest update

* using stable release, instead of beta

* androidx migration doc

* migration doc update

* follow on androidx upgrade after rebase
2019-06-02 16:20:57 -03:00
Valentin
8ad809ee88 feat(android): write Exif tags to modified image file (#2263) 2019-05-15 09:10:03 -03:00
psk200
481594c4c6 feat(android): added image details to payload (#2269) 2019-05-15 09:09:46 -03:00
Andre Seiji
60cc4ccf56 feat(android): Adding case 270 degrees to getFirebaseRotation method, according to FIrebase specs. (#2264) 2019-05-13 14:16:26 -03:00
Telmen
a6b619cb73 feat(android): front camera face detect (#2257) 2019-05-09 12:22:22 -03:00
Mathieu Acthernoene
2e529183c8 Ignore duplicate META files 2019-04-26 17:59:18 +02:00
Daniil Ovoshchnikov
1b9fb63e56 feat(mlkit): add mlkit barcode detection ios (#2209)
extend barcode type cases for android
2019-04-16 15:33:46 -03:00
hushicai
24df865ee2 fix(android): picture sizes not updated when ratio changed (#2204) 2019-04-11 09:11:25 -03:00
Daniil Ovoshchnikov
025e7d97a4 feat(ios): migrate face detection to mlkit (#2193)
add face detection using mlkit
add enable tracking prop
cleanup android set tracking methods
remove old face detection
fix basic example not building on ios
2019-04-11 09:10:19 -03:00
Daniil Ovoshchnikov
47469e7305 fix(android): replace assertion with a null check (#2194)
some android cleanup
2019-04-07 14:33:09 -03:00
Jose G
963c249399 fix(android): do not change camera rotation while video is being recorded (#2187) 2019-04-03 10:20:02 -03:00
Craig Tuttle
7bb9a1205c feat(android): autoFocusPointOfInterest, Camera & Camera2 (#1974)
* Android autoFocusPointOfInterest, Camera & Camera2

* updated example with touch to focus
2019-03-30 17:45:44 -03:00
Marius Reimer
d8922ac90e Upgrade to React Native 0.59.1 (#2162)
* Upgrade to React Native 0.59.1

* Fix CI

* Fix CI

* Fix CI

* Fix CI

* Fix CI

* Fix CI

* Fix CI

* Fix CI

* Fix CI
2019-03-28 18:08:43 -03:00
Yori Zhao
07f55ae102 fix(android): support inverted qrcode for RCTCamera (#2167) 2019-03-26 08:56:44 -03:00
Neha Gupta
ca35ac609d feat(exposure): adjustment support in Camera1(Camera API) (#2163) 2019-03-25 11:30:08 -03:00
Daniil Ovoshchnikov
d6485828fd fix(android): Android build error (#2152)
add link to version2 migration in main readme
2019-03-20 11:45:49 -03:00
NIkita Belobrov
e46b8573f8 fix(barcode): iniBarcodeReader (#2145) 2019-03-14 11:40:46 -03:00
Daniil Ovoshchnikov
0ab570a636 feat(mlkit): Migrate Face, Barcode and Text Recognition to Firebase MLKit (iOS - text, Android - all) (#2075)
* switch to firebase mlkit for text recognition

* migrate android to MLKit

migrate Text detection android to MLKit
update gradle of example app
Update build.gradle
separate gms vision facedetector to general flavor

migrate faceDetector to mlkit and fix incorrect bounds due to padding

migrate barCode detector to mlkit
update android instructions in readme
safe face implementation move gms to generalImplementation

* add mlkit example

setup android of mlkit example

setup ios of mlkit example
fix typo in readme
update example project readme

* amend mlkit migration to include raw data

add barcode detection in basic and mlkit examples

* fix duplicate bridgeDidBackground method

BREAKING CHANGE: We migrated to MLKit instead of Google Mobile Vision
2019-03-11 08:56:24 -03:00
Marius Reimer
1a89d7981a Feature: isRecordingInterrupted video promise property (#2007)
* feat(rn-camera): add isRecordingInterrupted return property

* docs(rn-camera): added isRecordingInterrupted description

* Merge branch 'master' into feat-isRecordingInterrupted
2019-03-10 14:51:51 -03:00
Shashank Kushwah
9d56a21ddc [Android] Expose barcode bounds and source dimension from google vision barcode scanner (#2095)
* added react-navigation

* added barcode scanner example

* exposed barcode bounds and source dimensions in google vision barcode

* updated typescript types for google vision barcode
2019-03-09 11:41:15 -03:00
Sergey
aded9a4c4e [Android] Expose rawValue from google vision barcode scanner (#2087)
* Expose rawValue from google vision barcode scanner

* Rename rawValue to rawData
2019-03-09 11:40:01 -03:00
Yori Zhao
e2cdad56a7 feat(android): support inverted qrcode (#2135) 2019-03-08 11:19:05 -03:00