Monitoring the duration of an html5 video can be tricky. When playing a video and pausing at 2 seconds, the console may record a usage duration of 2 seconds. However, if you resume the video at 2 seconds and play for an additional 3 seconds, the total usage duration is calculated as 5 seconds instead of 3 seconds.
time: function(video) {
var seconds = 0;
video = $("#" + video.id()).find("video").get(0);
if (video.played.length > 0) {
seconds += video.played.end(0) - video.played.start(0);
}
return Math.round(seconds);
}
The goal is to obtain the latest start time upon resuming and subtract it from the end time of the video played. However, the issue arises where the start value always returns as zero, failing to capture the new start time upon resuming.
Any suggestions or assistance on this matter would be greatly appreciated.