I'm editing a wordpress theme portfolio with a js function for hover play/pause videos. It almost works like I want -- when I hover over the video it plays, on mouse exit it stops and returns to the first frame. However, when the page is reloaded, the video does not show the first frame but some other part of the video. I'd like to add something to this code to make the first frame show on load. I haven't tried anything yet because i don't seem to have the right terminology for this. Here is my function:
$gallery.find( "video" ).each( function () {
this.pause();
let $this = $( this );
$this.parents( ".item" ).find( "> a" ).on( "mouseenter", function () {
$( this ).parents( ".item" ).find( "video" )[ 0 ].play();
} ).on( "mouseleave", function () {
$( this ).parents( ".item" ).find( "video" )[ 0 ].pause();
$( this ).parents( ".item" ).find( "video" )[ 0 ].currentTime = 0;
} );
} );