#javascript #electron-builder #electron-vue
Вопрос:
Поэтому я создал электронное приложение, которое откроет камеру и отсканирует QR-код, это плагин, который я использую https://github.com/schmich/instascan. HTML-файлах было сделано с использованием Vue и проверенные выходной и я могу увидеть, что камера работает, но при переносе на Raspberry Пи 3 B и составления электронного приложения "npm run start"
, теперь он не может найти никаких камер, (ИРЦ камера работает и тестируется на 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();
})();
Любая помощь, идеи, предложения высоко ценятся. Заранее спасибо.