Androz2091 / discord-player

🎧 Complete framework to simplify the implementation of music commands using discord.js v14
https://discord-player.js.org/
MIT License
605 stars 191 forks source link

Add ffmpegPath option #1933

Closed retrouser955 closed 3 months ago

retrouser955 commented 3 months ago

Changes

Add ffmpegPath option to player instead of setting the path via process.env.FFMPEG_PATH

Status

vercel[bot] commented 3 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment | Name | Status | Preview | Comments | Updated (UTC) | | :--- | :----- | :------ | :------- | :------ | | **discord-player-website** | ⬜️ Ignored ([Inspect](https://vercel.com/androz2091s-projects/discord-player-website/BmYrXh7Nfb1ayZjpuBtZ6YwcAcgM)) | [Visit Preview](https://discord-player-website-git-add-ffmp-76a4bf-androz2091s-projects.vercel.app) | | Aug 4, 2024 9:13am |
retrouser955 commented 3 months ago

Seems to work with the music bot inside the monorepo

        this.player = new Player(this as any, {
            ytdlOptions: {
                requestOptions: {
                    headers: {
                        cookie: process.env.YOUTUBE_COOKIE
                    }
                }
            },
            skipFFmpeg: true,
            ffmpegPath: `${__dirname}/lib`
        });
        console.log(`FFMPEG PATH IS: ${process.env.FFMPEG_PATH}`)
                // Actually log: FFMPEG PATH IS: __dirname/lib

But tests are failing

    it("should set process.env.FFMPEG_PATH to given path", () => {
        // not actual ffmpeg path. just dummy
        new Player(client, {
            ffmpegPath: "./packages/ffmpeg"
        })

        expect(process.env.FFMPEG_PATH).toBe("./packages/ffmpeg")
    })
    // error
retrouser955 commented 3 months ago
test("should set process.env.FFMPEG_PATH to given path", () => {
  // not actual ffmpeg path. just dummy
  new Player(client, {
      ffmpegPath: "./packages/ffmpeg",
      ignoreInstance: true
  })

  expect(process.env.FFMPEG_PATH).toBe("./packages/ffmpeg")
})

does this work?

Yup works.