Merge remote-tracking branch 'upstream/master' into fix-playback-speed-plugin

This commit is contained in:
Araxeus
2021-11-01 18:07:54 +02:00
18 changed files with 91 additions and 88 deletions

View File

@ -15,5 +15,5 @@ module.exports = () => {
const data = e.detail.getPlayerResponse();
ipcRenderer.send("song-info-request", JSON.stringify(data));
});
})
}, { once: true, passive: true })
};

View File

@ -2,6 +2,8 @@ const { ipcMain, nativeImage } = require("electron");
const fetch = require("node-fetch");
const config = require("../config");
// Grab the progress using the selector
const getProgress = async (win) => {
// Get current value of the progressbar element
@ -56,6 +58,9 @@ const handleData = async (responseText, win) => {
songInfo.uploadDate = data?.microformat?.microformatDataRenderer?.uploadDate;
songInfo.url = data?.microformat?.microformatDataRenderer?.urlCanonical?.split("&")[0];
// used for options.resumeOnStart
config.set("url", data?.microformat?.microformatDataRenderer?.urlCanonical);
win.webContents.send("update-song-info", JSON.stringify(songInfo));
};

View File

@ -1,22 +0,0 @@
let videoElement = null;
module.exports.ontimeupdate = (cb) => {
const observer = new MutationObserver((mutations, observer) => {
if (!videoElement) {
videoElement = document.querySelector("video");
if (videoElement) {
observer.disconnect();
videoElement.ontimeupdate = () => cb(videoElement);
}
}
});
if (!videoElement) {
observer.observe(document, {
childList: true,
subtree: true,
});
} else {
videoElement.ontimeupdate = () => cb(videoElement);
}
};