From 41169bdd5c35f979f9a82bef14264e7e111b65ee Mon Sep 17 00:00:00 2001 From: Elysia <71698422+aiko-chan-ai@users.noreply.github.com> Date: Mon, 15 Jan 2024 19:10:26 +0700 Subject: [PATCH] Create StreamVideo.js --- examples/StreamVideo.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 examples/StreamVideo.js diff --git a/examples/StreamVideo.js b/examples/StreamVideo.js new file mode 100644 index 00000000..39e0bb3 --- /dev/null +++ b/examples/StreamVideo.js @@ -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');