php - Identify if user has watched a video
756
I am developing an application that requires a user to view a set of videos.
How can I identify if the user has watched a particular video(complete and incomplete)?
I am developing an application that requires a user to view a set of videos.
How can I identify if the user has watched a particular video(complete and incomplete)?
People are also looking for solutions to the problem: Facebook: Post on Page as Page issue (access token / php)
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.
Find the answer in similar questions on our website.
Answer
Solution:
You could embed the video on a page on your website, so you can register it that way.
You could also put a URL at the end of the video that they must follow to register they've seen the video.
I hope that the answer is "you can't" if you're talking about having watched it directly from YouTube.
Answer
Solution:
You can use php's session variables, and put each video on a different webpage. Then when one video ends it redirects to another webpage and adds a value to that session. Before each page is loaded the session checks to see if the user should be on that webpage like so:
and to figure out when the video ends, just set a timer to the exact length of the video. I think you can figure that out for yourself.
Answer
Solution:
Ah youtube videos. I made a YouTube Client that could do exactly what your referring to. It was a Client side URL sniffer that checked various urls for the presence of a youtube video ID. It could detect when a video was watched embedded in a site and many other places where the video could be watched.
Unfortunately, Firefox has changed their JS Engine to disallow URL sniffers, so finding if youtube videos have been watched via javascript is now out of the question. Your last option might be to authenticate the user under their youtube account and check the History. Good Luck!