Vimeo Player Time Tracking Using Script
I am retrieving videos from Vimeo server to play course videos in my website. On click of tag im playing the video in popup. , '.btn-video', function ()
{
var id = $(this).attr("id");
var iframe = document.getElementById(id);
var vPlayer = newVimeo.Player(iframe);
setInterval(function ()
{
console.log(iframe);
console.log(vPlayer);
var currtym = vPlayer.getCurrentTime();
console.log(currtym);
var currentTime = 0;
player.getCurrentTime().then(function(currentTime) {});
console.log(currentTime);
}, 1000);
});
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 = newVimeo.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"