在树莓派上找不到electronjs相机

问题描述

所以我创建了一个电子应用程序,可以打开相机并扫描二维码,这是我使用的插件https://github.com/schmich/instascan。 html 文件是使用 Vue 完成的并测试了输出,我可以看到相机正在工作,但是当在 raspberry pi 3 b+ 上传输并编译电子应用程序 "npm run start" 时,现在它找不到任何相机,(RPi相机正在 html 部分工作和测试),下面的代码是我对主进程的尝试

'use strict';
const path = require('path');
const { app,BrowserWindow,Menu,globalShortcut} = require('electron');
const unhandled = require('electron-unhandled');
const debug = require('electron-debug');
const {is} = require('electron-util');

unhandled();
debug();
contextMenu();

// Note: Must match `build.appId` in package.json
app.setAppUserModelId('com.pixzeldigital.attrfidqrcode');

// Prevent window from being garbage collected
let mainWindow;

const createMainWindow = async () => {

    const win = new BrowserWindow({
        title: app.name,show: false,width: 1024,height: 768,frame: false
    });

    win.on('ready-to-show',() => {
        win.maximize();
        win.show();
    });

    win.on('closed',() => {
        // Dereference the window
        // For multiple windows store them in an array
        mainWindow = undefined;
    });

    await win.loadFile(path.join(__dirname,'vue/dist/index.html'));

    return win;
};

// Prevent multiple instances of the app
if (!app.requestSingleInstanceLock()) {
    app.quit();
}

app.on('second-instance',() => {
    if (mainWindow) {
        if (mainWindow.isMinimized()) {
            mainWindow.restore();
        }

        mainWindow.show();
    }
});

app.on('window-all-closed',() => {
    if (!is.macos) {
        app.quit();
    }
});

app.on('activate',async () => {
    if (!mainWindow) {
        mainWindow = await createMainWindow();
    }
});

app.on('ready',() => {
    // Register a shortcut listener for Ctrl + Shift + I
    globalShortcut.register('Control+Shift+I',() => {
        // When the user presses Ctrl + Shift + I,this function will get called
        // You can modify this function to do other things,but if you just want
        // to disable the shortcut,you can just return false
        return false;
    });
});

(async () => {
    await app.whenReady();
    Menu.setApplicationMenu(null);
    mainWindow = await createMainWindow();
})();

非常感谢任何帮助、想法和建议。提前致谢。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...