diff --git a/electron/src/setup.ts b/electron/src/setup.ts
index 3217e8f..46e310e 100644
--- a/electron/src/setup.ts
+++ b/electron/src/setup.ts
@@ -132,8 +132,7 @@ export class ElectronCapacitorApp {
},
});
this.mainWindowState.manage(this.MainWindow);
- this.MainWindow.webContents.postMessage("port", null, [this.channels.port1]);
- Actions.setVideoWindowPort(this.channels.port2);
+ Actions.setMainWindow(this.MainWindow);
if (this.CapacitorFileConfig.backgroundColor) {
this.MainWindow.setBackgroundColor(this.CapacitorFileConfig.electron.backgroundColor);
diff --git a/locales/de/common.json b/locales/de/common.json
index 9a48513..b1715bb 100644
--- a/locales/de/common.json
+++ b/locales/de/common.json
@@ -1,5 +1,15 @@
{
"app": {
"title": "Easy Youtube"
- }
+ },
+ "form.bottom": "Abstand Unten",
+ "form.id": "Video-ID/Link",
+ "form.left": "Abstand Links",
+ "form.mute": "Stumm",
+ "form.right": "Abstand Rechts",
+ "form.tilt": "Trapez-Korrektur",
+ "form.top": "Abstand Oben",
+ "window.close": "Video schließen",
+ "window.fullscreen": "Vollbild",
+ "window.open": "Video öffnen"
}
diff --git a/locales/en/common.json b/locales/en/common.json
index 9a48513..7e954fb 100644
--- a/locales/en/common.json
+++ b/locales/en/common.json
@@ -1,5 +1,15 @@
{
"app": {
"title": "Easy Youtube"
- }
+ },
+ "form.bottom": "Space Bottom",
+ "form.id": "Video-ID/Link",
+ "form.left": "Space Left",
+ "form.mute": "Mute",
+ "form.right": "Space Right",
+ "form.tilt": "Tilt",
+ "form.top": "Space Top",
+ "window.close": "Close Video",
+ "window.fullscreen": "Fullscreen",
+ "window.open": "Open Video"
}
diff --git a/package.json b/package.json
index f83a06a..767e2c5 100644
--- a/package.json
+++ b/package.json
@@ -14,7 +14,7 @@
"eslint:fix": "npm run eslint -- --fix",
"postinstall": "patch-package && cd electron && npm install && cd ..",
"electron:prepare": "cp -f src/electron/Actions.ts src/electron/Bridge.ts electron/src/ && bin/export.sh",
- "electron": "npm run electron:prepare && cap sync @capacitor-community/electron && cap open @capacitor-community/electron",
+ "electron": "export ELECTRON_ENABLE_LOGGING=1 && npm run electron:prepare && cap sync @capacitor-community/electron && cd electron && npm run electron:start",
"electron:copy": "npm run electron:prepare && cap copy @capacitor-community/electron",
"electron:pack": "npm run electron:prepare && cap copy @capacitor-community/electron && cd electron && npm run electron:pack && cd .."
},
diff --git a/src/electron/Actions.ts b/src/electron/Actions.ts
index 760f97f..5eddb82 100644
--- a/src/electron/Actions.ts
+++ b/src/electron/Actions.ts
@@ -1,17 +1,16 @@
-import { BrowserWindow, app } from "electron";
+import { BrowserWindow, MessageChannelMain, app } from "electron";
import { join } from "path";
-import type { MessagePortMain } from "electron";
let videoWindow: BrowserWindow | undefined;
let isDev = false;
-let videoWindowPort: MessagePortMain | undefined;
+let mainWindow: BrowserWindow | undefined;
export const Actions = {
setIsDev(newIsDev: boolean) {
isDev = newIsDev;
},
- setVideoWindowPort(port: MessagePortMain) {
- videoWindowPort = port;
+ setMainWindow(newMainWindow: BrowserWindow) {
+ mainWindow = newMainWindow;
},
startNewWindow: async (videoId: string) => {
const preloadPath = join(app.getAppPath(), 'build', 'src', 'preload.js');
@@ -20,6 +19,7 @@ export const Actions = {
try {
videoWindow.close();
} catch (e) {
+ console.error(e);
}
}
@@ -36,16 +36,18 @@ export const Actions = {
}
await videoWindow.loadURL(`capacitor-electron://app/fullscreen.html?id=${videoId}`);
- if (videoWindowPort) {
- videoWindow.webContents.postMessage("port", null, [videoWindowPort]);
+ if (mainWindow) {
+ const newChannel = new MessageChannelMain();
+ mainWindow.webContents.postMessage("port", null, [newChannel.port1]);
+ videoWindow.webContents.postMessage("port", null, [newChannel.port2]);
}
},
closeVideoWindow() {
if (videoWindow) {
try {
-
videoWindow.close();
} catch (e) {
+ console.error(e);
}
videoWindow = undefined;
}
diff --git a/src/pages/index.tsx b/src/pages/index.tsx
index 9c55e26..294e217 100644
--- a/src/pages/index.tsx
+++ b/src/pages/index.tsx
@@ -51,7 +51,7 @@ function Index(_: IndexProps) {
Actions.startNewWindow(id);
Bridge.send("dimensions", dimension);
Bridge.send("tilt", tilt);
- }, [dimension, id]);
+ }, [dimension, id, tilt]);
const closeWindow = useCallback(() => {
Actions.closeVideoWindow();
@@ -210,6 +210,7 @@ function Index(_: IndexProps) {
+ {t("form.tilt")}
@@ -249,7 +250,8 @@ function Index(_: IndexProps) {
+ max={duration}
+ />