I have this jquery to get the current time of my embed code from vimeo.
var _getPlayerVimeo = function () {
var VIMEO_PLAYER1 = new Vimeo.Player($('iframe#player1'));
var _currentTime = VIMEO_PLAYER1.getCurrentTime().then(function (seconds) {
return seconds;
});
console.log(_currentTime);
};
$('.close-vimeo').on("click", _getPlayerVimeo);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://player.vimeo.com/api/player.js"></script>
<button class="close-vimeo">button</button>
<div class="playerDiv">
<iframe id="player1" src="https://player.vimeo.com/video/181101656?portrait=0" width="640" height="360" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
<iframe id="player2" src="https://player.vimeo.com/video/180966954?portrait=0" width="640" height="360" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
</div>
The Class .close-vimeo
is a button to close the player.
And this is the return from the console after the button close has been triggered:
Promise {[[PromiseStatus]]: "pending", [[PromiseValue]]: undefined}
EDIT: Anyway my goal for this question is that I want to get the currentTime of the player once the user clicked a "close" button (since the player is in modal).