Disable playback controls while in external player (#909)
This commit is contained in:
@@ -58,7 +58,7 @@ function init () {
|
||||
*/
|
||||
|
||||
ipc.on('onPlayerOpen', function () {
|
||||
menu.setPlayerOpen(true)
|
||||
menu.togglePlaybackControls(true)
|
||||
powerSaveBlocker.enable()
|
||||
shortcuts.enable()
|
||||
thumbar.enable()
|
||||
@@ -70,7 +70,7 @@ function init () {
|
||||
})
|
||||
|
||||
ipc.on('onPlayerClose', function () {
|
||||
menu.setPlayerOpen(false)
|
||||
menu.togglePlaybackControls(false)
|
||||
powerSaveBlocker.disable()
|
||||
shortcuts.disable()
|
||||
thumbar.disable()
|
||||
@@ -126,7 +126,12 @@ function init () {
|
||||
})
|
||||
})
|
||||
|
||||
ipc.on('openExternalPlayer', (e, ...args) => externalPlayer.spawn(...args))
|
||||
ipc.on('openExternalPlayer', (e, ...args) => {
|
||||
menu.togglePlaybackControls(false)
|
||||
thumbar.disable()
|
||||
externalPlayer.spawn(...args)
|
||||
})
|
||||
|
||||
ipc.on('quitExternalPlayer', () => externalPlayer.kill())
|
||||
|
||||
// Capture all events
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module.exports = {
|
||||
init,
|
||||
setPlayerOpen,
|
||||
togglePlaybackControls,
|
||||
setWindowFocus,
|
||||
setAllowNav,
|
||||
onPlayerUpdate,
|
||||
@@ -24,7 +24,7 @@ function init () {
|
||||
electron.Menu.setApplicationMenu(menu)
|
||||
}
|
||||
|
||||
function setPlayerOpen (flag) {
|
||||
function togglePlaybackControls (flag) {
|
||||
getMenuItem('Play/Pause').enabled = flag
|
||||
getMenuItem('Skip Next').enabled = flag
|
||||
getMenuItem('Skip Previous').enabled = flag
|
||||
|
||||
@@ -87,7 +87,7 @@ module.exports = class PlaybackController {
|
||||
// Play next file in list (if any)
|
||||
nextTrack () {
|
||||
const state = this.state
|
||||
if (Playlist.hasNext(state)) {
|
||||
if (Playlist.hasNext(state) && state.playing.location !== 'external') {
|
||||
this.updatePlayer(
|
||||
state.playing.infoHash, Playlist.getNextIndex(state), false, (err) => {
|
||||
if (err) dispatch('error', err)
|
||||
@@ -99,7 +99,7 @@ module.exports = class PlaybackController {
|
||||
// Play previous track in list (if any)
|
||||
previousTrack () {
|
||||
const state = this.state
|
||||
if (Playlist.hasPrevious(state)) {
|
||||
if (Playlist.hasPrevious(state) && state.playing.location !== 'external') {
|
||||
this.updatePlayer(
|
||||
state.playing.infoHash, Playlist.getPreviousIndex(state), false, (err) => {
|
||||
if (err) dispatch('error', err)
|
||||
|
||||
Reference in New Issue
Block a user