dank074 / Discord-video-stream

Experiment for making video streaming work for discord selfbots.
185 stars 35 forks source link

stream loading #82

Open TheShizuka opened 7 months ago

TheShizuka commented 7 months ago

hello i have an issue were the bot joins the chat, starts streaming but the stream just loads, nothing shows, i know its picking up the right file bcs the duration of the stream corresponds to the duration of the video. Tried with different videos and formats but nothing seem to work, can someone help pls. here is the code adapted to my bot, i have differnet files for each command

`const { Client } = require('discord.js-selfbot-v13'); const { Streamer, streamLivestreamVideo } = require('@dank074/discord-video-stream'); const config = require('./config.json');

module.exports = { name: 'streamvideo', category: 'voice', permissions: ['CONNECT', 'SPEAK'], devOnly: false, run: async ({ client, message, args }) => { const voiceChannelId = "962032795176304710"; const guildId = message.guild.id;

    // Debugging: Log the attempt to stream
    console.log(`Attempting to stream video in guild: ${guildId}, channel: ${voiceChannelId}`);

    try {
        const streamer = new Streamer(client);

        // Debugging: Log successful creation of the Streamer instance
        console.log('Streamer instance created successfully.');

        await streamer.joinVoice(guildId, voiceChannelId);

        // Debugging: Log successful voice channel join
        console.log(`Joined voice channel ${voiceChannelId} successfully.`);

        const streamUdpConn = await streamer.createStream();

        // Debugging: Log successful stream creation
        console.log('Stream created successfully.');

        const videoPath = "commands/ent/video/test3.mp4"; // Ensure this path is correct

        // Debugging: Log the video path
        console.log(`Streaming video from path: ${videoPath}`);

        const res = await streamLivestreamVideo(videoPath, streamUdpConn, true);
        console.log('Finished streaming video:', res);

        // Optionally, handle stopping the stream and leaving the voice channel
        streamer.leaveVoice();
    } catch (error) {
        // Enhanced error logging
        console.error('Error encountered during video streaming:', error.message, error.stack);
        message.reply('There was an error streaming the video. Check the server logs for more details.');
    }
},

}; `

longnguyen2004 commented 7 months ago

Can you provide the video file?

TheShizuka commented 7 months ago

oops my bad i missclicked, here is the video, its just a test video from a game, i tried with multiple formats tho. https://drive.google.com/file/d/1MxFMEVEdIYRYnyN7fNQL-JgVXY6KWJlv/view?usp=sharing link bcs the video is too long