Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stream loading #82

Open
TheShizuka opened this issue Apr 10, 2024 · 2 comments
Open

stream loading #82

TheShizuka opened this issue Apr 10, 2024 · 2 comments

Comments

@TheShizuka
Copy link

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
Copy link

Can you provide the video file?

@TheShizuka
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants