mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 18:41:47 +00:00
dont send callback on playPause() if still handling data from new song
fix notifications showing thumbnail of last song
This commit is contained in:
@ -86,10 +86,14 @@ const registerCallback = (callback) => {
|
|||||||
callbacks.push(callback);
|
callbacks.push(callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let handlingData = false;
|
||||||
|
|
||||||
const registerProvider = (win) => {
|
const registerProvider = (win) => {
|
||||||
// This will be called when the song-info-front finds a new request with song data
|
// This will be called when the song-info-front finds a new request with song data
|
||||||
ipcMain.on("video-src-changed", async (_, responseText) => {
|
ipcMain.on("video-src-changed", async (_, responseText) => {
|
||||||
|
handlingData = true;
|
||||||
await handleData(responseText, win);
|
await handleData(responseText, win);
|
||||||
|
handlingData = false;
|
||||||
callbacks.forEach((c) => {
|
callbacks.forEach((c) => {
|
||||||
c(songInfo);
|
c(songInfo);
|
||||||
});
|
});
|
||||||
@ -97,6 +101,7 @@ const registerProvider = (win) => {
|
|||||||
ipcMain.on("playPaused", (_, { isPaused, elapsedSeconds }) => {
|
ipcMain.on("playPaused", (_, { isPaused, elapsedSeconds }) => {
|
||||||
songInfo.isPaused = isPaused;
|
songInfo.isPaused = isPaused;
|
||||||
songInfo.elapsedSeconds = elapsedSeconds;
|
songInfo.elapsedSeconds = elapsedSeconds;
|
||||||
|
if (handlingData) return;
|
||||||
callbacks.forEach((c) => {
|
callbacks.forEach((c) => {
|
||||||
c(songInfo);
|
c(songInfo);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user