feat(api-server): remote control api (#1909)

Co-authored-by: JellyBrick <shlee1503@naver.com>
Co-authored-by: Angelos Bouklis <angelbouklis.official@gmail.com>
Co-authored-by: Angelos Bouklis <me@arjix.dev>
Co-authored-by: Angelos Bouklis <53124886+ArjixWasTaken@users.noreply.github.com>
This commit is contained in:
Su-Yong
2024-10-13 19:10:12 +09:00
committed by GitHub
parent d07dae2542
commit 9ba8913da7
22 changed files with 1043 additions and 1 deletions

View File

@ -53,6 +53,12 @@ async function onApiLoaded() {
window.ipcRenderer.on('ytmd:next-video', () => {
document.querySelector<HTMLElement>('.next-button.ytmusic-player-bar')?.click();
});
window.ipcRenderer.on('ytmd:play', (_) => {
api?.playVideo();
});
window.ipcRenderer.on('ytmd:pause', (_) => {
api?.pauseVideo();
});
window.ipcRenderer.on('ytmd:toggle-play', (_) => {
if (api?.getPlayerState() === 2) api?.playVideo();
else api?.pauseVideo();