I know quite a bit about backend and devops, but I have to admit I have no idea how to do this, if I was tasked to do this.
Also would this even be possible without flash or third party video players? I know youtube used to have an html5 version, but I can't recall what happened to that.
My question is more on the programming level of what you would use to build the actual video player and the how the video player would connect to the backend.
Not so much an infrastructure question.
Especially the larger you scale, the less this becomes a technical problem, and more of a 'how will people abuse this' problem.
Second hardest part? Paying for it. Streaming 1080 streams can get expensive. especially if it's unpaid. Costs grow exponentially with video quality. 4k is significantly more bandwidth.
there's tons of ways to stream video to people. that's the easy part.
The minimum would be a stateless server handling , storing it in the file system and responding with the path exposed by nginx or something. The user agent will take care of the playback, be it Firefox, VLC or mpv.
Now if your average users upload high bitrate videos but have shitty bandwidth, you'll need to transcode them down to lower resolution or higher compression to save them from rebuffering. Still, no client-side scripting needed.
In case their connection quality is unstable, HLS is finally necessary for on-the-fly adjustment of playback bitrate. This is the secondary purpose of JS viewers around the web these day (the primary one being DRM). The other possibility with custom viewer is to lighten the server load by enabling P2P transfering, e.g. in case of PeerTube. Realistically, you'd either deploy the barebone one I mentioned in the beginning or set up a PeerTube instance; anything in between is probably a waste of engineering effort.
https://www.educative.io/courses/grokking-modern-system-desi... https://leetcode.com/discuss/interview-question/system-desig...
I've never designed such a system, but these are "baseline" solutions. It'd be interesting to see if anyone's actually implemented some of these canonical system design solutions and saw how well they actually scaled.
If you want something popular, focus on getting people to use the platform. If you want more of a controllable platform, you'll need to build a platform with video transcoding, playback, stats etc.
You could always set up a PeerTube instance https://joinpeertube.org/ and/or customize the code behind that to your needs
Since web browsers now have such excellent support for video codecs, you really only need to receive the files and maybe re-encode them to the most well supported format..
HTML has the
Or the Designing Instagram[0] and Designing Netflix[1] exercises or YouTube Scalability in 30 Minutes[2]
Also found this[3] which may be helpful
--------------
[0] http://highscalability.com/blog/2022/1/11/designing-instagra...
[1] http://highscalability.com/blog/2021/12/13/designing-netflix...
[2] http://highscalability.com/blog/2012/3/26/7-years-of-youtube...
[3] https://scaleyourapp.com/youtube-architecture-how-does-it-se...
Lets say rails.
1. add devise so users are users
2. add Video controller/model
3. connect data field as active_storage, backed by amazon
4. have video tag with link to uploaded file stored on amazon.
And only show comments from the people the user is following/friends with. Kills all spammers in the bud in one fell swoop.
Start with a way to distribute video content as cost effectively as you can. CDN and transfer will be your most expensive cost factors.
Take into account that you might need to have signed URLs for specific users in order to comply with content distribution rights.
Once you have decided a CDN/traffic partner you need to tailor your software to it and it will become the most crucial and expensive technical debt you'll have.
Then you'd need some server to serve those assets. That would lead to a CDN or similar.
Then you'd need a player. HTML seems to play back mpeg fine but you'll probably need a player for HLS. video.js seems fine here.
Source: built this for $dayjob