Open bmacombe opened 3 years ago
Just wondering by looking at this issue, Do we have (or plan to have) UI Tests in this library similar to X.F? As it would help to test against Devices as a proactive measure rather than reactively fixing such issues.
@techduggu its something I'm definitely thinking about. But that won't help with this particular issue though:)
I'm having the same issue trying to Record Video on Xiaomi Mi Note 10
@jpd21122012 can you provide a repro? This will help us a ton to find a solution.
@jpd21122012 can you provide a repro? This will help us a ton to find a solution.
Sure. I'm working on the XFT Sample specifically on CameraViewPage.xaml, first of all the example doesn't work if you dont put on line 69 of the button the Clicked Event pointing to "DoCameraThings_Clicked", then trying to record (Start Recording) on button, on Android says something like the next image
So I double checked the permissions and it's not from that side, just some custom render on Android side specifically on "valid surfaces".
@jpd21122012 can you confirm if your branch is sync with our main branch?
@jpd21122012 can you confirm if your branch is sync with our main branch?
Yes it has the latest commit from 8 hours ago on Main Branch
@jpd21122012 yeah... I have an idea of what is the trouble. To don't leave you without an answer I can try to resume. As far as I know, when we select a wrong resolution (in other words a resolution that the device doesn't support) for the Camera it just throws an exception. In our case, our last commit fixed an issue with Pixel 2 because of that but breaks devices that don't support FullHD resolution.
If you try our last preview nuget I think that will work for you. Anyway, I'll do a PR ASAP to fix it. Thanks @jpd21122012 for reporting this for us.
BTW, @jpd21122012 are you using the video function, right?
BTW, @jpd21122012 are you using the video function, right?
Yes, on camera view i'm using the vídeo function to récord something
I'm also experiencing the same issue, on a Moto G4 device using the same sample camera view from the Camera sample as mentioned above.
@UKDeveloper99 can you share the log?
SurfaceTextureAvailable [Mono] Requesting loading reference 10 (of 11) of /storage/emulated/0/Android/data/com.cameratest/files/.override/Xamarin.CommunityToolkit.dll [Mono] Loading reference 10 of /storage/emulated/0/Android/data/com.cameratest/files/.override/Xamarin.CommunityToolkit.dll asmctx DEFAULT, looking for Xamarin.AndroidX.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
[CameraManagerGlobal] Connecting to camera service [DynamiteModule] Local module descriptor class for com.google.android.gms.vision.dynamite.ocr not found. [DynamiteModule] Considering local module com.google.android.gms.vision.dynamite.ocr:0 and remote module com.google.android.gms.vision.dynamite.ocr:0 [DynamiteModule] Considering local module com.google.android.gms.vision.ocr:0 and remote module com.google.android.gms.vision.ocr:1 [DynamiteModule] Selected remote version of com.google.android.gms.vision.ocr, version >= 1 [DynamiteModule] Dynamite loader version >= 2, using loadModule2NoCrashUtils [System] ClassLoader referenced unknown path: [Mono] DllImport searching in: '__Internal' ('(null)'). [Mono] Searching for 'java_interop_jnienv_is_assignable_from'. [Mono] Probing 'java_interop_jnienv_is_assignable_from'. [Mono] Found as 'java_interop_jnienv_is_assignable_from'. [ResourceType] ResTable_typeSpec entry count inconsistent: given 67, previously 69 [ResourceType] ResTable_typeSpec entry count inconsistent: given 5411, previously 5412 [ResourceType] ResTable_typeSpec entry count inconsistent: given 67, previously 69 [ResourceType] ResTable_typeSpec entry count inconsistent: given 5411, previously 5412 [Mono] DllImport searching in: 'Internal' ('(null)'). [Mono] Searching for 'java_interop_jnienv_call_float_method_a'. [Mono] Probing 'java_interop_jnienv_call_float_method_a'. [Mono] Found as 'java_interop_jnienv_call_float_method_a'. [System] ClassLoader referenced unknown path: /data/user_de/0/com.google.android.gms/app_chimera/m/000001d7/n/armeabi [Mono] Requesting loading reference 9 (of 11) of /storage/emulated/0/Android/data/com.cameratest/files/.override/Xamarin.CommunityToolkit.dll [Mono] Loading reference 9 of /storage/emulated/0/Android/data/com.cameratest/files/.override__/Xamarin.CommunityToolkit.dll asmctx DEFAULT, looking for System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
[native] start_ocr_856638336_langid.cc:33 StartOcr with label: latin_script_gmvapi_android [native] jni_helper.cc:117 Loading model config /data/user/0/com.cameratest/cache/vision/ocr/data/models/semanticlift_rpn_lstm_engine_tfmini.bincfg [native] region_proposal_text_detector.cc:2124 Compute manager Max in flight region detector: 1 [native] common_util.h:39 Removing Thread Pool: ocr_region [native] tensor_detector_client.cc:1658 Compute manager Max in flight detector: 1 [native] common_util.h:35 Resizing Thread Pool: ocr_det to 4 [native] tfmini_model_interface.cc:124 Loaded weights from /data/user/0/com.cameratest/cache/vision/ocr/data/models/tfmini_rpn_detector_space_to_depth_gray_quantized_v2_model.data [native] timer.cc:71 PhotoOcrEngine::Init (detector): 2.95662 ms (elapsed) [native] assist_recognizer.cc:94 Initializing nugget matcher with /data/user/0/com.cameratest/cache/vision/ocr/data/models/nugget_stats_1.0.dat [native] timer.cc:71 PhotoOcrEngine::Init (assist recognizer): 0.208386 ms (elapsed) [native] timer.cc:71 LanguageIdMutator: 2.12474 ms (elapsed) [native] timer.cc:71 BeamSearch::Init (mutator): 2.27412 ms (elapsed) [native] common_util.h:35 Resizing Thread Pool: ocr_segm to 4 [native] tfmini_model_interface.cc:102 Loaded fp16 weights from /data/user/0/com.cameratest/cache/vision/ocr/data/models/tfmini_latin_conv_model.data_fp16 [native] tfmini_model_interface.cc:102 Loaded fp16 weights from /data/user/0/com.cameratest/cache/vision/ocr/data/models/tfmini_latin_lstm_model.data_fp16 [native] timer.cc:71 PhotoOcrEngine::Init (recognizer): 10.6584 ms (elapsed) [native] timer.cc:71 Init: 14.0389 ms (elapsed) [native] start_ocr_856638336_langid.cc:42 StartOcr success [CameraManager] Using legacy camera HAL. Thread started: #6 BoundsChanged 0,0,1080,1041 OnSurfaceTextureSizeChanged [Mono] Requesting loading reference 1 (of 2) of Java.Interop.dll [Mono] Loading reference 1 of Java.Interop.dll asmctx DEFAULT, looking for System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
Thread started:
#7 Thread started: #8 Thread started: #9 Thread started: #10 Thread started: #11 [Mono] Requesting loading reference 5 (of 11) of /storage/emulated/0/Android/data/com.cameratest/files/.override/Xamarin.Firebase.ML.Vision.dll [Mono] Loading reference 5 of /storage/emulated/0/Android/data/com.cameratest/files/.override/Xamarin.Firebase.ML.Vision.dll asmctx DEFAULT, looking for Xamarin.GooglePlayServices.Tasks, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null [Mono] DllImport searching in: '__Internal' ('(null)'). [Mono] Searching for 'java_interop_jnienv_call_static_boolean_method_a'. [Mono] Probing 'java_interop_jnienv_call_static_boolean_method_a'. [Mono] Found as 'java_interop_jnienv_call_static_boolean_method_a'. [MediaRecorderJNI] prepare: surface=0x91af6200 [CameraDevice-0-LE] Surface with size (w=1920, h=1080) and format 0x1 is not valid, size not in valid set: [1280x960, 1280x720, 960x720, 960x540, 864x480, 720x480, 768x432, 640x480, 320x240, 176x144] CameraView: Update preview exception. ErrorMessage: CAMERA_ERROR (3): submitRequestList - must configure device with valid surfaces before submitting requests Stacktrace: at Java.Interop.JniEnvironment+InstanceMethods.CallIntMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue args) [0x0006e] in <89755ea61d9c4ae0a40ce90b872c9e2d>:0 at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeAbstractInt32Method (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue parameters) [0x00014] in <89755ea61d9c4ae0a40ce90b872c9e2d>:0 at Android.Hardware.Camera2.CameraCaptureSessionInvoker.SetRepeatingRequest (Android.Hardware.Camera2.CaptureRequest request, Android.Hardware.Camera2.CameraCaptureSession+CaptureCallback listener, Android.OS.Handler handler) [0x00078] in
:0 at Xamarin.CommunityToolkit.UI.Views.CameraFragment.UpdateRepeatingRequest () [0x0008c] in <4ea27809293646f0b7e2e0f12d88f975>:0 --- End of managed Android.Hardware.Camera2.CameraAccessException stack trace --- android.hardware.camera2.CameraAccessException: CAMERA_ERROR (3): submitRequestList - must configure device with valid surfaces before submitting requests at android.hardware.camera2.CameraManager.throwAsPublicException(CameraManager.java:633) at android.hardware.camera2.impl.ICameraDeviceUserWrapper.submitRequestList(ICameraDeviceUserWrapper.java:86) at android.hardware.camera2.impl.CameraDeviceImpl.submitCaptureRequest(CameraDeviceImpl.java:865) at android.hardware.camera2.impl.CameraDeviceImpl.setRepeatingRequest(CameraDeviceImpl.java:904) at android.hardware.camera2.impl.CameraCaptureSessionImpl.setRepeatingRequest(CameraCaptureSessionImpl.java:236) at crc642e1c7a98bdb5c44a.CameraCaptureStateListener.n_onConfigured(Native Method) at crc642e1c7a98bdb5c44a.CameraCaptureStateListener.onConfigured(CameraCaptureStateListener.java:38) at java.lang.reflect.Method.invoke(Native Method) at android.hardware.camera2.dispatch.InvokeDispatcher.dispatch(InvokeDispatcher.java:39) at android.hardware.camera2.dispatch.HandlerDispatcher$1.run(HandlerDispatcher.java:65) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6123) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757) Caused by: android.os.ServiceSpecificException: submitRequestList - must configure device with valid surfaces before submitting requests at android.hardware.camera2.legacy.LegacyCameraDevice.submitRequestList(LegacyCameraDevice.java:447) at android.hardware.camera2.legacy.CameraDeviceUserShim.submitRequestList(CameraDeviceUserShim.java:443) at android.hardware.camera2.impl.ICameraDeviceUserWrapper.submitRequestList(ICameraDeviceUserWrapper.java:84) ... 15 more [CameraDevice-0-LE] submitRequestList - must configure device with valid surfaces before submitting requests [System.err] android.hardware.camera2.CameraAccessException: CAMERA_ERROR (3): submitRequestList - must configure device with valid surfaces before submitting requests [System.err] at android.hardware.camera2.CameraManager.throwAsPublicException(CameraManager.java:633) [System.err] at android.hardware.camera2.impl.ICameraDeviceUserWrapper.submitRequestList(ICameraDeviceUserWrapper.java:86) [System.err] at android.hardware.camera2.impl.CameraDeviceImpl.submitCaptureRequest(CameraDeviceImpl.java:865) [System.err] at android.hardware.camera2.impl.CameraDeviceImpl.setRepeatingRequest(CameraDeviceImpl.java:904) [System.err] at android.hardware.camera2.impl.CameraCaptureSessionImpl.setRepeatingRequest(CameraCaptureSessionImpl.java:236) [System.err] at crc642e1c7a98bdb5c44a.CameraCaptureStateListener.n_onConfigured(Native Method) [System.err] at crc642e1c7a98bdb5c44a.CameraCaptureStateListener.onConfigured(CameraCaptureStateListener.java:38) [System.err] at java.lang.reflect.Method.invoke(Native Method) [System.err] at android.hardware.camera2.dispatch.InvokeDispatcher.dispatch(InvokeDispatcher.java:39) [System.err] at android.hardware.camera2.dispatch.HandlerDispatcher$1.run(HandlerDispatcher.java:65) [System.err] at android.os.Handler.handleCallback(Handler.java:751) [System.err] at android.os.Handler.dispatchMessage(Handler.java:95) [System.err] at android.os.Looper.loop(Looper.java:154) [System.err] at android.app.ActivityThread.main(ActivityThread.java:6123) [System.err] at java.lang.reflect.Method.invoke(Native Method) [System.err] at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867) [System.err] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757) [System.err] Caused by: android.os.ServiceSpecificException: submitRequestList - must configure device with valid surfaces before submitting requests [System.err] at android.hardware.camera2.legacy.LegacyCameraDevice.submitRequestList(LegacyCameraDevice.java:447) [System.err] at android.hardware.camera2.legacy.CameraDeviceUserShim.submitRequestList(CameraDeviceUserShim.java:443) [System.err] at android.hardware.camera2.impl.ICameraDeviceUserWrapper.submitRequestList(ICameraDeviceUserWrapper.java:84) [System.err] ... 15 more
@jpd21122012 yeah... I have an idea of what is the trouble. To don't leave you without an answer I can try to resume. As far as I know, when we select a wrong resolution (in other words a resolution that the device doesn't support) for the Camera it just throws an exception. In our case, our last commit fixed an issue with Pixel 2 because of that but breaks devices that don't support FullHD resolution.
If you try our last preview nuget I think that will work for you. Anyway, I'll do a PR ASAP to fix it. Thanks @jpd21122012 for reporting this for us.
Do you refer to Version 1.0.0-pre6? I've tried aagain with that one and output when I click on the record button is:
01-08 09:33:08.253 I/MediaRecorderJNI(22950): prepare: surface=0x717d612000
01-08 09:33:08.735 W/BpBinder(22950): Slow Binder: BpBinder transact took 482 ms, interface=android.media.IMediaRecorder, code=9 oneway=false
01-08 09:33:08.896 I/Choreographer(22950): Skipped 44 frames! The application may be doing too much work on its main thread.
01-08 09:33:08.896 W/Looper (22950): Slow Looper main: doFrame is 734ms late because of 8 msg, msg 8 took 725ms (seq=175 running=51ms runnable=9ms io=21ms late=18ms h=android.os.Handler c=mono.java.lang.RunnableImplementor)
01-08 09:33:08.919 W/Gralloc3(22950): allocator 3.x is not supported
01-08 09:33:19.393 W/BpBinder(22950): Slow Binder: BpBinder transact took 373 ms, interface=android.media.IMediaRecorder, code=7 oneway=false
01-08 09:33:19.393 E/MediaRecorder(22950): stop failed: -1007
01-08 09:33:19.429 W/System.err(22950): java.lang.RuntimeException: stop failed.
01-08 09:33:19.429 W/System.err(22950): at android.media.MediaRecorder.stop(Native Method)
01-08 09:33:19.429 W/System.err(22950): at crc64ee486da937c010f4.ButtonRenderer.n_onClick(Native Method)
01-08 09:33:19.429 W/System.err(22950): at crc64ee486da937c010f4.ButtonRenderer.onClick(ButtonRenderer.java:104)
01-08 09:33:19.429 W/System.err(22950): at android.view.View.performClick(View.java:7185)
01-08 09:33:19.429 W/System.err(22950): at android.view.View.performClickInternal(View.java:7162)
01-08 09:33:19.429 W/System.err(22950): at android.view.View.access$3500(View.java:819)
01-08 09:33:19.429 W/System.err(22950): at android.view.View$PerformClick.run(View.java:27684)
01-08 09:33:19.429 W/System.err(22950): at android.os.Handler.handleCallback(Handler.java:883)
01-08 09:33:19.429 W/System.err(22950): at android.os.Handler.dispatchMessage(Handler.java:100)
01-08 09:33:19.429 W/System.err(22950): at android.os.Looper.loop(Looper.java:224)
01-08 09:33:19.429 W/System.err(22950): at android.app.ActivityThread.main(ActivityThread.java:7584)
01-08 09:33:19.429 W/System.err(22950): at java.lang.reflect.Method.invoke(Native Method)
01-08 09:33:19.429 W/System.err(22950): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
01-08 09:33:19.429 W/System.err(22950): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)
[0:] CameraView: Stop record exception
ErrorMessage: stop failed.
Stacktrace: at Java.Interop.JniEnvironment+InstanceMethods.CallVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue args) [0x0006e] in <89755ea61d9c4ae0a40ce90b872c9e2d>:0
at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualVoidMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue parameters) [0x0002a] in <89755ea61d9c4ae0a40ce90b872c9e2d>:0
at Android.Media.MediaRecorder.Stop () [0x0000a] in
and the output later from that response is:
01-08 09:37:22.963 E/MediaRecorder(22950): start called in an invalid state: 32
01-08 09:37:22.967 W/System.err(22950): java.lang.IllegalStateException
01-08 09:37:22.967 W/System.err(22950): at android.media.MediaRecorder.start(Native Method)
01-08 09:37:22.967 W/System.err(22950): at crc64ee486da937c010f4.ButtonRenderer.n_onClick(Native Method)
01-08 09:37:22.967 W/System.err(22950): at crc64ee486da937c010f4.ButtonRenderer.onClick(ButtonRenderer.java:104)
01-08 09:37:22.967 W/System.err(22950): at android.view.View.performClick(View.java:7185)
01-08 09:37:22.967 W/System.err(22950): at android.view.View.performClickInternal(View.java:7162)
01-08 09:37:22.968 W/System.err(22950): at android.view.View.access$3500(View.java:819)
01-08 09:37:22.968 W/System.err(22950): at android.view.View$PerformClick.run(View.java:27684)
01-08 09:37:22.968 W/System.err(22950): at android.os.Handler.handleCallback(Handler.java:883)
01-08 09:37:22.968 W/System.err(22950): at android.os.Handler.dispatchMessage(Handler.java:100)
01-08 09:37:22.968 W/System.err(22950): at android.os.Looper.loop(Looper.java:224)
01-08 09:37:22.968 W/System.err(22950): at android.app.ActivityThread.main(ActivityThread.java:7584)
01-08 09:37:22.968 W/System.err(22950): at java.lang.reflect.Method.invoke(Native Method)
01-08 09:37:22.968 W/System.err(22950): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
01-08 09:37:22.968 W/System.err(22950): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)
[0:] CameraView: Failed to take video
ErrorMessage:
Stacktrace: at Java.Interop.JniEnvironment+InstanceMethods.CallVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue args) [0x0006e] in <89755ea61d9c4ae0a40ce90b872c9e2d>:0
at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualVoidMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue parameters) [0x0002a] in <89755ea61d9c4ae0a40ce90b872c9e2d>:0
at Android.Media.MediaRecorder.Start () [0x0000a] in
@jpd21122012 yeah... I have an idea of what is the trouble. To don't leave you without an answer I can try to resume. As far as I know, when we select a wrong resolution (in other words a resolution that the device doesn't support) for the Camera it just throws an exception. In our case, our last commit fixed an issue with Pixel 2 because of that but breaks devices that don't support FullHD resolution. If you try our last preview nuget I think that will work for you. Anyway, I'll do a PR ASAP to fix it. Thanks @jpd21122012 for reporting this for us.
Do you refer to Version 1.0.0-pre6? I've tried aagain with that one and output when I click on the record button is:
01-08 09:33:08.253 I/MediaRecorderJNI(22950): prepare: surface=0x717d612000 01-08 09:33:08.735 W/BpBinder(22950): Slow Binder: BpBinder transact took 482 ms, interface=android.media.IMediaRecorder, code=9 oneway=false 01-08 09:33:08.896 I/Choreographer(22950): Skipped 44 frames! The application may be doing too much work on its main thread. 01-08 09:33:08.896 W/Looper (22950): Slow Looper main: doFrame is 734ms late because of 8 msg, msg 8 took 725ms (seq=175 running=51ms runnable=9ms io=21ms late=18ms h=android.os.Handler c=mono.java.lang.RunnableImplementor) 01-08 09:33:08.919 W/Gralloc3(22950): allocator 3.x is not supported 01-08 09:33:19.393 W/BpBinder(22950): Slow Binder: BpBinder transact took 373 ms, interface=android.media.IMediaRecorder, code=7 oneway=false 01-08 09:33:19.393 E/MediaRecorder(22950): stop failed: -1007 01-08 09:33:19.429 W/System.err(22950): java.lang.RuntimeException: stop failed. 01-08 09:33:19.429 W/System.err(22950): at android.media.MediaRecorder.stop(Native Method) 01-08 09:33:19.429 W/System.err(22950): at crc64ee486da937c010f4.ButtonRenderer.n_onClick(Native Method) 01-08 09:33:19.429 W/System.err(22950): at crc64ee486da937c010f4.ButtonRenderer.onClick(ButtonRenderer.java:104) 01-08 09:33:19.429 W/System.err(22950): at android.view.View.performClick(View.java:7185) 01-08 09:33:19.429 W/System.err(22950): at android.view.View.performClickInternal(View.java:7162) 01-08 09:33:19.429 W/System.err(22950): at android.view.View.access$3500(View.java:819) 01-08 09:33:19.429 W/System.err(22950): at android.view.View$PerformClick.run(View.java:27684) 01-08 09:33:19.429 W/System.err(22950): at android.os.Handler.handleCallback(Handler.java:883) 01-08 09:33:19.429 W/System.err(22950): at android.os.Handler.dispatchMessage(Handler.java:100) 01-08 09:33:19.429 W/System.err(22950): at android.os.Looper.loop(Looper.java:224) 01-08 09:33:19.429 W/System.err(22950): at android.app.ActivityThread.main(ActivityThread.java:7584) 01-08 09:33:19.429 W/System.err(22950): at java.lang.reflect.Method.invoke(Native Method) 01-08 09:33:19.429 W/System.err(22950): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539) 01-08 09:33:19.429 W/System.err(22950): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950) [0:] CameraView: Stop record exception ErrorMessage: stop failed. Stacktrace: at Java.Interop.JniEnvironment+InstanceMethods.CallVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue args) [0x0006e] in <89755ea61d9c4ae0a40ce90b872c9e2d>:0 at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualVoidMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue parameters) [0x0002a] in <89755ea61d9c4ae0a40ce90b872c9e2d>:0 at Android.Media.MediaRecorder.Stop () [0x0000a] in :0 at Xamarin.CommunityToolkit.UI.Views.CameraFragment.DisposeMediaRecorder () [0x00010] in <3465e8cbf77646e79c6d808f589c3ec7>:0 at Xamarin.CommunityToolkit.UI.Views.CameraFragment.StopRecord () [0x0003a] in <3465e8cbf77646e79c6d808f589c3ec7>:0 --- End of managed Java.Lang.RuntimeException stack trace --- java.lang.RuntimeException: stop failed. at android.media.MediaRecorder.stop(Native Method) at crc64ee486da937c010f4.ButtonRenderer.n_onClick(Native Method) at crc64ee486da937c010f4.ButtonRenderer.onClick(ButtonRenderer.java:104) at android.view.View.performClick(View.java:7185) at android.view.View.performClickInternal(View.java:7162) at android.view.View.access$3500(View.java:819) at android.view.View$PerformClick.run(View.java:27684) at android.os.Handler.handleCallback(Handler.java:883) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loop(Looper.java:224) at android.app.ActivityThread.main(ActivityThread.java:7584) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950) 01-08 09:33:19.470 I/Choreographer(22950): Skipped 32 frames! The application may be doing too much work on its main thread. 01-08 09:33:19.484 W/Looper (22950): Slow Looper main: doFrame is 546ms late because of 2 msg, msg 1 took 549ms (seq=786 running=53ms runnable=3ms io=19ms late=4ms h=android.view.ViewRootImpl$ViewRootHandler c=android.view.View$PerformClick)
and the output later from that response is:
01-08 09:37:22.963 E/MediaRecorder(22950): start called in an invalid state: 32 01-08 09:37:22.967 W/System.err(22950): java.lang.IllegalStateException 01-08 09:37:22.967 W/System.err(22950): at android.media.MediaRecorder.start(Native Method) 01-08 09:37:22.967 W/System.err(22950): at crc64ee486da937c010f4.ButtonRenderer.n_onClick(Native Method) 01-08 09:37:22.967 W/System.err(22950): at crc64ee486da937c010f4.ButtonRenderer.onClick(ButtonRenderer.java:104) 01-08 09:37:22.967 W/System.err(22950): at android.view.View.performClick(View.java:7185) 01-08 09:37:22.967 W/System.err(22950): at android.view.View.performClickInternal(View.java:7162) 01-08 09:37:22.968 W/System.err(22950): at android.view.View.access$3500(View.java:819) 01-08 09:37:22.968 W/System.err(22950): at android.view.View$PerformClick.run(View.java:27684) 01-08 09:37:22.968 W/System.err(22950): at android.os.Handler.handleCallback(Handler.java:883) 01-08 09:37:22.968 W/System.err(22950): at android.os.Handler.dispatchMessage(Handler.java:100) 01-08 09:37:22.968 W/System.err(22950): at android.os.Looper.loop(Looper.java:224) 01-08 09:37:22.968 W/System.err(22950): at android.app.ActivityThread.main(ActivityThread.java:7584) 01-08 09:37:22.968 W/System.err(22950): at java.lang.reflect.Method.invoke(Native Method) 01-08 09:37:22.968 W/System.err(22950): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539) 01-08 09:37:22.968 W/System.err(22950): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950) [0:] CameraView: Failed to take video ErrorMessage: Stacktrace: at Java.Interop.JniEnvironment+InstanceMethods.CallVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue args) [0x0006e] in <89755ea61d9c4ae0a40ce90b872c9e2d>:0 at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualVoidMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue parameters) [0x0002a] in <89755ea61d9c4ae0a40ce90b872c9e2d>:0 at Android.Media.MediaRecorder.Start () [0x0000a] in :0 at Xamarin.CommunityToolkit.UI.Views.CameraFragment.StartRecord () [0x00084] in <3465e8cbf77646e79c6d808f589c3ec7>:0 --- End of managed Java.Lang.IllegalStateException stack trace --- java.lang.IllegalStateException at android.media.MediaRecorder.start(Native Method) at crc64ee486da937c010f4.ButtonRenderer.n_onClick(Native Method) at crc64ee486da937c010f4.ButtonRenderer.onClick(ButtonRenderer.java:104) at android.view.View.performClick(View.java:7185) at android.view.View.performClickInternal(View.java:7162) at android.view.View.access$3500(View.java:819) at android.view.View$PerformClick.run(View.java:27684) at android.os.Handler.handleCallback(Handler.java:883) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loop(Looper.java:224) at android.app.ActivityThread.main(ActivityThread.java:7584) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950) [0:] Something Wrong
I've added the MediaCaptureFailed, and the e parameter says "Unexpected error: MediaRecorder is not initialized."
I had the same issue. Just enable the RECORD_AUDIO permission and it should be fine. Hope this helps.
@gaetanonou awesome
I'm facing the same issue, the exception is thrown when the component tries to render the preview (and shows only a black surface).
Full StackTrace:
[CameraDevice-0-LE] submitRequestList - must configure device with valid surfaces before submitting requests
[System.err] android.hardware.camera2.CameraAccessException: CAMERA_ERROR (3): submitRequestList - must configure device with valid surfaces before submitting requests
[System.err] at android.hardware.camera2.CameraManager.throwAsPublicException(CameraManager.java:637)
[System.err] at android.hardware.camera2.impl.ICameraDeviceUserWrapper.submitRequestList(ICameraDeviceUserWrapper.java:86)
[System.err] at android.hardware.camera2.impl.CameraDeviceImpl.submitCaptureRequest(CameraDeviceImpl.java:865)
[System.err] at android.hardware.camera2.impl.CameraDeviceImpl.setRepeatingRequest(CameraDeviceImpl.java:904)
[System.err] at android.hardware.camera2.impl.CameraCaptureSessionImpl.setRepeatingRequest(CameraCaptureSessionImpl.java:236)
[System.err] at crc642e1c7a98bdb5c44a.CameraCaptureStateListener.n_onConfigured(Native Method)
[System.err] at crc642e1c7a98bdb5c44a.CameraCaptureStateListener.onConfigured(CameraCaptureStateListener.java:38)
[System.err] at java.lang.reflect.Method.invoke(Native Method)
[System.err] at android.hardware.camera2.dispatch.InvokeDispatcher.dispatch(InvokeDispatcher.java:39)
[System.err] at android.hardware.camera2.dispatch.HandlerDispatcher$1.run(HandlerDispatcher.java:65)
[System.err] at android.os.Handler.handleCallback(Handler.java:836)
[System.err] at android.os.Handler.dispatchMessage(Handler.java:103)
[System.err] at android.os.Looper.loop(Looper.java:203)
[System.err] at android.app.ActivityThread.main(ActivityThread.java:6368)
[System.err] at java.lang.reflect.Method.invoke(Native Method)
[System.err] at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1063)
[System.err] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924)
[System.err] Caused by: android.os.ServiceSpecificException: submitRequestList - must configure device with valid surfaces before submitting requests
[System.err] at android.hardware.camera2.legacy.LegacyCameraDevice.submitRequestList(LegacyCameraDevice.java:447)
[System.err] at android.hardware.camera2.impl.ICameraDeviceUserWrapper.submitRequestList(ICameraDeviceUserWrapper.java:84)
[System.err] ... 15 more
[0:] CameraView: Update preview exception.
ErrorMessage: CAMERA_ERROR (3): submitRequestList - must configure device with valid surfaces before submitting requests
Stacktrace: at Java.Interop.JniEnvironment+InstanceMethods.CallIntMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x0006e] in <94b04e1756104d1fa1d144932ae2720c>:0
at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeAbstractInt32Method (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x00014] in <94b04e1756104d1fa1d144932ae2720c>:0
at Android.Hardware.Camera2.CameraCaptureSessionInvoker.SetRepeatingRequest (Android.Hardware.Camera2.CaptureRequest request, Android.Hardware.Camera2.CameraCaptureSession+CaptureCallback listener, Android.OS.Handler handler) [0x0006e] in /Users/builder/azdo/_work/278/s/xamarin-android/src/Mono.Android/obj/Release/monoandroid10/android-29/mcw/Android.Hardware.Camera2.CameraCaptureSession.cs:1317
at Xamarin.CommunityToolkit.UI.Views.CameraFragment.UpdateRepeatingRequest () [0x000be] in <5265966be8d2407fb7a4c3b38c6441d7>:0
--- End of managed Android.Hardware.Camera2.CameraAccessException stack trace ---
android.hardware.camera2.CameraAccessException: CAMERA_ERROR (3): submitRequestList - must configure device with valid surfaces before submitting requests
at android.hardware.camera2.CameraManager.throwAsPublicException(CameraManager.java:637)
at android.hardware.camera2.impl.ICameraDeviceUserWrapper.submitRequestList(ICameraDeviceUserWrapper.java:86)
at android.hardware.camera2.impl.CameraDeviceImpl.submitCaptureRequest(CameraDeviceImpl.java:865)
at android.hardware.camera2.impl.CameraDeviceImpl.setRepeatingRequest(CameraDeviceImpl.java:904)
at android.hardware.camera2.impl.CameraCaptureSessionImpl.setRepeatingRequest(CameraCaptureSessionImpl.java:236)
at crc642e1c7a98bdb5c44a.CameraCaptureStateListener.n_onConfigured(Native Method)
at crc642e1c7a98bdb5c44a.CameraCaptureStateListener.onConfigured(CameraCaptureStateListener.java:38)
at java.lang.reflect.Method.invoke(Native Method)
at android.hardware.camera2.dispatch.InvokeDispatcher.dispatch(InvokeDispatcher.java:39)
at android.hardware.camera2.dispatch.HandlerDispatcher$1.run(HandlerDispatcher.java:65)
at android.os.Handler.handleCallback(Handler.java:836)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:203)
at android.app.ActivityThread.main(ActivityThread.java:6368)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1063)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924)
Caused by: android.os.ServiceSpecificException: submitRequestList - must configure device with valid surfaces before submitting requests
at android.hardware.camera2.legacy.LegacyCameraDevice.submitRequestList(LegacyCameraDevice.java:447)
at android.hardware.camera2.legacy.CameraDeviceUserShim.submitRequestList(CameraDeviceUserShim.java:443)
at android.hardware.camera2.impl.ICameraDeviceUserWrapper.submitRequestList(ICameraDeviceUserWrapper.java:84)
... 15 more
Device is a Sony G3311 with Android 7.0, RECORD_AUDIO permission is present in manifest and is given by the user.
I think that an UITest might be useful if are ran on emulated devices (idk if this is possible) since on error a black surface is shown, while if it gets correctly initialized you can see the usual test ambient.
EDIT: I forgot to mention that the component is defined as following:
<xct:CameraView x:Name="cameraView"
Grid.Row="0"
CaptureMode="Video"
FlashMode="Off"
OnAvailable="cameraView_OnAvailable"
MediaCaptured="cameraView_MediaCaptured"
MediaCaptureFailed="cameraView_MediaCaptureFailed"/>
I face the same issue with video on samsung SMT595 tablet
[CameraDevice-0-LE] Surface with size (w=1920, h=1080) and format 0x22 is not valid, size not in valid set: [1472x1104, 1088x1088, 1280x720, 1024x768, 960x720, 832x500, 720x480, 640x480, 352x288, 320x240, 176x144]
[.malacontrolle] Explicit concurrent copying GC freed 53180(2173KB) AllocSpace objects, 1(20KB) LOS objects, 57% free, 4614KB/10MB, paused 207us total 51.648ms
[CameraDevice-0-LE] submitRequestList - must configure device with valid surfaces before submitting requests
[System.err] android.hardware.camera2.CameraAccessException: CAMERA_ERROR (3): submitRequestList - must configure device with valid surfaces before submitting requests
[System.err] at android.hardware.camera2.CameraManager.throwAsPublicException(CameraManager.java:1127)
[System.err] at android.hardware.camera2.impl.ICameraDeviceUserWrapper.submitRequestList(ICameraDeviceUserWrapper.java:88)
[System.err] at android.hardware.camera2.impl.CameraDeviceImpl.submitCaptureRequest(CameraDeviceImpl.java:1082)
[System.err] at android.hardware.camera2.impl.CameraDeviceImpl.setRepeatingRequest(CameraDeviceImpl.java:1127)
[System.err] at android.hardware.camera2.impl.CameraCaptureSessionImpl.setRepeatingRequest(CameraCaptureSessionImpl.java:297)
[System.err] at crc642e1c7a98bdb5c44a.CameraCaptureStateListener.n_onConfigured(Native Method)
[System.err] at crc642e1c7a98bdb5c44a.CameraCaptureStateListener.onConfigured(CameraCaptureStateListener.java:38)
[System.err] at android.hardware.camera2.impl.CallbackProxies$SessionStateCallbackProxy.lambda$onConfigured$0$CallbackProxies$SessionStateCallbackProxy(CallbackProxies.java:53)
[System.err] at android.hardware.camera2.impl.-$$Lambda$CallbackProxies$SessionStateCallbackProxy$soW0qC12Osypoky6AfL3P2-TeDw.run(Unknown Source:4)
[System.err] at android.os.Handler.handleCallback(Handler.java:883)
[System.err] at android.os.Handler.dispatchMessage(Handler.java:100)
[System.err] at android.os.Looper.loop(Looper.java:237)
[System.err] at android.app.ActivityThread.main(ActivityThread.java:8107)
[System.err] at java.lang.reflect.Method.invoke(Native Method)
[System.err] at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
[System.err] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)
[System.err] Caused by: android.os.ServiceSpecificException: submitRequestList - must configure device with valid surfaces before submitting requests (code -32)
[System.err] at android.hardware.camera2.legacy.LegacyCameraDevice.submitRequestList(LegacyCameraDevice.java:493)
[System.err] at android.hardware.camera2.legacy.CameraDeviceUserShim.submitRequestList(CameraDeviceUserShim.java:461)
[System.err] at android.hardware.camera2.impl.ICameraDeviceUserWrapper.submitRequestList(ICameraDeviceUserWrapper.java:86)
[System.err] ... 14 more
[0:] CameraView: Update preview exception.
ErrorMessage: CAMERA_ERROR (3): submitRequestList - must configure device with valid surfaces before submitting requests
Stacktrace: at Java.Interop.JniEnvironment+InstanceMethods.CallIntMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue args) [0x0006e] in
I have spend 4 hours to find this reason [CameraDevice-0-LE] Surface with size (w=1920, h=1080) and format 0x22 is not valid, size not in valid set: [1472x1104, 1088x1088, 1280x720, 1024x768, 960x720, 832x500, 720x480, 640x480, 352x288, 320x240, 176x144] => Log is very clear. Because SetupMediaRecorder=> exist profile when call GetCamcoderProfile=> But that profile is not valid. HOW TO FIX => In CameraFragment
Please fix it in new version on nuget
@huytran123 if you know how to fix the issue we are open to PRs
@bijington yes, i have know how to fix it, i downloaded your source and fix this issue and tested on Mi A1 and Android 9
@bijington yes, i have know how to fix it, i downloaded your source and fix this issue and tested on Mi A1 and Android 9
We would love your help writing the code! The Community Toolkit contains features for, and created by, the Xamarin Community. We are all volunteers, contributing code in our spare time on nights and weekends. If you'd like to contribute, I can provide details if you aren't familiar with contributing to open source.
Description
Video mode doesn't appear to work on a Moto G5 Plus Android 8
Error from logcat
Time Device Name Type PID Tag Message 09-10 14:22:13.522 Motorola Moto G (5) Plus Warning 9532 System.err android.hardware.camera2.CameraAccessException: CAMERA_ERROR (3): submitRequestList - must configure device with valid surfaces before submitting requests at android.hardware.camera2.CameraManager.throwAsPublicException(CameraManager.java:670) at android.hardware.camera2.impl.ICameraDeviceUserWrapper.submitRequestList(ICameraDeviceUserWrapper.java:86) at android.hardware.camera2.impl.CameraDeviceImpl.submitCaptureRequest(CameraDeviceImpl.java:940) at android.hardware.camera2.impl.CameraDeviceImpl.setRepeatingRequest(CameraDeviceImpl.java:979) at android.hardware.camera2.impl.CameraCaptureSessionImpl.setRepeatingRequest(CameraCaptureSessionImpl.java:244) at crc642e1c7a98bdb5c44a.CameraCaptureStateListener.n_onConfigured(Native Method) at crc642e1c7a98bdb5c44a.CameraCaptureStateListener.onConfigured(CameraCaptureStateListener.java:38) at java.lang.reflect.Method.invoke(Native Method) at android.hardware.camera2.dispatch.InvokeDispatcher.dispatch(InvokeDispatcher.java:39) at android.hardware.camera2.dispatch.HandlerDispatcher$1.run(HandlerDispatcher.java:65) at android.os.Handler.handleCallback(Handler.java:790) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6626) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:811)
Time Device Name Type PID Tag Message 09-10 14:22:13.524 Motorola Moto G (5) Plus Warning 9532 System.err Caused by: android.os.ServiceSpecificException: submitRequestList - must configure device with valid surfaces before submitting requests (code -32) at android.hardware.camera2.legacy.LegacyCameraDevice.submitRequestList(LegacyCameraDevice.java:466) at android.hardware.camera2.legacy.CameraDeviceUserShim.submitRequestList(CameraDeviceUserShim.java:455) at android.hardware.camera2.impl.ICameraDeviceUserWrapper.submitRequestList(ICameraDeviceUserWrapper.java:84) ... 15 more
Steps to Reproduce
Expected Behavior
Video isn't frozen
Actual Behavior
Video is frozen
Basic Information