Note: This is for educational purposes. It's just an idea that came on my mind while I was heading back home :)
Before starting, please make sure you have:
- Basic knowledge about the HLS protocol
- A Discord text channel webhook
- PHP 7.2+ with PHP cURL extension
As a free time gamer, I use Discord to communicate and play with my friends, that's an awesome service, because I can voice call, text and send files. As I like to do, I always try to think out-of-the-box when I need to solve some issues. In my case, I had to share an uncompressed 4K video to a friend of mine, but every free video sharing website couldn't allow me to do it, so I've decided to have fun with WebHooks and Discord.
Big companies such as Netflix, Amazon, YouTube, split their content into smaller pieces in order to give the end-user a faster video loading, and sometimes, the possibility to choose between certain video qualities.
Like the big ones, our goal is to break a file into small pieces in order to upload them into the Discord CDN using a Webhook.
But, Discord has got some limitations to It's Webhook API.
We have to consider some limitations:
- default max file size accepted is 8MB
- 30 requests per minute per Webhook
You can generate a playlist by running the proof.php file. Either way, you can implement the uploadFile() function into your code, this will return the Discord CDN media URL.