Open UmarBhutta opened 5 years ago
@UmarBhutta thanks for the issue. To help us better diagnose could you provide some more information about your setup.
captureImage
.Closing this issue for now, I'll reopen when you respond with the information. Thanks again!
It can happen even when not clicking fast, just calling it several time in a row will break the captureImage randomly. By breaking I mean the callback is not called anymore and the camera also doesn't make the auto focus. I tried calling camera.onPause() camera.onStop() camera.onStart() camera.onResume() and camera.captureImage again but the callback is still not called.
<com.camerakit.CameraKitView
android:id="@+id/camera"
android:layout_width="0dp"
android:layout_height="0dp"
android:fitsSystemWindows="true"
android:keepScreenOn="true"
app:camera_focus="continuous"
app:camera_imageJpegQuality="100"
app:camera_imageMegaPixels="2.0"
app:camera_permissions="camera"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
override fun onStart() {
super.onStart()
camera.onStart()
}
override fun onResume() {
super.onResume()
camera.onResume()
}
private fun setupCamera() {
camera.errorListener = CameraKitView.ErrorListener { _, cameraException ->
Log.e("Taking picture", "error")
}
button.setOnClickListener {
Log.e("Taking picture", "trying to take a picture")
camera.captureImage { _, image ->
Log.e("Taking picture", "callback called")
imageCaptured(image)
}
}
}
Thank you!
Confirming - Pixel 3XL. Android 9. When I capture a couple times in a row, no callbacks are called from CameraKit. Not from captureImage, nor errorListener.
Interesting fact - when you stack "clicks", take app to background and bring it back, callback is delivered with the latest captured image.
Here are some random logs pointing on CamX:
2018-12-13 18:09:45.651 1164-1223/? E/libprocessgroup: Error encountered killing process cgroup uid 99085 pid 8676: No such file or directory
2018-12-13 18:09:46.599 821-821/? E/lowmemorykiller: /dev/memcg/apps/uid_10157/pid_11303/memory.stat open failed: No such file or directory
2018-12-13 18:09:47.189 12521-12732/? E/Spotify: [Picasso-] Failed to loaded image: -> content://com.spotify.music/image/
2018-12-13 18:09:47.582 12521-12521/? E/Spotify: [main] Failed to load image with uri: "".
java.lang.IllegalArgumentException: Expected URL scheme 'http' or 'https' but no colon was found
at aavo.a(SourceFile:1325)
at aavn.f(SourceFile:916)
at aawa.a(SourceFile:165)
at gro.a(SourceFile:121)
at yyk.a(SourceFile:44)
at zdm.a(SourceFile:206)
at zdm.run(SourceFile:159)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:458)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:764)
at zfd.run(SourceFile:411)
2018-12-13 18:09:47.617 821-821/? E/lowmemorykiller: /dev/memcg/apps/uid_10027/pid_8982/memory.stat open failed: No such file or directory
2018-12-13 18:09:47.926 821-821/? E/lowmemorykiller: /dev/memcg/apps/uid_10024/pid_11258/memory.stat open failed: No such file or directory
2018-12-13 18:09:53.156 12933-12933/? E/tunein.player: Not starting debugger since process cannot load the jdwp agent.
2018-12-13 18:09:53.418 821-821/? E/lowmemorykiller: /dev/memcg/apps/uid_10073/pid_11869/memory.stat open failed: No such file or directory
2018-12-13 18:09:53.811 12933-12933/? E/tunein.player: Invalid ID 0x00000000.
2018-12-13 18:09:56.744 821-821/? E/lowmemorykiller: /dev/memcg/apps/uid_10168/pid_11444/memory.stat open failed: No such file or directory
2018-12-13 18:10:09.084 799-2141/? E/libperfmgr: Failed to write to node: /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq with value: 1996800, fd: 19
2018-12-13 18:10:09.117 821-821/? E/lowmemorykiller: /dev/memcg/apps/uid_10179/pid_9136/memory.stat open failed: No such file or directory
2018-12-13 18:10:09.164 821-821/? E/lowmemorykiller: /dev/memcg/apps/uid_10031/pid_8068/memory.stat open failed: No such file or directory
2018-12-13 18:10:09.428 623-623/? E/libc: Access denied finding property "vendor.debug.egl.swapinterval"
2018-12-13 18:10:09.976 623-623/? E/libc: Access denied finding property "vendor.debug.egl.swapinterval"
2018-12-13 18:10:09.991 623-623/? E/libc: Access denied finding property "vendor.debug.egl.swapinterval"
2018-12-13 18:10:10.008 623-623/? E/libc: Access denied finding property "vendor.debug.egl.swapinterval"
2018-12-13 18:10:10.024 623-623/? E/libc: Access denied finding property "vendor.debug.egl.swapinterval"
2018-12-13 18:10:10.042 623-623/? E/libc: Access denied finding property "vendor.debug.egl.swapinterval"
2018-12-13 18:10:10.058 623-623/? E/libc: Access denied finding property "vendor.debug.egl.swapinterval"
2018-12-13 18:10:10.074 623-623/? E/libc: Access denied finding property "vendor.debug.egl.swapinterval"
2018-12-13 18:10:10.075 785-1282/? E/native: easel_manager_callback.cc:35 COMMAND_PROCESSOR_3PA on easel exited0
2018-12-13 18:10:10.131 785-1282/? E/libc: Access denied finding property "ro.camera.req.fmq.size"
2018-12-13 18:10:10.132 785-1282/? E/libc: Access denied finding property "ro.camera.res.fmq.size"
2018-12-13 18:10:10.160 785-1282/? E/CamX: [ERROR][HAL ] camxchicontext.cpp:3826 CloneNodeProperties() No memory allocated for pNodeProperties
2018-12-13 18:10:10.160 785-1282/? E/CamX: [ERROR][HAL ] camxchicontext.cpp:3826 CloneNodeProperties() No memory allocated for pNodeProperties
2018-12-13 18:10:10.161 785-1282/? E/GOOGLE_CHINODE_HDRPLUS: CHINODECAPSINFO is smaller than expected
2018-12-13 18:10:10.162 785-13462/? E/libc: Access denied finding property "persist.gcam.debug"
2018-12-13 18:10:10.162 785-13462/? E/libc: Access denied finding property "persist.gcam.save_text"
2018-12-13 18:10:10.162 785-13462/? E/libc: Access denied finding property "persist.gcam.save_metering"
2018-12-13 18:10:10.162 785-13462/? E/libc: Access denied finding property "persist.gcam.save_payload"
2018-12-13 18:10:10.162 785-13462/? E/CameraMetadataUtils: InitializeLensGcamGeometricCalibration: 335: distortion is NULL.
2018-12-13 18:10:10.163 785-1282/? E/CamX: [ERROR][HAL ] camxchicontext.cpp:3826 CloneNodeProperties() No memory allocated for pNodeProperties
2018-12-13 18:10:10.163 785-1282/? E/CamX: [ERROR][HAL ] camxchicontext.cpp:3826 CloneNodeProperties() No memory allocated for pNodeProperties
2018-12-13 18:10:10.189 785-1282/? E/CamX: [ERROR][HAL ] camxmetadatapool.cpp:1600 SetMetadataByTag() Invalid slot; cannot set metadata tag 80080003
2018-12-13 18:10:10.189 785-1282/? E/CamX: [ERROR][HAL ] camxmetadatapool.cpp:1763 PublishMetadataList() Invalid slot, cannot publish metadata list
2018-12-13 18:10:10.278 785-1282/? E/CamX: [ERROR][STATS ] camxaecengine.cpp:3876 FillLEDCalibrationDataInput() No LED calibration data
2018-12-13 18:10:10.280 785-1282/? E/CamX: [ERROR][STATS ] gcamfastaeutil.cpp:1154 SetTuningData() [FastAE] ERROR! Failed to get the tuning data
2018-12-13 18:10:10.280 785-1282/? E/CamX: [ERROR][HAL ] camxmetadatapool.cpp:1447 GetMetadataByTag() Invalid Slot to get a metadata from
2018-12-13 18:10:10.280 785-1282/? E/CamX: [ERROR][HAL ] camxmetadatapool.cpp:1447 GetMetadataByTag() Invalid Slot to get a metadata from
2018-12-13 18:10:10.280 785-1282/? E/CamX: [ERROR][STATS_AEC] aec_led_calibration.cpp:560: aec_led_cal_apply_calibration Invalid pointer 0x723eb4e000 0x0
2018-12-13 18:10:10.280 785-1282/? E/CamX: [ERROR][STATS_AEC] aec_set.cpp:1346: aec_set_fps_range Aec_Error invalid input 0
2018-12-13 18:10:10.280 785-1282/? E/CamX: [ERROR][STATS ] camxae.cpp:2080 AECSetSensorInfo() Wrong initial sequence from HAL!
2018-12-13 18:10:10.280 785-1282/? E/CamX: [ERROR][STATS_AEC] aec_get.cpp:777: aec_get_param GET_EXP_PARAMS ERROR, Uninitialized exposure settings requested
2018-12-13 18:10:10.280 785-1282/? E/CamX: [ERROR][HAL ] camxmetadatapool.cpp:1447 GetMetadataByTag() Invalid Slot to get a metadata from
2018-12-13 18:10:10.280 785-1282/? E/CamX: [ERROR][HAL ] camxmetadatapool.cpp:1447 GetMetadataByTag() Invalid Slot to get a metadata from
2018-12-13 18:10:10.280 785-1282/? E/CamX: [ERROR][STATS_AEC] camxcaecstatsprocessor.cpp:1710 PopulatePropPoolFrameControl() Invalid exposure parameters: gain: 1.000000, exposureTime: 0
2018-12-13 18:10:10.280 785-1282/? E/CamX: [ERROR][HAL ] camxmetadatapool.cpp:1447 GetMetadataByTag() Invalid Slot to get a metadata from
2018-12-13 18:10:10.280 785-1282/? E/CamX: [ERROR][HAL ] camxmetadatapool.cpp:1447 GetMetadataByTag() Invalid Slot to get a metadata from
2018-12-13 18:10:10.280 785-1282/? E/CamX: [ERROR][HAL ] camxsession.cpp:3537 GetIntraRealtimePipelineId() Less than two realtime pipelines, no intra result
2018-12-13 18:10:10.280 785-1282/? E/CamX: [ERROR][STATS_AWB] camxcawbioutil.cpp:2527 FillLEDCalibrationDataInput() No LED calibration data
2018-12-13 18:10:10.284 785-1282/? E/CamX: [ERROR][STATS_AWB] awb_interface.cpp:1480: awb_interface_set_dualcam_calibration_data No dualcam calibration data
2018-12-13 18:10:10.284 785-1282/? E/GoogTuning: Error! Unsupported tuning mode (usecase: 65535, sensorMode: 65535) - using the default tuning header instead
2018-12-13 18:10:10.303 785-1282/? E/CamX: [ERROR][HAL ] camxsession.cpp:3537 GetIntraRealtimePipelineId() Less than two realtime pipelines, no intra result
2018-12-13 18:10:10.313 785-1282/? E/CamX: [ERROR][HAL ] camxsession.cpp:3537 GetIntraRealtimePipelineId() Less than two realtime pipelines, no intra result
2018-12-13 18:10:10.313 785-1282/? E/GoogTuning: Error! Unsupported tuning mode (usecase: 65535, sensorMode: 65535) - using the default tuning header instead
2018-12-13 18:10:10.313 785-1282/? E/CamX: [ERROR][HAL ] camxsession.cpp:3537 GetIntraRealtimePipelineId() Less than two realtime pipelines, no intra result
2018-12-13 18:10:10.313 785-1282/? E/CamX: [ERROR][STATS_AF] camxautofocusnode.cpp:983 InitializeMultiStats() FATAL: Failed to get peer pipeline ID!
2018-12-13 18:10:10.343 785-1276/? E/CamX: [ERROR][STATS_AF] pdlib_lcr_utils.cpp:136 pdaf_lcr_get_vertical_blocks() Cound not find a good partition, set mega_block_y = 1
2018-12-13 18:10:10.372 785-1282/? E/CamX: [ERROR][HAL ] camxmetadatapool.cpp:1447 GetMetadataByTag() Invalid Slot to get a metadata from
2018-12-13 18:10:10.461 785-1276/? E/CamX: [ERROR][STATS_AF] camxcafioutil.cpp:904 ReadAECInput() PropertyIDAECInternal null data
2018-12-13 18:10:10.461 785-1276/? E/CamX: [ERROR][STATS_AF] camxcafioutil.cpp:931 ReadAECInput() PropertyIDAECFrameInfo null data
2018-12-13 18:10:10.461 785-1278/? E/CamX: [ERROR][STATS_AEC] aec_led_calibration.cpp:560: aec_led_cal_apply_calibration Invalid pointer 0x723eb4e000 0x0
2018-12-13 18:10:10.461 785-1278/? E/CamX: [ERROR][STATS_AEC] aec_set.cpp:1346: aec_set_fps_range Aec_Error invalid input 414
2018-12-13 18:10:10.461 785-1278/? E/CamX: [ERROR][STATS_AEC] camxcaecstatsprocessor.cpp:1628 SetAlgoBayerHistValue() Unsupported bayer hist channel!
2018-12-13 18:10:10.461 785-1278/? E/CamX: [ERROR][STATS ] camxcaecstatsprocessor.cpp:3151 ProcessRequestFastAE() [FastAE] Failed to apply gain to the stats!
2018-12-13 18:10:10.461 785-1278/? E/CamX: [ERROR][STATS_AEC] aec_process.cpp:1229: aec_process_stats_parsing aec is null or invalid
2018-12-13 18:10:10.461 785-1278/? E/CamX: [ERROR][STATS_AEC] aec_process.cpp:7977: aec_process_preview_and_video Error: invalid stats
2018-12-13 18:10:10.465 785-1276/? E/CamX: [ERROR][STATS ] gcamfastaestats.cpp:80 Create() [FastAE] Failed to create the FastAEStats object
2018-12-13 18:10:10.465 785-1276/? E/CamX: [ERROR][STATS ] camxcaecstatsprocessor.cpp:3137 ProcessRequestFastAE() [FastAE] ISP gain calculation failed!
2018-12-13 18:10:10.465 785-1276/? E/CamX: [ERROR][STATS ] camxcaecstatsprocessor.cpp:3151 ProcessRequestFastAE() [FastAE] Failed to apply gain to the stats!
2018-12-13 18:10:10.465 785-1276/? E/CamX: [ERROR][STATS_AEC] aec_process.cpp:1229: aec_process_stats_parsing aec is null or invalid
2018-12-13 18:10:10.465 785-1276/? E/CamX: [ERROR][STATS_AEC] aec_process.cpp:7977: aec_process_preview_and_video Error: invalid stats
2018-12-13 18:10:10.468 785-1275/? E/CamX: [ERROR][STATS ] gcamfastaestats.cpp:80 Create() [FastAE] Failed to create the FastAEStats object
2018-12-13 18:10:10.468 785-1275/? E/CamX: [ERROR][STATS ] camxcaecstatsprocessor.cpp:3137 ProcessRequestFastAE() [FastAE] ISP gain calculation failed!
2018-12-13 18:10:10.468 785-1275/? E/CamX: [ERROR][STATS ] camxcaecstatsprocessor.cpp:3151 ProcessRequestFastAE() [FastAE] Failed to apply gain to the stats!
2018-12-13 18:10:10.469 785-1275/? E/CamX: [ERROR][STATS_AEC] aec_process.cpp:1229: aec_process_stats_parsing aec is null or invalid
2018-12-13 18:10:10.469 785-1275/? E/CamX: [ERROR][STATS_AEC] aec_process.cpp:7977: aec_process_preview_and_video Error: invalid stats
2018-12-13 18:10:10.471 785-1279/? E/CamX: [ERROR][STATS ] gcamfastaestats.cpp:80 Create() [FastAE] Failed to create the FastAEStats object
2018-12-13 18:10:10.471 785-1279/? E/CamX: [ERROR][STATS ] camxcaecstatsprocessor.cpp:3137 ProcessRequestFastAE() [FastAE] ISP gain calculation failed!
2018-12-13 18:10:10.471 785-1279/? E/CamX: [ERROR][STATS ] camxcaecstatsprocessor.cpp:3151 ProcessRequestFastAE() [FastAE] Failed to apply gain to the stats!
2018-12-13 18:10:10.471 785-1279/? E/CamX: [ERROR][STATS_AEC] aec_process.cpp:1229: aec_process_stats_parsing aec is null or invalid
2018-12-13 18:10:10.471 785-1279/? E/CamX: [ERROR][STATS_AEC] aec_process.cpp:7977: aec_process_preview_and_video Error: invalid stats
2018-12-13 18:10:10.577 785-1278/? E/CamX: [ERROR][CORE ] camxnode.cpp:2107 GetDataCountFromPipeline() Attempting to get metadata count for tag a04f0005 when unpublished
2018-12-13 18:10:10.798 785-1275/? E/CamX: [ERROR][JPEG ] camxjpegexifparams.cpp:984 GetEXIFExposure() ASD Output:NULL
2018-12-13 18:10:12.628 799-2141/? E/libperfmgr: Failed to write to node: /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq with value: 1996800, fd: 19
2018-12-13 18:10:16.378 785-1277/? E/CamX: [ERROR][JPEG ] camxjpegexifparams.cpp:984 GetEXIFExposure() ASD Output:NULL
2018-12-13 18:10:16.412 785-1279/? E/CamX: [ERROR][JPEG ] camxjpegexifparams.cpp:984 GetEXIFExposure() ASD Output:NULL
2018-12-13 18:10:16.444 785-1277/? E/CamX: [ERROR][JPEG ] camxjpegexifparams.cpp:984 GetEXIFExposure() ASD Output:NULL
2018-12-13 18:10:16.510 785-1278/? E/CamX: [ERROR][JPEG ] camxjpegexifparams.cpp:984 GetEXIFExposure() ASD Output:NULL
2018-12-13 18:10:16.589 785-1275/? E/CamX: [ERROR][HAL ] camxmetadatapool.cpp:1447 GetMetadataByTag() Invalid Slot to get a metadata from
2018-12-13 18:10:16.589 785-1275/? E/CamX: [ERROR][HAL ] camxmetadatapool.cpp:1447 GetMetadataByTag() Invalid Slot to get a metadata from
2018-12-13 18:10:16.591 785-1275/? E/CamX: [ERROR][HAL ] camxmetadatapool.cpp:1447 GetMetadataByTag() Invalid Slot to get a metadata from
2018-12-13 18:10:16.591 785-1275/? E/CamX: [ERROR][HAL ] camxmetadatapool.cpp:1447 GetMetadataByTag() Invalid Slot to get a metadata from
2018-12-13 18:10:16.595 785-1278/? E/CamX: [ERROR][HAL ] camxmetadatapool.cpp:1447 GetMetadataByTag() Invalid Slot to get a metadata from
2018-12-13 18:10:16.596 785-1278/? E/CamX: [ERROR][HAL ] camxmetadatapool.cpp:1447 GetMetadataByTag() Invalid Slot to get a metadata from
2018-12-13 18:10:16.597 785-1279/? E/CamX: [ERROR][HAL ] camxmetadatapool.cpp:1447 GetMetadataByTag() Invalid Slot to get a metadata from
2018-12-13 18:10:16.597 785-1279/? E/CamX: [ERROR][HAL ] camxmetadatapool.cpp:1447 GetMetadataByTag() Invalid Slot to get a metadata from
2018-12-13 18:10:16.598 785-1279/? E/CamX: [ERROR][JPEG ] camxjpegexifparams.cpp:970 GetEXIFExposure() AEC Exposure Info:NULL
2018-12-13 18:10:16.598 785-1279/? E/CamX: [ERROR][JPEG ] camxjpegexifparams.cpp:984 GetEXIFExposure() ASD Output:NULL
2018-12-13 18:10:18.144 799-2141/? E/libperfmgr: Failed to write to node: /sys/devices/system/cpu/cpu4/cpufreq/scaling_max_freq with value: 1996800, fd: 19
2018-12-13 18:10:21.512 1164-1234/? E/libc: Access denied finding property "vendor.debug.egl.changepixelformat"
2018-12-13 18:10:21.568 902-1139/? E/fpc_tac: fpc_irq_wait_reset error FPC_ERROR_CANCELLED
2018-12-13 18:10:21.629 1164-1234/? E/libc: Access denied finding property "vendor.debug.egl.swapinterval"
2018-12-13 18:10:21.695 1164-1234/? E/libc: Access denied finding property "vendor.debug.egl.swapinterval"
2018-12-13 18:10:21.712 1164-1234/? E/libc: Access denied finding property "vendor.debug.egl.swapinterval"
2018-12-13 18:10:21.762 1164-1234/? E/libc: Access denied finding property "vendor.debug.egl.swapinterval"
2018-12-13 18:10:21.779 1164-1234/? E/libc: Access denied finding property "vendor.debug.egl.swapinterval"
2018-12-13 18:10:21.795 1164-1234/? E/libc: Access denied finding property "vendor.debug.egl.swapinterval"
2018-12-13 18:10:21.812 1164-1234/? E/libc: Access denied finding property "vendor.debug.egl.swapinterval"
2018-12-13 18:10:21.828 1164-1234/? E/libc: Access denied finding property "vendor.debug.egl.swapinterval"
2018-12-13 18:10:21.846 1164-1234/? E/libc: Access denied finding property "vendor.debug.egl.swapinterval"
2018-12-13 18:10:21.861 1164-1234/? E/libc: Access denied finding property "vendor.debug.egl.swapinterval"
2018-12-13 18:10:21.913 1164-1234/? E/libc: Access denied finding property "vendor.debug.egl.swapinterval"
2018-12-13 18:10:21.928 1164-1234/? E/libc: Access denied finding property "vendor.debug.egl.swapinterval"
2018-12-13 18:10:21.961 1164-1234/? E/libc: Access denied finding property "vendor.debug.egl.swapinterval"
2018-12-13 18:10:21.980 1164-1234/? E/libc: Access denied finding property "vendor.debug.egl.swapinterval"
2018-12-13 18:10:22.078 1164-1234/? E/libc: Access denied finding property "vendor.debug.egl.swapinterval"
2018-12-13 18:10:22.481 785-1284/? E/native: easel_manager_callback.cc:35 COMMAND_PROCESSOR_3PA on easel exited0
2018-12-13 18:10:22.716 797-2626/? E/NxpTml: _i2c_write() errno : 5
2018-12-13 18:10:22.716 797-2626/? E/NxpTml: PN54X - Error in I2C Write.....
2018-12-13 18:10:22.716 797-2628/? E/NxpHal: write error status = 0x1ff
2018-12-13 18:10:22.716 797-797/? E/NxpHal: write_unlocked failed - PN54X Maybe in Standby Mode - Retry
2018-12-13 18:10:22.737 2506-2506/? E/libnfc_nci: [ERROR:NativeNfcTag.cpp(801)] nativeNfcTag_doDisconnect: tag already deactivated
2018-12-13 18:10:22.769 13831-13831/? E/roid.apps.scon: Not starting debugger since process cannot load the jdwp agent.
2018-12-13 18:10:22.772 2565-2565/? E/LibSecureUISvc: svc_sock_send_message(suisvc): invalid remote socket suitch
2018-12-13 18:10:22.772 2565-2565/? E/LibSecureUISvc: svc_sock_send_message(suisvc): invalid remote socket suilst
XML
<com.camerakit.CameraKitView
android:id="@+id/cameraView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center|top"
android:adjustViewBounds="true"
app:camera_aspectRatio="1" />
Implementation:
public class MainActivity extends ClassifierActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
cameraView = findViewById(R.id.cameraView);
}
@Override
protected void onStart() {
super.onStart();
cameraView.onStart();
}
@Override
protected void onResume() {
super.onResume();
cameraView.onResume();
}
@Override
protected void onPause() {
cameraView.onPause();
super.onPause();
}
@Override
protected void onStop() {
cameraView.onStop();
super.onStop();
}
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
cameraView.onRequestPermissionsResult(requestCode, permissions, grantResults);
}
public void onDetectClick(View v) {
cameraView.captureImage((cameraKitView, picture) -> onNewImageByteArray(picture));
}
public void onNewImageByteArray(byte[] pictureBytesArray) {
//...
}
}
Same problem here. After import the library as module in my project, I finally avoid this issue by change
@Synchronized
override fun capturePhoto(callback: (jpeg: ByteArray) -> Unit) {
this.photoCallback = callback
if (cameraFacing == CameraFacing.BACK) {
lockFocus()
} else {
captureStillPicture()
}
}
by
@Synchronized
override fun capturePhoto(callback: (jpeg: ByteArray) -> Unit) {
this.photoCallback = callback
if (cameraFacing == CameraFacing.BACK) {
captureStillPicture()
} else {
captureStillPicture()
}
}
in Camera2.kt
, but this is clearly not a good solution.
Any news @emersoncloud ? Thanks
@emersoncloud it is happening on Samsung J7 pro.
My implementation is simple that is
mCameraView!!.captureImage { cameraKitView, bytes -> handleImageCaptureCalls(bytes) }
and xml is <com.camerakit.CameraKitView android:id="@+id/camera" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_alignParentStart="true" android:layout_alignParentTop="true" android:layout_marginStart="0dp" android:layout_marginTop="0dp" android:layout_marginEnd="0dp" android:layout_marginBottom="0dp" android:adjustViewBounds="true" android:background="@color/colorPrimaryDark" android:clickable="false" android:keepScreenOn="true" app:camera_aspectRatio="1" app:camera_facing="back" app:camera_flash="auto" app:camera_focus="continuous" app:camera_imageMegaPixels="3.2" app:camera_permissions="camera" app:camera_zoomFactor="1.2" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent">
</com.camerakit.CameraKitView>
while version i am using is implementation 'com.camerakit:camerakit:1.0.0-beta3.10' implementation 'com.camerakit:jpegkit:0.1.0' implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.0' implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.0.0'
can you guide me how to solve it
Same here, Pixel XL, Android 9
versions.camerakit_library = "1.0.0-beta3.10"
versions.camerakit_jpegkit = "0.1.0"
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.camerakit.CameraKitView
android:id="@+id/cameraKitView"
android:layout_width="0dp"
android:layout_height="0dp"
android:adjustViewBounds="true"
android:keepScreenOn="true"
app:camera_flash="auto"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:camera_facing="back"
app:camera_focus="continuous"
app:camera_permissions="camera"/>
</androidx.constraintlayout.widget.ConstraintLayout>
build_versions.min_sdk = 19
build_versions.target_sdk = 28
build_versions.compile_sdk = 28
@UmarBhutta my experience lines up with your video
This is what I was seeing
@Synchronized override fun capturePhoto(callback: (jpeg: ByteArray) -> Unit) { this.photoCallback = callback if (cameraFacing == CameraFacing.BACK) { captureStillPicture() } else { captureStillPicture() } }
in
Camera2.kt
, but this is clearly not a good solution.
@MaximeMaravalLunabee I think my fix also fixes what you were doing
kinda fixed #504
@emersoncloud what do you think?
That CaptureStillImage from both the front and back camera fixes this problem for me also, but I assume there is a good reason it isn't supposed to work that way. Looks like when lockFocus
is called it's getting through to the captureCallback.process
section going down the STATE_WAITING_LOCK
path and in a situation where the afState is neither null, nor one of the focused_locked variants it hit the first waitingFrames++
and then never seemed to re-enter the callback.
Interestingly when I closed my phone screen the callback immediately got triggered repeatedly, first resulting in ramping up the waitingFrames
count until that triggered captureStillPicture()
and then continuing to be called afterwards, looping now endlessly through the runPreCaptureSequence
cycle in a way I would expect to eat through battery. Could it be that it is trying to run the preview and that somehow blocks this callback?
same issue on Nokia 7 plus (Android 9). With the code below the callback is triggered very randomly:
(camerakit:1.0.0-beta3.11, jpegkit:0.1.0)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_camera)
camera_kit_view.focus = CameraKit.FOCUS_AUTO
capture_fab.setOnClickListener {
camera_kit_view.captureImage(object: CameraKitView.ImageCallback {
override fun onImage(p0: CameraKitView?, byteImage: ByteArray?) {
Toast.makeText(this@CameraScanActivity,"You captured an image!", Toast.LENGTH_LONG).show()
scanQRCode(byteImage);
}
})
}
}
Same issue on Xiaomi 8, Android 9. This problem occurs after a few normal calls. Once the callback is not called, it will never be called again unless you re-enter the app. (camerakit:1.0.0-beta3.11, jpegkit:0.1.0)
XML:
<com.camerakit.CameraKitView
android:id="@+id/main_camerakitview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:keepScreenOn="true"
app:camera_facing="back"
app:camera_flash="auto"
app:camera_focus="continuous"
app:camera_permissions="camera">
</com.camerakit.CameraKitView>
Java code:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
cameraKitView = findViewById(R.id.main_camerakitview);
takephotoButton = findViewById(R.id.main_takephotobutton);
takephotoButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
cameraKitView.captureImage(new CameraKitView.ImageCallback() {
@Override
public void onImage(CameraKitView cameraKitView, byte[] bytes) {
Bitmap capturedBitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
capturedImageView.setImageBitmap(capturedBitmap);
String resultString = runModel(capturedBitmap);
resultTextView.setText(initialCapital(resultString));
progressBar.setVisibility(View.GONE);
}
});
}
});
Any update about this issue? I have the same problem.
As far as I see there is a Pull Request to solve this problem...
https://github.com/CameraKit/camerakit-android/pull/498
When will be available a release with this?
We are not ignoring this, and plan to be back in touch by next week. This is one of our biggest bugs we plan to resolve. Thanks for the healthy discussion around this!
Very nice, thank you for the update and also for the great work, this library is great!
Same here, capture Image is called very randomly OnePlus 5t
Hi any updates on this issue
sorry to ask, is this one already fixed in 3.12-expensify?
I have the same issue on HMD devices. Specifically HMD Global TA-1052. Android 9.
same issue
Samsung Galaxy S8, Android 9 - same issue.
Same problem here. After import the library as module in my project, I finally avoid this issue by change
@Synchronized override fun capturePhoto(callback: (jpeg: ByteArray) -> Unit) { this.photoCallback = callback if (cameraFacing == CameraFacing.BACK) { lockFocus() } else { captureStillPicture() } }
by
@Synchronized override fun capturePhoto(callback: (jpeg: ByteArray) -> Unit) { this.photoCallback = callback if (cameraFacing == CameraFacing.BACK) { captureStillPicture() } else { captureStillPicture() } }
in
Camera2.kt
, but this is clearly not a good solution.Any news @emersoncloud ? Thanks
¿How did you manage to import the library as a module?
Same issue here, very frustrating and I can't seem to find a way around it
Any updates for this issue?
I have the same issue with Samung S7.
Same issue here with Samsung S10. Any updates about it?
I think it might be because of the type of threading for me. I called it within asynctask, I'm trying to use Handler instead.
Same here Samsung S6
It works with Handler
@roya90 Can you show an exaple please?
I changed back to using the regular camera, but I found this link very helpful. https://www.youtube.com/watch?v=adPLIAnx9og
Essential Phone PH-1 Android 10 camerakit:1.0.0-beta3.11 same issue
Downgrading to beta3.10 worked for me.
Downgrading to beta3.10 worked for me.
Same, it works on my emulator now.
Same here with Nexus 5 and beta3.11.
@jtn-d go back to the original camera. Check out this link https://www.youtube.com/watch?v=adPLIAnx9og
Same here with Xiaomi 8, Android 9 and beta3.10 Is there any stable version, I just use the capture image function.
This is very long long issue and still not resolved. I do, have the same problem.
We are not ignoring this, and plan to be back in touch by next week. This is one of our biggest bugs we plan to resolve. Thanks for the healthy discussion around this!
The same problem on Honor 20. We are waiting for the fix for 6 months already.
Same issue here, it pretty a major issue.
Same effect with focus=continuous or focus=auto, no callback ever call to really take the photo as the library propose to.
Downgrading to 3.10 by:
implementation 'com.camerakit:camerakit:1.0.0-beta3.10'
implementation 'com.camerakit:jpegkit:0.1.0'
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.0'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.0.0'
Same issue here, it pretty a major issue.
Same effect with focus=continuous or focus=auto, no callback ever call to really take the photo as the library propose to.
Downgrading to 3.10 by:
implementation 'com.camerakit:camerakit:1.0.0-beta3.10' implementation 'com.camerakit:jpegkit:0.1.0' implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.0' implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.0.0'
thanks. i have same issue. -> Downgrading to 3.10
Same issue here, it pretty a major issue.
Same effect with focus=continuous or focus=auto, no callback ever call to really take the photo as the library propose to.
Downgrading to 3.10 by:
implementation 'com.camerakit:camerakit:1.0.0-beta3.10' implementation 'com.camerakit:jpegkit:0.1.0' implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.0' implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.0.0'
Thanks
Same issue here, it pretty a major issue.
Same effect with focus=continuous or focus=auto, no callback ever call to really take the photo as the library propose to.
Downgrading to 3.10 by:
implementation 'com.camerakit:camerakit:1.0.0-beta3.10' implementation 'com.camerakit:jpegkit:0.1.0' implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.0' implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.0.0'
Thanks, this also worked for me
when i downgrade to beta3.10, i got this error :
W/LegacyRequestMapper: convertRequestMetadata - control.awbRegions setting is not supported, ignoring value W/LegacyRequestMapper: Only received metering rectangles with weight 0. Only received metering rectangles with weight 0. W/LegacyRequestMapper: convertRequestMetadata - control.awbRegions setting is not supported, ignoring value Only received metering rectangles with weight 0. Only received metering rectangles with weight 0.
I have fixed in my case when remove this
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions,
int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
cameraKitView.onRequestPermissionsResult(requestCode, permissions, grantResults);
}
Couldn't take a picture using this library even with all answers above :[
same issue
Nokia6 Android9 is same issue
Xiaomi Redmi Note 8, same issue.
Downgrading to 3.10 solved the problem.
According to my problem, there is multiple activities open and in background. LG Nexus's prints error; multiple camera clients active. It is difficult to destruct activities from background, have tried many methods. Hopefully .onClose() really frees all allocated resources. Some explicit destroy()-method would be nice.
After updating my project with new version(1.0.0-beta3.10 and 3.9) of camerakit and migrating to kotlin 1.3.11 for and coroutines 1.0.0 rapid calling for the image capture callback is being lost. if you try to call captureImage method very quickly like clicking very fast. You will not get any callback for that click. Any suggestion?