Open bellef opened 7 years ago
I ended up doing this:
var previousTimeStamp = 0.0;
var videoTimeStamp = 0.0;
// Listen to the play event.
player.on('play', function(){
console.log("PLAYED");
console.log("TimeStamp: " + videoTimeStamp);
});
// Listen to the pause event.
player.on('pause', function(){
console.log("PAUSED");
console.log("TimeStamp: " + previousTimeStamp);
});
// Update timer
player.on('timeupdate', function(data){
previousTimeStamp = videoTimeStamp;
videoTimeStamp = data.seconds;
});
Although I've found this solution, I'm still interested to know if there's a better way to do it.
Hi,
First of all thank you for this amazingly simple yet powerful library!
It's more a question than an issue but here it is:
I'm trying to track down what a client actually watched in a youtube video.
Considering a 2 minutes video and a user doing this:
play
from 00:00 to 00:35
Clicks on the timeline
to go to 01:00until 01:30
pause
Then, considering this (simplified) code:
Finally the console output:
As you can see, it seems that the
pause
event was triggered right after thetimeupdate
event. Expected output:I also tried to use the
getCurrentTime
method but (kind of) the same problem happens. Am I doing something wrong and is there a way to do what I'm trying to do?Any help would be greatly appreciated, thank you guys!