Skip to content Skip to sidebar Skip to footer

Vimeo Player Time Tracking Using Script


Solution 2:

I found another better solution to retrive endTime, video progress percent as well. Might help someone...

var vdo_play = "";
$(document).on('click', '.btn-video', function ()
{
    if (vdo_play)
    {
        clearInterval(vdo_play);
    }
    var player = new Vimeo.Player($(".mfp-iframe")[0]);
    var currentPos, percentage, vdoEndTym = "";
    vdo_play = setInterval(function ()
    {
        player.on('timeupdate', function (getAll)
        {
            currentPos = getAll.seconds; //get currentime
            vdoEndTym = getAll.duration; //get video duration
            percentage = (getAll.percent * 100)+"%";
            console.log('currentPos: ' + currentPos);
            console.log('percentage: ' + percentage);
        });
        player.on('ended', function ()
        {
            clearInterval(vdo_play);
        });
    }, 1000);
});

Post a Comment for "Vimeo Player Time Tracking Using Script"