If you are using a Custom video player, you can hook into the VS Netflix Continue Watching feature using the following setup:
1. Enqueue your custom JS script
true // optional
*Note: be sure to include the wpvs-user-video-tracking-js within the dependencies array.
2. Add Event Listeners To Your Video Player Object
Time Updated Event
Most video players should provide an event that fires when the time of the player is updated. Add an event listener that fires our update users continue watching function:
Both parameters current_time and video_length are required when calling this function.
The current_time parameter should be the current time of the video.
The video_length parameter should be the total duration of the video.
**We highly recommend using a custom interval in addition to the Time Updated event of your video player in order to prevent multiple requests to your server.
For example, within your Time Updated event, use a custom variable such as 10 (10 seconds) to fire the wpvs_update_users_current_video_time every 10 seconds, rather than every time the Time Updated event fires.
Video Player time updated events may fire as often as every 250ms, which would cause the wpvs_update_users_current_video_time function to fire 4 times a second.
The second event listener you should add to your custom video player script is when the video ends.
When your video player fires an ended event, call the wpvs_update_users_current_video_time function setting both the current_time and video_length parameter to the duration of the video. This zeros the remaining time the current user has on the video, which removes it from their continue watching list.
Reminder: JW Player, Vimeo, WordPress & YouTube
If you are using our built in JW Player, Vimeo, WordPress or YouTube video players, the Continue Watching functionality is already built in and will fire automatically.
Please sign in to leave a comment.