JordanBarber
JordanBarber

Reputation: 2101

How to stop video from being downloaded on mobile

I have a site with multiple case studies that have video headers which are set to autoplay. These videos are contained within a parent div, which is hidden on mobile and tablet. Since the videos will never be seen on mobile, is there a way I can get the browser not to download the video?

Upvotes: 1

Views: 993

Answers (1)

Jack hardcastle
Jack hardcastle

Reputation: 2875

Sure, load the video dynamically with javascript IF the client/device/screen is of the width you wish. In this example: jQuery.

if($(window).width() > 500) {
    loadvideo();
}

function loadvideo() {
   $video = something;
   $(".parent").child().val($video);
}

Upvotes: 3

Related Questions