Reputation: 55
I know this question has already been asked before, with answers pointing to Google's iFrame API Reference's code player.getCurrentTime():Number
, but where exactly do I put that JS code?
I want to append current time to <p class="displaytime">
whenever <button class="gettime">
is pressed.
I have already constructed the YT.Player object and am able to trigger Play and Pause with external buttons, but can't get Current Time.
Here's my trial with jQuery:
$('.gettime').click(function() {
$('.displaytime').append(player.getCurrentTime():Number);
});
I suppose I can't append the code directly? Thanks!
Upvotes: 2
Views: 957
Reputation: 55
Ok, got it.
$('.gettime').click(function(){
var currenttime = player['player1'].getCurrentTime();
$('.displaytime').append(currenttime);
});
I guess the :Number
in API's ref code was to tell that the output is a number.
Upvotes: 1