This is my solution to prevent Vimeo fast forward - I made interaction with Vimeo API that is really brilliant.
Script remembers the moment of the video where user try to fast forward. Then js will go back to right place.
Your video:
<iframe src="{{ $video_path }}" width="100%" height="500px" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
Remember to add vimeo script:
<script src="https://player.vimeo.com/api/player.js"></script>
JavaScript logic:
let iframe = document.querySelector('iframe');
let player = new Vimeo.Player(iframe);
let playing = false;
let simulationTime = 0;
player.on('play', function(e) {
playing = true;
});
player.on('pause', function(e) {
playing = false;
});
/**
* Event fired when user want to fast forward
*/
player.on('seeked', function(e) {
if (e.seconds > simulationTime) {
player.setCurrentTime(simulationTime).then(function(seconds) {
}).catch(function(error) {
switch (error.name) {
case 'RangeError':
// The time is less than 0 or greater than the video's duration
break;
default:
// Some other error occurred
break;
}
});
}
else {
simulationTime = data.seconds;
}
});
/**
* Keep time going
*/
window.setInterval(function() {
if (playing) {
simulationTime++;
}
}, 1000);
Cheers!