Reputation: 433
Looking for better solutions than this:
$(".video-post").hover(function () {
$(this).find("video").get(0).play();
}, function () {
$(this).find("video").get(0).pause();
});
-> It works but leads to chrome error: DOMException: The play() request was interrupted by a call to pause().
Theres some articles about this but cant seem to find any simple answer for this. https://developers.google.com/web/updates/2017/06/play-request-was-interrupted
Upvotes: 0
Views: 641
Reputation: 1125
Try with:
$(document).ready(function () {
$(".video-post").hover(function () {
$(this).find("video")[0].play();
}, function () {
var el = $(this).find("video")[0];
el.pause();
el.currentTime = 0;
});
});
Upvotes: 1