From 8f2854a6d503f99e9fad2e2d6a39082a08b4b376 Mon Sep 17 00:00:00 2001 From: Glen Chiacchieri Date: Wed, 12 Feb 2020 22:42:04 +0100 Subject: [PATCH] Make 'pause after song' work fixes MarshallOfSound/Google-Play-Music-Desktop-Player-UNOFFICIAL-#3383 --- .../windows/GPMWebView/interface/generic/pauseAfter.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/renderer/windows/GPMWebView/interface/generic/pauseAfter.js b/src/renderer/windows/GPMWebView/interface/generic/pauseAfter.js index e50edb17f..244dd9ca1 100644 --- a/src/renderer/windows/GPMWebView/interface/generic/pauseAfter.js +++ b/src/renderer/windows/GPMWebView/interface/generic/pauseAfter.js @@ -8,6 +8,9 @@ window.wait(() => { GPM.on('change:track', () => { if (pauseAfter === PAUSE_NEXT) { GPM.playback.playPause(); + // because change:track is sometimes triggered twice in a row, it's good to set pauseAfter here + // so a track doesn't get playPaused() then immediately playPaused() again. + pauseAfter = DONT_PAUSE; Emitter.fireAtGoogle('pauseAfter:hide', null); } if (pauseAfter === PAUSE_AFTER) { @@ -26,7 +29,7 @@ Emitter.on('pauseAfter:show', () => { return false; }, (toast) => { - pauseAfter = PAUSE_AFTER; + pauseAfter = PAUSE_NEXT; Emitter.on('pauseAfter:hide', () => { pauseAfter = DONT_PAUSE; toast.hide();