Skip to content

UVC_ERROR_ACCESS on macOS Monterey and Ubuntu (on Raspberry Pi 4) #2

Open
@pandres95

Description

@pandres95

I'm trying to use [email protected] under the following environment:

OS: macOS Monterey (version 12.1 (21C52)),
Node version(s): v14.18.3, v16.13.2
libuvc version: 0.0.6.

This is the code I'm using so far to test it:

/**
 *
 * @param {import('../src').SendVideoSource} sendVideoSource
 */
async function webcamUVCSignalTest(sendVideoSource) {
    const libuvc = new LibUvc();
    await libuvc.initialize();

    const context = new Context(libuvc);
    await context.initialize();

    const devices = await context.getDeviceList();

    if (!devices.length) {
        return;
    }

    const { device } = await prompts({
        type: 'select',
        name: 'device',
        choices: await Promise.all(devices.map(async device => ({
            title: await device.getDescriptor().then(async d => {
                await d.initialize();
                return d.productName;
            }),
            value: device
        }))),
        message: 'Select the device:'
    });

    await device.initialize();

    const deviceHandle = await device.open(); // <--------- The library fails here
    await deviceHandle.initialize();

    const controls = new Controls(libuvc, deviceHandle);
    await controls.initialize();

    const UVC_AUTO_EXPOSURE_MODE_AUTO = 2;
    const UVC_AUTO_EXPOSURE_MODE_APERTURE_PRIORITY = 8;

    try {
        await controls.ae_mode.set(UVC_AUTO_EXPOSURE_MODE_AUTO);
    } catch (error) {
        if (error.code === "UVC_ERROR_PIPE") {
            await controls.ae_mode.set(UVC_AUTO_EXPOSURE_MODE_APERTURE_PRIORITY);
        } else {
            throw error;
        }
    }

    const frameStreamer = new FrameStreamer(
        libuvc,
        deviceHandle,
        libuvc.constants.uvc_frame_format.UVC_FRAME_FORMAT_MJPEG,
        1280,
        720,
        30
    );
    const frameStream = await frameStreamer.initialize();

    frameStream.pipe(callback((error, data) => {
        if (error) {
            return;
        }

        debugger;
    }))


}

The error I'm getting in the output is the following UVC_ERROR_ACCESS:

Error: this.libuvc.functions.uvc_open(...): -3
    at Device.open (/Users/pandres95/Documents/Development/OSS/node-ndi/bin/node_modules/uvc/src/device.js:67:13)
    at webcamUVCSignalTest (file:///Users/pandres95/Documents/Development/OSS/node-ndi/bin/ndi.js:174:39)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

Screenshot of the complete output message:

Screenshot 2022-01-16 at 3 39 44 PM

Is there something I might be doing wrong, or even something unrelated to my code but related to an issue with how Node accesses to libuvc, maybe?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions