ysdragon / StreamBot

A self bot to stream videos to Discord.
Other
76 stars 16 forks source link

bot joins, starts streaming without showing anything, and immediately leaves #26

Closed Kekulism closed 4 months ago

Kekulism commented 4 months ago

Having the same issue that asd3344 previously reported, but unlike the previous issue, I am experiencing this on Linux rather than on Windows. Linux Mint specifically, on a Virtual Machine. Whether playing a movie or a youtube video, the bot will join the vc, start streaming (notably without loading any visuals or audio), and then immediately leave the VC.

UVClay commented 4 months ago

Had the same issue on Rocky Linux. To get a better idea of the error, open up src/index.ts and make the following change:

async function playVideo(video: string, udpConn: MediaUdp, options: any) {
    console.log("Started playing video");

    udpConn.mediaConnection.setSpeaking(true);
    udpConn.mediaConnection.setVideoStatus(true);

    try {
        let videoStream = streamLivestreamVideo(video, udpConn, options);

        command?.on('progress', handleProgress);

        const res = await videoStream;
        console.log("Finished playing video");
    } catch (error) {
        console.log(error) //This change here specifically
    } finally {
        udpConn.mediaConnection.setSpeaking(false);
        udpConn.mediaConnection.setVideoStatus(false);
        command?.kill("SIGKILL");
        sendFinishMessage();
        cleanupStreamStatus();
    }   
}

That change should be at line 463. (Might be worth adding to the code in general imo)

My issue was that discord-js/opus failed to build properly. I re-cloned the repo, re-ran bun install and got another error that I was missing g++. Make sure you have ffmpeg, gcc, g++, and make installed

ysdragon commented 4 months ago

As @UVClay said, make sure to have ffmpeg, make, gcc, and g++ installed. If you are using Linux Mint, you should run

apt -y install build-essential ffmpeg