💦 播放速度

This commit is contained in:
hunlongyu
2020-05-25 18:23:03 +08:00
parent cbcffd7587
commit 169b28ab33
2 changed files with 41 additions and 1 deletions

View File

@@ -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')
}

View File

@@ -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)
}
}
})
}
}
</script>