mediaelement.js - mediaelement js - show poster and play icon when finished playing -
i'd poster play icon show when video has finished playing.
did try achieve yet?
yes, tried myself project client wanted poster image come when video had completed. here's code:
jquery("video").mediaelementplayer({ features: ["playpause","progress","current","duration","volume","fullscreen"], success: function (mediaelement, domobject) { mediaelement.addeventlistener("ended", function(e){ // revert poster image when ended var $thismediaelement = (mediaelement.id) ? jquery("#"+mediaelement.id) : jquery(mediaelement); $thismediaelement.parents(".mejs-inner").find(".mejs-poster").show(); }); } });
the mediaelement player instantiated in usual way. i've added 'success' function listen "ended" event, takes our mediaelement object , traverses dom find poster image layer , switch on.
Comments
Post a Comment