I was able to solve using the google API, which shows the time if the user gives play, pause or if the video ends:
<script type="text/javascript" src="https://www.youtube.com/iframe_api"></script><scripttype="text/javascript">
var player;
function onYouTubeIframeAPIReady() {
player = new YT.Player( 'player', {
events: { 'onStateChange': onPlayerStateChange }
});
}
function onPlayerStateChange(event) {
switch(event.data) {
case 0:
alert('vídeo acabou');
break;
case 1:
alert('começou em '+player.getCurrentTime());
break;
case 2:
alert('pausado em '+player.getCurrentTime());
break;
}
}
</script>
And just pass the url inside an iframe:
<iframe id="player" src="https://www.youtube.com/embed/DjB1OvEYMhY?enablejsapi=1"></iframe>