Open KuntilBogel opened 7 months ago
Wrote a snippet that does what you are looking for some time ago: https://github.com/dank074/Discord-video-stream/issues/16#issuecomment-1659295075
Ah thanks!
@dank074 Heya, when I'm using the solution on the provided comment I still can't stop the video, console.log(command) is giving me undefined even though there's already a stream ongoing
Also some words about code quality:
Seeing command
being a "global" variable like that makes me uncomfortable. Maybe we can return the command directly from streamLivestreamVideo
instead?
Also some words about code quality: Seeing
command
being a "global" variable like that makes me uncomfortable. Maybe we can return the command directly fromstreamLivestreamVideo
instead?
Yeah we can definitely do that. I think I originally did it that way because the promise in streamLivestreamVideo
doesn't resolve until the video is done streaming or errors. Need to think of a better way to do it
Maybe
let command;
const playback = new Promise(/* do stuff */);
return { playback, command }
Or use p-cancelable
, and completely hide the command from the user.
heya is there anyway to stop a stream, replace the streamed video with a new one and start streaming again thanks, I've tried using command.kill but command is always undefined