aiko-chan-ai / Discord-video-selfbot

for djs-selfbot-v13
https://github.com/dank074/Discord-video-stream
33 stars 8 forks source link

its now joining the channel but after 5s it leave without starting the screen #3

Closed Turkidev closed 1 year ago

Turkidev commented 1 year ago
                case 'stream':
                    async function startStreaming() {
                        const { DiscordStreamClient } = await import('discord-stream-client');
                        const StreamClient = new DiscordStreamClient(client);

                        const voiceChannel = message.member.voice.channel;
                        if (!voiceChannel) {
                            return message.channel.send('You need to join a voice channel first!');
                        }

                        const voiceConnection = await StreamClient.joinVoiceChannel(voiceChannel, {
                            selfDeaf: false,
                            selfMute: false,
                            selfVideo: false,
                        });

                        const streamConnection = await voiceConnection.createStream();

                        const player = StreamClient.createPlayer(
                            'https://dl2.issou.best/ordr/videos/render1046454.mp4', // DIRECT VIDEO URL OR READABLE STREAM HERE
                            streamConnection.udp, // UDP connection
                        );

                        player.play();

                        setTimeout(() => {
                            StreamClient.pauseScreenShare(true);
                        }, 30_000);

                        message.channel.send(`Streaming started at ${voiceChannel}`);
                    }

                    startStreaming().catch((error) => {
                        console.error('Error starting stream:', error);
                    });
                    break;
aiko-chan-ai commented 1 year ago

image

idk .-.

Turkidev commented 1 year ago

is it this?

aiko-chan-ai commented 1 year ago

yep...

import { Client } from 'discord.js-selfbot-v13';
import { DiscordStreamClient } from './src/index.js';

const client = new Client();
const StreamClient = new DiscordStreamClient(client);

const token = 'token';

client.login(token);

client.on('ready', async () => {
    // Connect to a voice channel
    const voiceConnection = await StreamClient.joinVoiceChannel(
        client.channels.cache.get('channel id'),
        {
            selfDeaf: false,
            selfMute: true,
            selfVideo: false,
        },
    );
    // I want to use screen sharing ...
    const streamConnection = await voiceConnection.createStream();
    // Create a player
    const player = StreamClient.createPlayer(
        'https://dl2.issou.best/ordr/videos/render1046454.mp4',
        streamConnection.udp,
    );
    // Events
    player.on('finish', () => {
        console.log('Finished playing');
    });
    // Play video !!!
    player.play(10000);
    /*
    // Display `User paused screen sharing` after 5 seconds
    setTimeout(() => {
        StreamClient.pauseScreenShare(true);
    }, 5_000);
    // But I want to use the webcam...
    StreamClient.signalVoiceChannel({
        selfVideo: true,
        selfMute: false,
    });
    // Create a different player
    const player_ = StreamClient.createPlayer(
        'https://dl2.issou.best/ordr/videos/render1046454.mp4',
        voiceConnection.udp,
    );
    // Events
    player_.on('finish', () => {
        console.log('Finished playing');
    });
    // Play video !!!
    player_.play();
    // Stop playing after 10 seconds
    setTimeout(() => {
        // Stop playing Screen sharing
        player.stop();
        // Stop playing Webcam
        player_.stop();
        // Disconnect from the voice channel
        StreamClient.leaveVoiceChannel();
    }, 10_000);
    */
});
Turkidev commented 1 year ago

i got this error

Error: Voice connection timeout

aiko-chan-ai commented 1 year ago

...

Turkidev commented 1 year ago

,__,