JSFiddle - React, Tailwind, and code Playground

HTML

<video width="640" height="360" src="http://jakelauer.com/fireplace.mp4" autoplay muted></video>

JavaScript

var time;

$('video').on('play',function(){
    if( time )
    {
        var diff = new Date() - time;
        console.log('actually looped now, difference of ' + diff + " ms")
    }
    
    var ms = parseInt(this.duration * 1000);
    var video = this;
    setTimeout(function(){
        console.log('should loop now');
        time = new Date();
    }, ms);
})

$('video').on('ended',function(){
    this.play();

});