Create StreamVideo.js

This commit is contained in:
Elysia 2024-01-15 19:10:26 +07:00
parent deab0d3440
commit 41169bdd5c

30
examples/StreamVideo.js Normal file
View File

@ -0,0 +1,30 @@
const Discord = require('../src/index');
const { DiscordStreamClient } = require('discord-stream-client');
const client = new Discord.Client();
new DiscordStreamClient(client);
client.on('ready', async client => {
console.log('Ready!', client.user.tag);
const channel = client.channels.cache.get('id');
const connection = await client.streamClient.joinVoiceChannel(channel, {
selfDeaf: true,
selfMute: true,
selfVideo: false,
});
const stream = await connection.createStream();
const player = client.streamClient.createPlayer(
'https://cdn.discordapp.com/attachments/820557032016969751/1196424904384446605/Yooh_MariannE.mp4',
stream.udp,
);
player.on('error', err => console.error(err));
player.play({
kbpsVideo: 7000, // FHD 60fps
fps: 60,
hwaccel: true,
kbpsAudio: 128,
volume: 1,
});
});
client.login('token');