Commit Graph

69 Commits

Author SHA1 Message Date
Nick Pomfret d54eae9ea5 Merge pull request #674 from just-football/master
[Fix] Image orientation bug when mirroring set to true
2017-04-26 09:44:57 +01:00
Abe Botros ae9eab3533 (android): Android tap-to-focus and improved (continuous) auto-focus (#575)
* Android tap-to-focus and improved (continuous) auto-focus

Tap-to-focus

- On tap, compute focus area around motion event's location, and pass this to the camera parameters
  as the new focus area.
- Adds RCTCameraUtils.java file, so far with only a single function that helps compute the focus area
  from a motion event. This file can serve as a location for utility constants and functions for the
  rest of the app, where such things can be extracted out.

Improved (continuous) auto-focus

- Use FOCUS_MODE_CONTINUOUS_PICTURE/VIDEO when possible to enable continuous auto-focus; fall back to
  FOCUS_MODE_AUTO otherwise, if able.

Other changes

- Update README to specify differences between iOS and Android for focus and zoom functionality.
- Update AndroidManifest with more thorough list of permissions and features.
- Update Example package.json react and react-native dependencies to match root package's package.json.

* Example: default empty onFocusChanged callback

- Enables default tap-to-focus behavior in Example app, facilitating
  testing of focus features in the Example app
2017-04-24 09:25:49 -07:00
Joshua Pinter e187b8a0e7 (android): Update compileSdkVersion to 25 and buildToolsVersion to 25.0.2 (#677)
* Update compileSdkVersion to 25 and buildToolsVersion to 25.0.2

Best to keep these up-to-date. Doesn't affect backwards compatibility.

* Add buildToolsVersion requirement of 25.0.2.
2017-04-23 12:38:42 -07:00
Rikard Franksson 8bccc77f65 Update RCTCameraModule.java 2017-04-21 13:44:43 +02:00
Nick Pomfret 5c54275aec android jpeg compression support (#658)
*  * removed some of the re-parsing of the output image byte array
 * removed re-saving of output file
 * moved image processing onto an async task to allow camera to be used while processing is running

* added jpeg compression support for android

* move explanation to correct bit of docs
2017-04-06 08:28:47 +02:00
Deividy Metheler 5097f95c6f android; wrap call to _camera.autoFocus into try/catch 2017-04-06 08:27:50 +02:00
Tomas Roos 4d2dcf74a5 Merge pull request #615 from NazarYablonskiy/master
Small, but important changes
2017-03-29 16:30:36 +02:00
Nick Pomfret 9fd9d1f8b1 (android): android performance improvements (#644)
* removed re-saving of output file
 * moved image processing onto an async task to allow camera to be used while processing is running
2017-03-24 00:00:56 -07:00
Nick Pomfret 98de15cf9a [android] add gps meta to android (#643)
* writing metadata.location (lat and lon coords only) to the exif data... and returning the internal url for the new image (which can be used in conjunction with the RN CameraRoll)

* just a tidy up to remove some duplication and fix some logging (no functional changes)

* oops, fix typo

* docs

* added mediaUri to ios so its the same as android
2017-03-23 08:41:01 -07:00
Nazar Yablonskiy b35f8fc3cb removed some `uses-permission` 2017-02-27 21:25:18 +02:00
Derek Hsu c12fd726a3 Fix barcode type ‘code128’ typo (#563) 2017-01-22 23:20:39 -08:00
Rob Stemen 12afd8443a Fixed issue where Android camera would crash the application if the user attempted to capture too many pictures in a short timeframe. (#553) 2017-01-22 19:33:17 -08:00
Nathan Ward f301331b15 [Android): fixes crashes related to orientation (#537) 2017-01-02 13:27:07 -08:00
Nicolas Charpentier 76963a0a5e Revert "Add video/audio authorization check for Android" (#516) 2016-12-14 17:18:15 -05:00
Üstün Ergenoglu 877ce2e6b2 Add video/audio authorization check for Android (#513)
* Add video/audio authorization check for Android

This only checks for the permission and no request is made. `PermissionAndroid` in recent React Native or manually asking it from native code can still be used.

* Add checkDeviceAuthorizationStatus
2016-12-14 09:52:25 -08:00
pkwak-sf f696610115 Fix issue with updating props quickly causing released camera object to be accessed. (#507) 2016-12-10 08:15:52 -05:00
Ron Heft b308d08e9a Race conditions initializing flashMode (#436)
* Fix race condition initializing Android camera

* Fix race condition initializing flashMode iOS
2016-12-08 21:05:35 -05:00
Benjamin Toueg 33bd0c4737 Android pinch to zoom (#498)
* Android pinch-to-zoom feature.

* Missing import.
2016-12-05 19:58:17 -05:00
Alexander Pantyuhov 06dc7ac5a7 Image orientation fix (#475, #309) (#493)
fix
2016-12-04 18:32:04 -05:00
Benjamin Toueg 3a20709f64 Minor: Remove duplicate if (#487) 2016-11-26 13:07:07 -05:00
Locly 154cb7aa58 Added Camera.constants.CaptureQuality.preview for android to allow the outputted image to be exactly the same as the previewed image (#449) 2016-11-21 19:41:19 -05:00
abrahambotros a2a6d028a4 Add 1080p, 720p, and 480p capture qualities. (#469)
* Add 1080p, 720p, and 480p capture qualities.

* Minor improvements for picture/video sizing.

- Minor refactoring for getting supported sizes (DRY).
- Add explicit pictureSize setting for 480p/720p/1080p in still/picture mode.

* Use util.Size objects for 480p/720p/1080p sizing.

- Note using Camera.Size objects would require a camera instance prior to creating the
  size objects, which would be manageable but not too clean.

* Remove 480p for iOS; 16:9/HD aspect ratio for Android 480p

- iOS only has a 640x480 480p-like AVCaptureSessionPreset, which is not the typical 16:9/HD aspect ratio
  desired. Removing this option as a result of this.
- Android 480p updated to use 16:9/HD aspect ratio.

* Add notes for (in)exact sizing for 1080p/720p/480p

* Re-add 480p on iOS, more notes on resolutions.

- Add notes on non-HD-aspect-ratio for iOS 480p.
- Add more explanation of variable resolution/sizes, especially for 480p on Android.

* Use custom Resolution class to hold 480p/720p/1080p resolution sizes

- Mistakenly used util.Size class before, which was not added until Android API level 21 (current
  min is 16).
2016-11-18 17:38:23 -05:00
abrahambotros b16ec4ab75 Minor Android MediaRecorder, sizing, and file improvements (#477)
Android MediaRecorder:
  - Most importantly, call Camera.unlock() before setting the camera on the
    MediaRecorder instance, and release() not just reset() when releasing the MediaRecorder
    instance!
  - Add comments and notes for preparing and releasing MediaRecorder instance.
  - Add onError callback for errors during recording session.

RCTCameraViewManager, RCTCamera, RCTCameraViewFinder, RCTCameraView:
  - Implement setCaptureMode, preparing camera based on captureMode. Currently, the only step that
    needs to be taken here is setting the recording hint for videos.
  - Handle setting _captureMode instance variable where applicable.

Sizing
  - Determine ViewFinder supported sizes based on actual captureMode (i.e., get supported picture
    sizes when in still capture mode, and get supported video sizes when in video capture mode).

Output files:
  - Get appropriate external storage public directory based on media type (image or video).
  - Minor variable renaming to indicate that both images or videos can be saved.

README:
  - Update captureTarget to indicate that cameraRoll is the actual default for both systems.
  - Small clarification for output data type for deprecated memory captureTarget output.
2016-11-17 22:25:51 -08:00
plougsgaard 05b5fc727d Support hints for a subset of the barcode types. 2016-09-15 21:30:00 +02:00
plougsgaard 918c00f003 Apply barcode scanner on preview frames. 2016-09-15 01:17:24 +02:00
plougsgaard 85336e9fd4 Import the zxing decoder library. 2016-09-15 01:16:20 +02:00
plougsgaard 2a33908c4f Expose the react application context as a singleton. 2016-09-15 01:16:19 +02:00
plougsgaard b5af30248e Add internal prop determining if barcode scanner is wanted. 2016-09-15 01:16:19 +02:00
Chris Duke d15022d560 Fix bug 357. Setting preview callback to null before camera release. (#410) 2016-09-13 14:17:45 -07:00
Gonzalo Aguirre 22f79985b2 Add missing dependency (#411)
* Add mirrorImage support for Android

* Release resources after mirroring

* Mirror image only for TYPE_FRONT

* Remove unnecessary annotation

* Document mirrorImage for Android

* Improved compression and error handling

* Add support for mirroring on Android back camera too
2016-09-13 14:16:27 -07:00
Gonzalo Aguirre b01c64e773 Mirror image for Android (#399)
* Add mirrorImage support for Android

* Release resources after mirroring

* Mirror image only for TYPE_FRONT

* Remove unnecessary annotation

* Document mirrorImage for Android

* Improved compression and error handling

* Add support for mirroring on Android back camera too
2016-09-13 09:48:48 -07:00
Marc Johnson 046970feca Android video flipped rotated #388 and activity pause support (#394)
* Initial commit with Android video support

* stopCapture now works

* Bug fixes and parameter enhancements.  README updated.

* Modified stopCapture parameter count to match iOS

* fixed promise bug on stopCapture

* Update RCTCameraModule.java

In Android preview and recording sizes are different, which can cause an error.  This fix detects the difference and chooses a recording resolution that matches.

* Update RCTCameraModule.java

* Update RCTCamera.java

Creating video functions in style/convention of existing

* Update RCTCameraModule.java

Use new functions for adjusting video capture size and quality

* Update RCTCameraModule.java

Fixes issue where file not video playable (readable) on older devices

* Update AndroidManifest.xml

Since we're reading and writing video and pictures, need permissions for it.

* Fixed upside down camera (on some platforms), and misc bugs and crashes

* Added camera-roll and capture to memory support, new options, and support for duration, filesize, and metadata

* To make merge nicer, temporarily reverting "Added camera-roll and capture to memory support, new options, and support for duration, filesize, and metadata"

This reverts commit 9ea1ad409c7e6121cf0197172e752b7523d4b092.

* Fixed merge & brought back all improvements from 9ea1ad4

* Fixed logic for video -> camera roll

* Updates

* Uncommenting setProfile

* Fix support for React Native 0.25

* Renamed Camera to index

* * Fix after merge android recording

* * Fixed android camera roll file saving
* Added recording to example

* * Android promise rejections with exceptions
* Fixed preview, video and photo sizes
* Android recording result in new, javascript object, format

* * Removed example.index.android.js as there is Example project

* * Readme for example

* don't force a specific codec

* always use cache dir

* * Using MediaScannerConnection instead of ACTION_MEDIA_SCANNER_SCAN_FILE intent

* * As described in https://github.com/lwansbrough/react-native-camera/pull/262#issuecomment-239622268:
- fixed video the wrong direction and recoder start fail at "low,medium" on the nexus 5 x

* Fix minor orientation bug with front recording on android

* (Android) Made video stop on activity pause

* Revert "Merge pull request #6 from Reaction-Framework/marcejohnson-master"

This reverts commit 8729c65a72af2afc8297e4a4de3c07a54da11580, reversing
changes made to 50416eb0daae447b822307f257c31a1cbc240a2c.

* Revert "Revert "Merge pull request #6 from Reaction-Framework/marcejohnson-master""

This reverts commit 4b87b48c7bd92840566ad76c96961325c2291ee0.

* replace System.console with Log.e (#390)
2016-09-12 20:29:14 -07:00
Kyle Corbitt 1e581d7c97 Set the device orientation before instantiating RCTCamera (#368) 2016-09-12 20:20:46 -07:00
dcmdestello 14836aef58 Fix setFlashMode was calling setTorchMode. (#396) 2016-09-05 10:36:07 -07:00
Kyle Corbitt 6834e594f4 adjusted rotation should be that of camera, not display (#393) 2016-09-03 12:35:09 -07:00
Kyle Corbitt 696d55af01 record method not documented, shouldn't be exposed (#392) 2016-09-03 12:34:18 -07:00
Kyle Corbitt a378edabbc replace System.console with Log.e (#390) 2016-09-01 11:55:22 -07:00
Marc Johnson e326d51a53 Android support for recording video (#262)
* Initial commit with Android video support

* stopCapture now works

* Bug fixes and parameter enhancements.  README updated.

* Modified stopCapture parameter count to match iOS

* fixed promise bug on stopCapture

* Update RCTCameraModule.java

In Android preview and recording sizes are different, which can cause an error.  This fix detects the difference and chooses a recording resolution that matches.

* Update RCTCameraModule.java

* Update RCTCamera.java

Creating video functions in style/convention of existing

* Update RCTCameraModule.java

Use new functions for adjusting video capture size and quality

* Update RCTCameraModule.java

Fixes issue where file not video playable (readable) on older devices

* Update AndroidManifest.xml

Since we're reading and writing video and pictures, need permissions for it.

* Fixed upside down camera (on some platforms), and misc bugs and crashes

* Added camera-roll and capture to memory support, new options, and support for duration, filesize, and metadata

* To make merge nicer, temporarily reverting "Added camera-roll and capture to memory support, new options, and support for duration, filesize, and metadata"

This reverts commit 9ea1ad409c7e6121cf0197172e752b7523d4b092.

* Fixed merge & brought back all improvements from 9ea1ad4

* Fixed logic for video -> camera roll

* Updates

* Uncommenting setProfile

* Fix support for React Native 0.25

* Renamed Camera to index

* * Fix after merge android recording

* * Fixed android camera roll file saving
* Added recording to example

* * Android promise rejections with exceptions
* Fixed preview, video and photo sizes
* Android recording result in new, javascript object, format

* * Removed example.index.android.js as there is Example project

* * Readme for example

* don't force a specific codec

* always use cache dir

* * Using MediaScannerConnection instead of ACTION_MEDIA_SCANNER_SCAN_FILE intent

* * As described in https://github.com/lwansbrough/react-native-camera/pull/262#issuecomment-239622268:
- fixed video the wrong direction and recoder start fail at "low,medium" on the nexus 5 x
2016-08-27 21:49:46 -04:00
Chad Wilken 1e092b5573 Check if console is not null as preferred by https://developer.android.com/reference/java/io/Console.html (#381) 2016-08-24 23:16:54 -07:00
Zack Story d4d1aec581 add z orientation comment, closes #308 2016-07-02 20:59:13 -07:00
gchiocchio 6f989a51bd Fix Z-Order issue child item Camera Android 2016-07-02 20:44:48 -07:00
Locly a7464cb194 Update AndroidManifest.xml (#275)
Made camera and autofocus properties optional so that devices without a camera/autofocus can continue to run
2016-05-10 11:06:07 -07:00
Radu-Marius Popovici 0c3dba1ff6 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
2016-05-10 11:05:03 -07:00
Zack Story c3ca7cbb03 Merge pull request #270 from lwansbrough/v1
v1 Updates
2016-04-27 20:34:46 -07:00
Zack Story 2dc43922dc
merge device orientation branch 2016-04-23 13:02:29 -07:00
Jason Brown 2a78d0e1d0 Add alias for photo (#268)
* Add alias for photo

* Map photo to high on android
2016-04-23 12:59:06 -07:00
Zack Story b0b2a0889d
[capture] fix android HashMap -> WritableMap 2016-04-23 12:45:45 -07:00
Zack Story 9162879305
[barcode] default barCodeTypes to [] if no barcode listener 2016-04-23 12:45:44 -07:00
Kyle Corbitt 0c789b8da0
capture returns metadata 2016-04-23 12:44:39 -07:00
cdimascio a6785cfa46
play shutter click sound on capture (android)
* play shutter click sound on capture (android)

* Add Property playSoundOnCapture to enable whether the default shutter sound is played on capture (Android)
2016-04-10 18:13:01 -07:00