I want to only let "right" people watch those videos. In other words, only registered users that are allowed (by other users, ie, friends) should see videos. I have a hard retriction for cpu usage in my shared environment, so I can't use things like php's readfile.
Stream through PHP using readfile
, as you mention. Just set a cookie with a session ID when someone logs in and check it before you start streaming the video, and don't bother if they're not authenticated.
Samir Talwar, I can't do so, because it is cpu-intensive (as I mentioned).
Samir Talwar, I wish to know how to make it not cpu-intensive. It's all I need. By myself I will take care of other stuff with cookie and such.
I liked Samir Talwar way to go. But if this is too CPU intensive (I'm not really sure of this), you can go with apache and use a backend PHP script that will allow or deny access upon user cookie state.
But have you access to apache conf in your shared env ?
If so, you can look at apache urlrewriting guide, in "Extended Redirection" section.