mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-13 11:21:46 +00:00
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:
@ -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();
|
||||
|
||||
Reference in New Issue
Block a user