In this post, we are going to be making a video streaming backend from scratch, which we can use in any front-end client (something like YouTube and Netflix).
And why in the world would you want to know how to do that?
Cause if you realize one fine day that your **Insert your favorite TV series here** collection is taking up too much hard drive space, and you wish there was a service that would stream all your pirated movies(ahem … I mean all the digital copies of the DVDs you bought) from the cloud, you could make your own app to solve that issue(a geeky solution, I know).
Before we begin, we gotta know how video streaming actually works.
There are two ways by which you can set up your backend server, which hosts all your media for streaming:
- The HARD way – Build and set up your own web server and link it to a public static IP address
- The not-so-HARD way – Buy a hosting and a domain name from HostGator or GoDaddy
We’ll leave the HARD way to the geeks who have the time for that.
In this post, I’m going to stick with the not-so-HARD way.
Check out the video below to learn how to buy a web hosting and domain name for your video streaming service.
In order to stream videos from the server, we first need to have videos on the server.
I’m going to assume that you already have your hosting and domain name. So go to the web hosting control panel window of your domain name, which would be http://your-domain.com/cpanel (cPanel in my case).
You would see that I have a folder named public-html. Create a sub-folder and give it a name, say streaming. This is the folder under which we store all our videos. You can open that directory and just drag and drop it to upload all the videos that you want to host.
Caution: You can only store videos up to how much your hosting plan allows. In my case, I have a shared hosting of unlimited space.
Note: The .jpg files can be ignored for now. They are the movie posters which will be displayed on the android app.
Bingo, your server is now ready to be streamed from. You could, in fact, watch all of your videos directly from any web browser at this point.
Try streaming to one of your devices by opening http://your-domain.com/streaming/your-video-name.mp4.
If it works, well done.
Until later, Adios!