Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

alex_time's avatar

Video player, upload and hosting

My company asked me to create an app to publish videos that must be seen by employees, so I basically have to:

  1. create an upload video system (I will not be the only one to upload video otherwise I could simply use ftp or sftp and do things manually, but for others I should create a simple web interface);
  2. track down users so to be sure that everyone has seen the entire videos that they have to;
  3. does not allow users to see videos that they cannot see.

Now I have some doubts:

  1. upload without flash means I have to raise up values on php.ini, but is it safe to put those level so high? And even if I get more RAM on server, does exist a system to track upload progress on laravel? I have written long time ago a system to track upload progress using PHP Session upload progress, maybe I can use the same approach, or L5 offers something better or out of the box?
  2. I think I can do ajax request during playback to log what the user have seen, do you have better suggestion?
  3. will be better to leave videos on an external provider or upload everything on our own server? Using our own server is it possibile (how?) to create temporary link to the videos and lock only that user on that session to access that temporary link and see that specific video? If I create a dynamic link stored in a table with an expirations system, in this case that link will be available for everyone I guess, how would you solve that?
0 likes
7 replies
erozas's avatar

Hey Alex, if I were in your place I wouldn't update the videos to your own server, it's unnecessary and I don't see a real advantage on doing so. There are some amazing video hosting services out there (Wistia, Vimeo for example) and they've already solved a lot of the issues you're going to encounter in case you make your own system.

I think that you could use the API of these services to upload the videos and track the progress, organize the videos and embedding permissions etc. I don't know exactly what you can do with said API's but I'm pretty sure you will be able to accomplish what you want. Vimeo has a Laravel wrapper for their API on GitHub, you should check it out.

constb's avatar

@alex_time for the first one you can use ajax uploaders. Some of them (like plupload) natively support splitting large uploads in parts. This will also cover upload progress tracking.

If hosting videos externally is an option, I would opt for that without hesitation. Not only you reduce load on your server, you also rely on a service that has all format conversion and cross-browser compatibility handled for you. Also access authorization. Also content delivery. Laracasts uses vimeo and it works ok.

I wouldn't worry too much about expiration and access keys and stuff. No matter how much time you spend on limiting access to your content, there will always be a clever user that downloads it when it's available to him and keeps watching it after access is revoked. Also, he's likely to share it with others. No way to really stop this from happening.

Better focus your efforts on creating content people will crave for. :)

erozas's avatar

@alex_time Yes indeed, I haven't tried it yet but for what I've read, you can upload videos to Vimeo using their API

alex_time's avatar

@erozas Before making a decision I have done some testing today, I have generated a new app on Vimeo API and a valid token to be used on my development server. I have uploaded a couple of videos and, even if I cannot still upload anything for the three business days delay I guess (this is what Vimeo says on FAQ), I can request all the videos and get the json ready to be parsed, the problem is that all the videos on Vimeo must be private (and they are right now), but they cannot be seen by the user. If I render a view that simply parse the

Vimeo::request('/me/videos', ['per_page' => 10], 'GET');

and I echo the $data['body']['data'][index]['embed']['html']

Vimeo ask the user to log in in order to view theme, while I wish Vimeo use the token (and they use it because if I delete it an exception will be thrown) to use my user as the login user, and not ask the visitor to have a Vimeo account, and even if the visitor has an account he won't see anything because of the private video.

Here in laracast all the video must be private in order to not be visibile without subscription, but laracast does not ask me to log in to vimeo in order to watch videos...so there is some concept I am missing I guess. Have you ever faced a situation like this? I thought that using the vimeo token would let the app "been seen" by Vimeo as the Vimeo user associated with the token...but I am wrong... @JeffreyWay maybe knows something about all this stuff ;)

erozas's avatar

Alex I think that you may want to check the privacy configuration on Vimeo. If I understand correctly, you may want to set the privacy configuration of the video with the following information:

Who can watch this video? -> Only me or Hide this video from Vimeo.com Where can I embed this video? On the sites I choose (here you put the URL's where the videos are going to be embedded)

After doing this your video shouldn't appear on Vimeo and you are going to be able to embed them on your site. Here on Laracasts Jeffrey uses Vimeo with VideoJS and even though I'm not completely shure I think that he's doing something similar to what I've explained.

As I told you I haven't seen how the API works but if you get an embed code I don't see why you would have any trouble. Hope it helps and good luck!

alex_time's avatar

It was a problem of account type, it is not possibile to do what I want with basic account, a plus or pro account it is necessary. thanks @erozas for your help.

1 like

Please or to participate in this conversation.