When trying to stream a video, I'm getting the following error:
TypeError: Cannot read properties of null (reading 'pid')
at H264Dispatcher._cleanup (PATH_TO_FOLDER/node_modules/discord.js-selfbot-v13/src/client/voice/dispatcher/BaseDispatcher.js:141:48)
at H264Dispatcher._destroy (PATH_TO_FOLDER/node_modules/discord.js-selfbot-v13/src/client/voice/dispatcher/BaseDispatcher.js:132:10)
at _destroy (node:internal/streams/destroy:122:10)
at H264Dispatcher.destroy (node:internal/streams/destroy:84:5)
at Writable.destroy (node:internal/streams/writable:1120:11)
at finish (node:internal/streams/writable:966:14)
at process.processTicksAndRejections (node:internal/process/task_queues:90:21)
Audio streaming works perfectly fine and the bot has no problem going live, the stream just infinitely buffers
Code sample
import { Streamer, streamLivestreamVideo } from '@dank074/discord-video-stream';
/**
* @param {import('discord.js-selfbot-v13').Client} client
* @param {import('discord.js-selfbot-v13').Channel} channel
*/
export default async function playVideo(client, channel) {
console.log(`${client.user.username} is ready!`);
const connection = await client.voice.joinChannel(channel, {
selfMute: true,
selfDeaf: true,
selfVideo: false, // Turn on the camera? If you turn on the camera, use the connection similar to
// PlayAudio.js, and it will stream video through the camera. This is an implementation of screen sharing.
videoCodec: 'H264',
});
const stream = await connection.createStreamConnection();
const input = 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4';
// Play
const dispatcher = stream.playVideo(input, {
fps: 60,
bitrate: 4000,
});
const dispatcher2 = stream.playAudio(input);
dispatcher.on('start', () => {
console.log('video is now playing!');
});
dispatcher.on('finish', () => {
console.log('video has finished playing!');
});
dispatcher.on('error', console.error);
dispatcher2.on('start', () => {
console.log('audio is now playing!');
});
dispatcher2.on('finish', () => {
console.log('audio has finished playing!');
});
dispatcher2.on('error', console.error);
// Of course, you can also pause the stream using the `pause` function, but remember to pause both video and audio.
}
Package version
^3.3.0
Node.js version
v22.8.0
Operating system
Arch Linux
Priority this issue should have
High (immediate attention needed)
Checklist
[X] I have searched the open issues for duplicates.
[X] I have shared the entire traceback.
[X] I am using a user token (and it isn't visible in the code).
Which package has the bugs?
The core library
Issue description
When trying to stream a video, I'm getting the following error:
Audio streaming works perfectly fine and the bot has no problem going live, the stream just infinitely buffers
Code sample
Package version
^3.3.0
Node.js version
v22.8.0
Operating system
Arch Linux
Priority this issue should have
High (immediate attention needed)
Checklist
Additional Information