How to add a counter to count how many times a video is played or watched in my website??? using php and MySQL - view

I have developed a website that can be used for uploading and downloading videos and also it is watchable but one thing that am concern with is how to find out how many people have watched my videos.. I am using php and mysql.

Related

Can several viewers use the same Session?

We are using GA for tracking video traffic for videos that are hosted on a proprietary front end Youtube like platform and embedded on in about 6-8 different domains in iFrames.
When comparing views for a particular video in the front end platform and in a AWS Quicksite dash board and in Google Analytics which tracks sessions instead of views we are getting wildly different results. That are far fewer sessions for the same video as there are views.
We are using an ip range of about 20 ip numbers for all playback.
Can it be that GA does not really know who each requester is, and that once a session is open, it is reused for other people requesting other videos on the same domain?
I can otherwise not explain the vast difference between views and Session numbers?
We have not yet merged to GA 4. but are using the
Hope one of you have the answer to this.
Thank you on beforehand.
ggaarde

Is it very bad to create real time chat app in PHP 7?

I'm creating PHP MySQL real time chat app. A friend told me It is very bad to use PHP for real time apps & that would kill server CPU.
I know that PHP isn't the proper choice but i wanna get some advices to make the performance better with using PHP for real time chat apps.
I also wanna know why some developers prefer using PHP7 over NodeJS/Socket.IO/GO/..etc ?
Thanks,,
I would prefer Nodejs + Socket for realtime chat application because of one reason that it will be completely Javascript from Browser/Mobile to server and if NoSql is database than upto database as well.
But your point of PHP7 vs Nodejs/Socket left me with a question and to get the answer I came across this blog. This might help you as well. Its too long to explain it here.
PHP7 vs Nodejs

Laravel project + media server both for live and vod streaming deployed on Docker

After many hours of research and nothing relevant coming up I decided to ask.
I am pretty new to the concept of video streaming, so please forgive me if my questions may seem elementary.
I am building a project that needs to include media streaming functionality. It should has the following options:
VOD - user uploads a file to the server, that needs to be transcoded to few MP4 files of different resolutions. For transcoding I am trying the approach using CloudTranscode (https://github.com/bfansports/CloudTranscode) deployed as a Docker image. The server should supply stream to the player with certain buffer size, so when the playback is paused we buffer for instance +5 seconds and that's it. Adaptive bitrate would be nice, however I'm not sure how this works with different players (I was thinking about using Video.JS due to high customization option, plus it's free).
Live video capturing - user visits a certain page that captures video from the webcam and sends the stream to the server for further stream distribution to clients. For most browsers WebRTC could be a good option, but iOS devices probably won't work with it, so any suggestions here would be much appreciated
Live video streaming - users visit a certain page where they can watch the stream captured from the user mentioned in point 2. Here the stream may be watched by one or many users (may be as well 1 or 10,000 users)
Cutting to the chase my questions follow:
What would be the best media server software that I can use for that purpose, having on mind high scalability (deployed as Docker container on AWS EC2), and possible huge load of both streaming and watching users, as well as multi-device/platform/browser support?
What would be the best media player for webpage that (again) would be cross-browser/platform/device, keeping in mind good integration with media server itself for purpose of adaptive resolution streaming? Also it would be nice if the player has broad customization options in matter of appearence (for instance thumbnail display when hovering the timeline).
Do you know any better solution for video transcoding than mentioned CloudTranscode, having on mind Docker setup, and some easy to use API (here some on-the-fly transcoding would be nice, so the worker wouldn't need to wait for the whole file to be uploaded)?
What happens if I use autoscalling functionality on EC2 instance, and more instances of the media server are being automatically started? Let's say we have instance 1 (I1) and instance 2 (I2). Some user started broadcasting on I1, and 1000 users are watching the stream which is the server instance's limit because it's running out of resources. Next, another couple of users are trying to view the stream, so they are being connected to I2 by AWS load balancer - how does that work with live stream? Sorry, but I am total newbie to the concept, so again - forgive me for elementary questions.
So far a was able to find a few media servers that may be relevant to my needs including:
Wowza Media Server (paid)
Red5 media server (free)
Kurento Media Server (free)
My application is written in Laravel, ergo I need some PHP integration with the media server.
Obviously free solutions are the most welcome, however I do not mind to pay as long as paid solution covers my needs.
Any input here will be much appreaciated - even partial solutions / suggestions. I'm kinda stuck here, so any suggestions that can bring me closer to the solution are very welcome!
Best regards
If anyone needs such information I ended up using Nginx Plus media server functionalities. It's capable of serving both live and VOD streams, it has out-of-the-box load balancer to switch traffic over multiple container instances and many more great features. Plus they have images to deploy directly from AWS Marketplace, and the license is paid hourly when the EC2 instance is running. Ofcourse there is free version as well, but I am really satisfied with Nginx Plus support.
Capturing live stream from user I've done using getUserMedia() in JS. Still having minor glitches, but I will get it to work (problems are related with WebM chunks that MediaRecorder API spits out, but I'm almost done here using some Python piece of code modifying each chunk on server side).
If anyone needs help I will be happy to help.

Decrease waiting time in a Laravel application

I'm developing a PHP application written using the Laravel 4.1 framework. So far I only have a few MySQL queries per page, many of them are cached using the Cache class where possible, using a Redis server.
Currently I'm developing locally with an internal (but not localhost) MySQL database, using Apache 2.2.24 and PHP 5.4.17.
Using Chromes Developer Tools, I'm checking the Network tab to see how long the page is taking to load etc, but I'm seeing some weird results. The page spends a long time waiting for the content to be served, as you can see below:
As you can see, the new page takes 682ms waiting for the content to be sent back to the browser. Is there anyway that I can improve this? Why does Laravel has such a big overhead?
Apart from a custom Facade that we use to make using Entypo easier, there are no extra packages except the defaults that come with Laravel.
Does anybody know how this can be improved?
If I were you I would install the Chrome Clockwork extension plus the Laravel Clockwork package from Composer. Clockwork gives you a timeline where you can see what it is that takes so long, plus a database query tab where you can see how long time each query takes to load.
Happy hunting (:

Upload large files using Ruby

I'm wondering what is the best pattern to allow large files to be uploaded to a server using Ruby.
I've found Rails and Large, Large file Uploads: Looking at the alternative but it doesn't give any concrete solutions.
I don't want to use Rails since I'm working on a simple upload server that'll run in standalone mode. I'm guessing that Sinatra could be the key but I don't know which web server I should use to run it without raising a Timeout.
I also need this web server to allow simultaneous upload.
UPDATE: By "large files" I mean between 200MB and 5GB.
UPDATE2: Since those files are videos (in my case), I can deal with a max size of 2GB like youtube.
ok i am taking a bit of a strech here but:
if you would use a couchdb as a target for your uploads you would get rid of the timeout problem.
consider the couchdb as some "temp" memory in this example.
so if a downloads finishes you can take the file from the couchdb and do with it whatever you want.
i managed to upload files as big as 9gb over a dsl line into couchdb without any drama.
it may take a bit of reading but i think you could make it work.
couchdb has many rails gems so it plays nice with others ;)
let me know if you wanna go down that rabbit hole so i can give you some more pointers
passenger recommends using a separate apache/nginx module to handle uploads.

Resources