Security News
Introducing the Socket Python SDK
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
@gabrielmaialva33/discord-video-stream
Advanced tools
Experiment for making video streaming work for discord self bots
An open-source Discord lib to stream videos on voice channels.
About | Features | Implementation | Requirements | Usage | FAQS
This project implements the custom Discord UDP protocol for sending media. Since Discord is likely change their custom protocol, this library is subject to break at any point. An effort will be made to keep this library up to date with the latest Discord protocol, but it is not guranteed.
For better stability it is recommended to use WebRTC protocol instead since Discord is forced to adhere to spec, which means that the non-signaling code is guaranteed to work.
go live
, or webcam video)What I implemented and what I did not.
Extensions supported by Discord (taken from the webrtc sdp exchange)
FFmpeg is required for the usage of this package. If you are on linux you can easily install ffmpeg from your distribution's package manager.
$ sudo apt-get install ffmpeg
discord.js-selfbot-v13 is required for the usage of this package. If you are on linux you can easily install discord.js-selfbot-v13 from your
$ pnpm add discord.js-selfbot-v13
Create a new client, and patch its events to listen for voice gateway events:
import {Client} from 'discord.js-selfbot-v13'
import {Streamer} from '@gabrielmaialva33/discord-video-stream'
const streamer = new Streamer(new Client())
await streamer.client.login('TOKEN HERE')
Make client join a voice channel and create a stream:
await streamer.joinVoice('GUILD ID HERE', 'CHANNEL ID HERE')
const udp = await streamer.createStream()
Start sending media over the udp connection:
udp.mediaConnection.setSpeaking(true)
udp.mediaConnection.setVideoStatus(true)
try {
const res = await streamLivestreamVideo('DIRECT VIDEO URL OR READABLE STREAM HERE', udp)
console.log('Finished playing video ' + res)
} catch (e) {
console.log(e)
} finally {
udp.mediaConnection.setSpeaking(false)
udp.mediaConnection.setVideoStatus(false)
}
Yes, just send the media packets over both udp connections. The voice gateway expects you to signal when a user turns on
their camera, so make sure you signal using client.signalVideo(guildId, channelId, true)
before you start sending cam
media packets.
No, Discord blocks video from bots which is why this library uses a selfbot library as peer dependency. You must use a user token
This project is under the MIT license. MIT ❤️
Maia |
Made with ❤️ by Maia 👋🏽 Get in touch!
Liked? Leave a little star to help the project ⭐
© 2017-present Maia
FAQs
Experiment for making video streaming work for discord self bots
The npm package @gabrielmaialva33/discord-video-stream receives a total of 8 weekly downloads. As such, @gabrielmaialva33/discord-video-stream popularity was classified as not popular.
We found that @gabrielmaialva33/discord-video-stream demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.
Security News
A new Rust RFC proposes "Trusted Publishing" for Crates.io, introducing short-lived access tokens via OIDC to improve security and reduce risks associated with long-lived API tokens.