Sign up for our live Camera Kit office hour on July 17 @ 9:30am (PT) / 4:30pm (GMT)

Using Camera Kit with external USB camera on AOSP

dropWirelessDev
dropWirelessDev Posts: 7
edited September 2023 in General #1

Hello, we are trying to install DressX app on our own hardware, which runs a custom version of Android 13.

However, it seems like Camera Kit does not recognize the external camera.

So we tried with other apps that uses Camera Kit, Camo and Flip, to see if the USB camera works, but these apps are crashed on camera screen.

The camera works fine with other general camera apps, and we've checked that it is accessible on application level.

So is there a way to configure something to use external USB camera on the apps with Camera Kit?

Thanks

Tagged:

Best Answers

  • Ankit Baphna
    Ankit Baphna Posts: 12 👻
    #2 Answer ✓

    @dropWirelessDev if you can change Camera Manager to return external camera as default then it might help, but I have not tried that option. You have to experiment with that a bit.
    Reg. the sample app please follow instructions mentioned in docs\video tutorial here: https://docs.snap.com/camera-kit/integrate-sdk/mobile/android . You basically need to get the API token from Camera Kit portal.

  • dropWirelessDev
    dropWirelessDev Posts: 7
    #3 Answer ✓

    It worked when the external camera was configured as a front/back camera, but due to the lack of processing power of the board, it is super slow.
    Anyway, the problem is solved!
    Thanks all.

Answers

  • stevenxu
    stevenxu Posts: 612 👻

    @dropWirelessDev Thanks for posting on the forum. Before I check internally on this, are you part of the DressX team trying to troubleshoot this issue? Or are you an end user (outside of DressX) trying to use this app?

    Also, could you provide more details on the hardware?

    Steven

  • +I accidentally posted before finishing, so I edited the original post with a little additional information.

    We are separated team and we wanted to test our hardware's capability before having a partnership with the DressX.

    Our hardware is based on the Boundary's Nitrogen8m board, and it uses IMX chipset.
    You can find more details here: https://boundarydevices.com/product/nitrogen8m/

    We are stuck on accessing USB camera on DressX app. So we want to make sure whether the USB camera is usable on Camera Kit.

  • stevenxu
    stevenxu Posts: 612 👻

    @dropWirelessDev Ah, got it. Thanks for the information....

    Could you link me which DressX app you're trying to use? (I think I know which one, but just to be sure)

  • This one:
    DRESSX FASHION METAVERSE
    https://play.google.com/store/apps/details?id=com.dressx.main&hl=en_US&gl=US

    All apps I tested are listed on the middle of the Snap AR Camera Kit webpage:
    https://ar.snap.com/camera-kit

  • stevenxu
    stevenxu Posts: 612 👻

    @dropWirelessDev Got it! Let me check internally with our eng, but they may get back by next week since it's end of the weekday here...

    Though looking at this setup, I presume you're not using their app as intended which is to be on a mobile phone device using its built-in camera. Could you explain why you're trying this other path of hooking up a USB camera for their app?

    In the meantime, I've created a ticket and will get back to you with what our eng team says.

    Thanks!

  • @stevenxu Um, it's an internal thing, so I'm not sure if I can speak out.

    Anyway, other Camera Kit apps are crashed as well, so I just wondered if the Camera Kit is not compatible with external USB cameras at all, or there is a workaround.

    Thanks for forwarding this to the engineers, I will look forward to the response :)

  • Ankit Baphna
    Ankit Baphna Posts: 12 👻
    edited September 2023 #10

    @dropWirelessDev We don't have implementation details of any of our partners, so we can't\won't specify how to make those apps work with your setup without app's code changes. However, I have few questions and suggestions on your setup:

    1. Which Camera instance is returned by CameraX default implementation in your setup - default or USB one?
    2. When you say other apps works, do you have option to select the camera instance in those apps? Can you list down some of those apps?
    3. Have you tried running any of the Camera Kit sample apps on your setup? If not I'd recommend camerakit-sample-full app from https://github.com/Snapchat/camera-kit-reference
    4. If you have access to Camera Manager then you can check out the code of Camera Kit's CameraXImageProcessorSource to get better understanding of how most apps are using Camera Kit. However, it might be the case that the app is not using CameraXImageProcessorSource, in that case you need to work with that app's dev team to find out a solution.
    5. If you still run into issues then please share logs, stacktrace and relevant code code snippets with our team.

    I hope this helps, keep us posted.

  • stevenxu
    stevenxu Posts: 612 👻

    WHOA ! @Ankit Baphna you beat me to it before I can create a ticket LOL. Touche. You're in good hands @dropWirelessDev

  • @Ankit Baphna
    Thanks for the fast response!

    1. When I tested with Camera2, it was shown as an External Camera. (in metadata android.lens.facing was set to 2, where 0 is front, 1 is back, 2 is external)

    2. "Open Camera" can capture the image from the USB camera. Since it is the only camera attached on the board, it only shows the USB camera and there was no option to switch. Also, native camera app in Android Open Source worked.

    3. I tried full sample, but I don't have API token, so I got:
      09-29 23:35:25.402 2897 2897 E AndroidRuntime: FATAL EXCEPTION: main
      09-29 23:35:25.402 2897 2897 E AndroidRuntime: Process: com.snap.camerakit.sample.full, PID: 2897
      09-29 23:35:25.402 2897 2897 E AndroidRuntime: com.snap.camerakit.UnauthorizedApplicationException: The application with API token [REPLACE-THIS-WITH-YOUR-OWN-APP-SPECIFIC-VALUE] and package name [com.snap.camerakit.sample.full] is not authorized to use CameraKit

    It seems like the sample kit would be very helpful to find a cause.
    So how do I get the application key?

  • @Ankit Baphna We've already tried to configure low level camera metadata with board manufacturer, and just found a solution to change it to return the external camera as a front camera. I will test it and let you know.
    Regarding to the API token, we've also made a request to Camera Kit Access. So, once we get the access, I will try the samples.

  • Ankit Baphna
    Ankit Baphna Posts: 12 👻

    @dropWirelessDev great to hear that, thanks for sharing.