From 169b28ab3311c22101cb5417b921c7b50fa554f1 Mon Sep 17 00:00:00 2001 From: hunlongyu Date: Mon, 25 May 2020 18:23:03 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=A6=20=E6=92=AD=E6=94=BE=E9=80=9F?= =?UTF-8?q?=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/background.js | 17 ++++++++++++++++- src/components/Play.vue | 25 +++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/src/background.js b/src/background.js index 60caccb..adccab1 100644 --- a/src/background.js +++ b/src/background.js @@ -75,7 +75,6 @@ function createMini () { } app.allowRendererProcessReuse = true -app.commandLine.appendSwitch('--no-sandbox') app.on('window-all-closed', () => { if (process.platform !== 'darwin') { @@ -154,6 +153,22 @@ if (!gotTheLock) { mini.webContents.send('down', 0) } }) + globalShortcut.register('shift+up', function () { + if (win) { + win.webContents.send('playbackRateUp', 0) + } + if (mini) { + mini.webContents.send('playbackRateUp', 0) + } + }) + globalShortcut.register('shift+down', function () { + if (win) { + win.webContents.send('playbackRateDown', 0) + } + if (mini) { + mini.webContents.send('playbackRateDown', 0) + } + }) if (!process.env.WEBPACK_DEV_SERVER_URL) { createProtocol('app') } diff --git a/src/components/Play.vue b/src/components/Play.vue index 5fbfc32..88226e4 100644 --- a/src/components/Play.vue +++ b/src/components/Play.vue @@ -411,6 +411,15 @@ export default { this.right.historyData = e.reverse() }) }) + }, + playbackRateEvent (e) { + let rate = this.xg.playbackRate + if (rate > 0.25) { + rate = rate + e + this.xg.playbackRate = rate + // this.xg.video.playbackRate = rate + console.log(rate, 'rate') + } } }, mounted () { @@ -432,6 +441,22 @@ export default { } } }) + ipc.on('playbackRateUp', () => { + console.log('opacity up') + if (this.xg) { + if (this.xg.hasStart) { + this.playbackRateEvent(0.25) + } + } + }) + ipc.on('playbackRateDown', () => { + console.log('opacity down') + if (this.xg) { + if (this.xg.hasStart) { + this.playbackRateEvent(-0.25) + } + } + }) } }