Is there a way to console.log the time whenever a user clicks on the seekbar http://prntscr.com/km6qsc ?
it works with the function below, but ONLY if the video is already playing.
$(document).on("mouseup", ".vjs-play-progress", function() {
var myPlayer = videojs('player' );
myPlayer.pause();
console.log('Clicked on video timeline:', myPlayer.currentTime());
});
馃憢 Thanks for opening your first issue here! 馃憢
If you're reporting a 馃悶 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.
To help make it easier for us to investigate your issue, please follow the contributing guidelines.
You could try something along these lines:
player.controlBar.progressControl.seekBar.on('mouseup', function(event) {
var seekBarEl = this.el();
var seekBarRect = videojs.dom.getBoundingClientRect(seekBarEl);
var seekBarPoint = videojs.dom.getPointerPosition(seekBarEl, event).x;
var duration = player.duration();
var seekBarClickedTime = videojs.formatTime(seekBarPoint * duration, duration);
console.log('Seekbar clicked time: ', seekBarClickedTime);
});
See live example here https://output.jsbin.com/belateb
^this worked! Closing this.
濂戒汉鏈夊ソ鎶ワ紒
Most helpful comment
You could try something along these lines:
See live example here https://output.jsbin.com/belateb