External USB webcam plugin for Xamarin.Android

Hi!

Did anybody ever tried to attach external USB webcamera by OTG cable to Android device and take photo or video using this camera?
There are several applications in Play Store which can demonstrate the above, for example this.

After some searching I've found a native library libuvc, which provides all the necessary functionality to reach the above.
My question is wheter it is possible to make by somebody a similar wrapper and nuget package for this library like for example sqlite or UrhoSharp?

They are using the same way to provide the needed functionality in Xamarin: Wrapping a native library into a C# library which can be then easily used in any Xamarin project.

Posts

  • lahellerlaheller USMember ✭✭

    Update:

    Found and built UVCCamera library and using the build output (libuvccamera-XXX.aar) finally created an AAR binding library.

    Example app coming soon...

  • lahellerlaheller USMember ✭✭

    Progress update #1:

    There was a little problem with the original library since in its source code there were missing classes. Author of original library fortunately has these classes in a separate repository, so I only had to add these missing classes and rebuild the whole UVCCamera library. Then create a Xamarin bindings library.

    Now in my test Xamarin app I am able to detect attach/detach of any USB device to smartphone via OTG cable using the UVCCamera library, since it provides such functionality. Next step it detection of attached USB video/camera device and display live preview.

  • PhilippeTPhilippeT FRMember ✭✭

    Hi, did you succeed to bind this library (UVCCamera) ?
    I would like to display the video take by an medical camera (dental endoscope...)
    Any help would be appreciated ! Ty in advance :)

  • lahellerlaheller USMember ✭✭

    @PhilippeT said:
    Hi, did you succeed to bind this library (UVCCamera) ?
    I would like to display the video take by an medical camera (dental endoscope...)
    Any help would be appreciated ! Ty in advance :)

    Hello

    Actually I have problems with that separate repository. It is required, but there are some binding errors which I am not able to fix.

    In the meantime you can try this app.

  • lahellerlaheller USMember ✭✭
    edited November 10

    Progress update #2:

    Finally I was able to bind both AAR libraries (this and this) in Xamarin!

    But now there is a problem in the test Android application: During build it fails with an error which together with solution is described here. So that error was solved.
    But unfortunately when I try to start deployed application on my smartphone, it fails with following error:

    java.lang.RuntimeException: Unable to get provider mono.MonoRuntimeProvider_1: java.lang.ClassNotFoundException: Didn't find class "mono.MonoRuntimeProvider_1" on path: DexPathList[[zip file "/data/app/XXX.XXXXXX-1/base.apk"],nativeLibraryDirectories=[/data/app/XXX.XXXXXX-1/lib/arm, /vendor/lib, /system/lib]]

    Any idea anybody? If somebody is interested in this topic, I can upload to github what I did so far.

  • lahellerlaheller USMember ✭✭

    Progress update #2:

    Finally I was able to bind both AAR libraries (this and this) in Xamarin!

    But now there is a problem in the test Android application: During build it fails with an error which together with solution is described here. So that error was solved.
    But unfortunately when I try to start deployed application on my smartphone, it fails with following error:

    java.lang.RuntimeException: Unable to get provider mono.MonoRuntimeProvider_1: java.lang.ClassNotFoundException: Didn't find class "mono.MonoRuntimeProvider_1" on path: DexPathList[[zip file "/data/app/XXX.XXXXXX-1/base.apk"],nativeLibraryDirectories=[/data/app/XXX.XXXXXX-1/lib/arm, /vendor/lib, /system/lib]]

    Any idea anybody? If somebody is interested in this topic, I can upload to github what I did so far.

Sign In or Register to comment.