I'm developing a page without the use of a back-end, however, I want a background video to be loaded on desktop screens using this code:
<div class="test">
<video poster="img/videoposter.png" id="header-video" playsinline autoplay muted loop>
<source src="img/background-video.mp4" type="video/mp4">
</video>
</div>
But when the user is access via mobile / tablet I want to appear only the normal background done in css / less as the example:
.test {
background-color: black;
}
For this I used the code:
@media (max-width: 991px) {
#header-video {
display: none;
}
}
But I noticed that the mobile user continues to download the video to his device, leaving the site heavier, how do I prevent mobile users from downloading the video?