th-ch / youtube-music

YouTube Music Desktop App bundled with custom plugins (and built-in ad blocker / downloader)
https://th-ch.github.io/youtube-music/
MIT License
7.02k stars 427 forks source link

[Bug]: When using DEV no song info on start #2201

Open Johannes7k75 opened 5 days ago

Johannes7k75 commented 5 days ago

Preflight Checklist

YouTube Music (Application) Version

3.3.12 DEV

Checklists

What operating system are you using?

Windows

Operating System Version

Windows 11 Pro 23H2

What CPU architecture are you using?

x64

Last Known Working YouTube Music (Application) version

No response

Reproduction steps

  1. Setup a dev version of ytm
  2. run pnpm run dev
  3. add a new Plugin that sends on registerCallback a console.log of songinfo

Expected Behavior

A console.log where the songinfo is send as a json object

Actual Behavior

No console.log of songInfo on start After first skip / song change the song info is logged correcly

Enabled plugins

  1. CustomPlugin

Additional Information

This only appears when using it in development when using pnpm run start it, the behavior disappears

CustomPlugin

// plugins/custom-plugin/index.ts
import { createPlugin } from "@/utils";
import registerCallback from "@/providers/song-info";

export default createPlugin({
  name: () => "Custom plugin",
  description: () => "Custom test plugin",
  restartNeeded: false,

  renderer: {
    onPlayerApiReady(playerApi, context) {
        context.ipc.on("testLog", (message: string) => console.log("TestLog: " + message));
    },
  },

  backend: {
    start: (ctx) => {
      registerCallback((songInfo) => {
        console.log("Song info changed", songInfo);
        ctx.window.webContents.send("testLog", `songInfo: ${JSON.stringify(songInfo)}`);
      });
    }
  }
});