After thinking a lot, I have solved it myself in the following way:
if (document.documentElement.clientWidth < 900) {
$('video').each(function () {
const poster = $(this).data('poster');
$(this).attr('poster', poster);
});
}
Thanks to everyone