Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Probelm with WebcamCompositeDriver #935

Closed
YoussefHachicha opened this issue Jul 24, 2024 · 1 comment
Closed

Probelm with WebcamCompositeDriver #935

YoussefHachicha opened this issue Jul 24, 2024 · 1 comment

Comments

@YoussefHachicha
Copy link

YoussefHachicha commented Jul 24, 2024

Versions:
webcam-capture = "0.3.12"
koltin = "2.0.0"

Reproduction Code:

@Composable
actual fun rememberCameraManager(onResult: (SharedImage?) -> Unit): CameraManager {
    val window = JFrame()

    Webcam.setDriver(WebcamCompositeDriver())

    val webcam = Webcam.getDefault().apply {
        setCustomViewSizes(Dimension(320, 240))
        setViewSize(Dimension(320, 240))
    }

    val panel = WebcamPanel(webcam).apply {
        isImageSizeDisplayed = true
        isMirrored = true
    }

    with(window){
        add(panel)
        pack()
        setLocationRelativeTo(null)
    }

    return remember {
        CameraManager(
            onLaunch = {
                window.isVisible = true
            }
        )
    }
}

affected Platfroms:
-only desktop since the code is platform-specific haven't tested for Windows and Linux

Notes:
when I set the driver on Dummy like so Webcam.setDriver(WebcamDummyDriver(90)) the app will not crash but it will not show the webcam
Screenshot 2024-07-24 at 6 19 44 PM

Exception:
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "com.github.sarxos.webcam.Webcam.setCustomViewSizes(java.awt.Dimension[])" because "$this$rememberCameraManager_u24lambda_u240" is null

What have I tried:
I tried using Webcam.setDriver(WebcamDefaultDriver()) but it came up with an other exception:

ava.lang.RuntimeException: Failed to initialize BridJ (java.lang.UnsatisfiedLinkError: /private/var/folders/c1/kkf74nkd5_xgqsg55vrry__m0000gn/T/BridJExtractedLibraries673974653850279251/libbridj.dylib: dlopen(/private/var/folders/c1/kkf74nkd5_xgqsg55vrry__m0000gn/T/BridJExtractedLibraries673974653850279251/libbridj.dylib, 0x0001): tried: '/private/var/folders/c1/kkf74nkd5_xgqsg55vrry__m0000gn/T/BridJExtractedLibraries673974653850279251/libbridj.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/private/var/folders/c1/kkf74nkd5_xgqsg55vrry__m0000gn/T/BridJExtractedLibraries673974653850279251/libbridj.dylib' (no such file), '/private/var/folders/c1/kkf74nkd5_xgqsg55vrry__m0000gn/T/BridJExtractedLibraries673974653850279251/libbridj.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')))
at org.bridj.Platform.initLibrary(Platform.java:444)
at org.bridj.Platform.(Platform.java:228)
at com.github.sarxos.webcam.ds.buildin.natives.OpenIMAJGrabber.(OpenIMAJGrabber.java:59)
at com.github.sarxos.webcam.ds.buildin.WebcamDefaultDriver$WebcamNewGrabberTask.handle(WebcamDefaultDriver.java:55)
at com.github.sarxos.webcam.WebcamProcessor$AtomicProcessor.run(WebcamProcessor.java:81)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.UnsatisfiedLinkError: /private/var/folders/c1/kkf74nkd5_xgqsg55vrry__m0000gn/T/BridJExtractedLibraries673974653850279251/libbridj.dylib: dlopen(/private/var/folders/c1/kkf74nkd5_xgqsg55vrry__m0000gn/T/BridJExtractedLibraries673974653850279251/libbridj.dylib, 0x0001): tried: '/private/var/folders/c1/kkf74nkd5_xgqsg55vrry__m0000gn/T/BridJExtractedLibraries673974653850279251/libbridj.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/private/var/folders/c1/kkf74nkd5_xgqsg55vrry__m0000gn/T/BridJExtractedLibraries673974653850279251/libbridj.dylib' (no such file), '/private/var/folders/c1/kkf74nkd5_xgqsg55vrry__m0000gn/T/BridJExtractedLibraries673974653850279251/libbridj.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64'))
at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(Unknown Source)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(Unknown Source)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(Unknown Source)
Caused by: java.lang.UnsatisfiedLinkError: /private/var/folders/c1/kkf74nkd5_xgqsg55vrry__m0000gn/T/BridJExtractedLibraries673974653850279251/libbridj.dylib: dlopen(/private/var/folders/c1/kkf74nkd5_xgqsg55vrry__m0000gn/T/BridJExtractedLibraries673974653850279251/libbridj.dylib, 0x0001): tried: '/private/var/folders/c1/kkf74nkd5_xgqsg55vrry__m0000gn/T/BridJExtractedLibraries673974653850279251/libbridj.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/private/var/folders/c1/kkf74nkd5_xgqsg55vrry__m0000gn/T/BridJExtractedLibraries673974653850279251/libbridj.dylib' (no such file), '/private/var/folders/c1/kkf74nkd5_xgqsg55vrry__m0000gn/T/BridJExtractedLibraries673974653850279251/libbridj.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64'))

at java.base/java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.base/java.lang.Runtime.load0(Unknown Source)
at java.base/java.lang.System.load(Unknown Source)
at org.bridj.Platform.initLibrary(Platform.java:420)
... 7 more

Exception in thread "main" com.github.sarxos.webcam.WebcamException: java.util.concurrent.ExecutionException: com.github.sarxos.webcam.WebcamException: Cannot execute task
at com.github.sarxos.webcam.WebcamDiscoveryService.getWebcams(WebcamDiscoveryService.java:124)
at com.github.sarxos.webcam.Webcam.getWebcams(Webcam.java:893)
at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:956)
at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:933)
at com.github.sarxos.webcam.Webcam.getDefault(Webcam.java:911)
at shared.CameraManager_desktopKt.rememberCameraManager(CameraManager.desktop.kt:25)

@YoussefHachicha YoussefHachicha changed the title Cannot invoke webcam becuae u24lambda_u240" is null Probelm with WebcamCompositeDriver Jul 24, 2024
@YoussefHachicha
Copy link
Author

this solved my issue :
#907

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant