Android Tutorial Camera2 - Still images and videos

Status
Not open for further replies.

Lello1964

Well-Known Member
Licensed User
Longtime User
I can't compile this app.
Camera2 lib not found.
I have updated APi, but still not work.




Tanks
 

biometrics

Active Member
Licensed User
Longtime User
The sample seems to set the video capture size to 1920x1080 (CaptureSize.Initialize(1920, 1080)) but my resulting file is 640x480. How do I set the video capture size? My phone is a Sony Z3 that supports that resolution.

Also, how can I set:
  1. Video bit rate (e.g. 1000kbps or 500kbps)
  2. Video frame rate (e.g. 30fps or 12 fps)
 

petr4ppc

Well-Known Member
Licensed User
Longtime User
Dear friends,

I get this error when I am trying to do picture:
2-(ServiceSpecificException) android.os.ServiceSpecificException: submitRequestList:283: Camera 0: Got error Invalid argument (-22) after trying to submit capture request (code 10)

I have taskindex >0

This I have if I push button for example five times and I get this error. If I push the button for example sixth time I get picure withou error.
Thank you very much
p4ppc
 

Rusty

Well-Known Member
Licensed User
Longtime User
I'm getting this error when trying to compile your example:
Failure [INSTALL_FAILED_OLDER_SDK]
I've struggled with Manifest changes...etc. but nothing seems to fix this. I'm running version 8.50
Any ideas?
Thanks
Rusty
 

Rusty

Well-Known Member
Licensed User
Longtime User
I changed it to b4a.cameratest and still get the error.
Any other ideas? BTW, I'm installing it to BlueStacks emulator and have been using it for a variety of apps over the past 4 or 5 years...just FYI

UPDATE: After explaining that I was using BlueStacks, I moved to a real device on which the application works fine...
 
Last edited:

MrKim

Well-Known Member
Licensed User
Longtime User
There is a Gothcah with Focus, at least on my Insignia tablet:

There are TWO OFFS in the list so it never gets past that because 1 is always returned
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Change the code in CamEx2 to:
B4X:
'Returns the supported focus modes. Best mode in most cases is CONTINUOUS_PICTURE.
Public Sub getSupportedFocusModes As List
   Return RemoveDuplicates(IntsToConstsList(GetFromCameraCharacteristic("CONTROL_AF_AVAILABLE_MODES"), AF_MODE))
End Sub

Private Sub RemoveDuplicates(Raw As List) As List
   Dim unique As Map
   unique.Initialize
   For Each f As String In Raw
       unique.Put(f, "")
   Next
   Raw.Clear
   For Each f As String In unique.Keys
       Raw.Add(f)
   Next
   Return Raw
End Sub
 

mtselection

Member
Licensed User
Longtime User
Hi,

I try CameraEx2 ver 1.20 in my Samsung galaxy s8, but when I swith in camera mode the software stopped with this following error:

Error occurred on line: 156 (CamEx2)
java.lang.IllegalArgumentException: CaptureRequest contains unconfigured Input/Output Surface!
at android.hardware.camera2.CaptureRequest.convertSurfaceToStreamId(CaptureRequest.java:582)
at android.hardware.camera2.impl.CameraDeviceImpl.submitCaptureRequest(CameraDeviceImpl.java:938)
at android.hardware.camera2.impl.CameraDeviceImpl.setRepeatingRequest(CameraDeviceImpl.java:984)
at android.hardware.camera2.impl.CameraCaptureSessionImpl.setRepeatingRequest(CameraCaptureSessionImpl.java:238)
at anywheresoftware.b4a.objects.Camera2.SetRepeatingRequest(Camera2.java:359)
at b4a.example3.camex2._startpreview(camex2.java:217)
at b4a.example3.main$ResumableSub_PrepareSurface.resume(main.java:1029)
at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resumeAsUserSub(DebugResumableSub.java:48)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:738)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:357)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:260)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:171)
at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resume(DebugResumableSub.java:43)
at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:245)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:137)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:171)
at anywheresoftware.b4a.keywords.Common$14.run(Common.java:1736)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6938)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)

any suggestions.

thanks
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…