Background:
I am developing a web-based teaching program (using Drupal 7, if that matters) that requires users to view educational videos sequentially. I want to make sure they view each video in its entirety before gaining access to the next one. I’m pretty unfamiliar with the YouTube API but I combed through the PHP developer’s guide and didn’t find any information about how to do this.
I’m open to any reasonable way of accomplishing this. I was thinking that checking whether one or two random timecodes were hit, as well as whether the movie finished playing, would make it reasonably difficult to skip ahead without watching the video.
So to accomplish this I need to figure out two things:
- How to let the server know when the video being viewed has hit the selected timecodes, and
- How to let the server know when the end of the video has been reached.
If someone could point me in the right direction I’d greatly appreciate.
With the youtube api you can ‘ping the server’
You can then get the duration of the clip. Further use of the api – timing when the user starts and stops should allow you you to work out the time said user spent viewing the clip.
Compare this to the duration and if it matches ( or is close enough) trigger the reward.
https://developers.google.com/youtube/js_api_reference