How To Add Event Listener To HTML5 Video Poster Image Load Event

Is it possible?

I would like to attach an event listener to the poster image on HTML5 video element in order to run a code once the poster image is loaded and displayed.

I'm trying to figure out a way to do this but I need help.

Answers:

Answer

Like this:

var poster = $( 'video' ).prop( 'poster' );
if ( poster ) {
    var image = new Image();
    image.onload = function () {
        alert( 'load' );
    };
    image.src = poster;
}

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.