Record lesson as completed when user finishes watching vimeo video
Asked Answered
B

1

5

I built a website in laravel 5 that have training lessons with videos about various subjects. I use vimeo as my video library. Can anybody tell me how does laracasts or udemy mark the lesson as completed when the user finishes watching a video? I tried to google it with no luck.

Bosom answered 29/7, 2015 at 2:28 Comment(1)
Laracast use custom video players like Video JS. If you use custom video player you can easily detect by using player's API.Pandurate
P
11

Vimeo has an API that can fire a javascript event if the video ends, check developer guide on vimeo. In the OnFinish event you can do an ajax call that marks the video as watched. You can even use the onPlayProgress event and mark the video as watched when someone has watched a video for, let's say 90%, based on getCurrentTime() and getDuration()

Check this codepen for a detailed example on the API usage.

Panoptic answered 29/7, 2015 at 8:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.