Prevent HTML5 videos from downloading the files on mobile devices

3 replies · opened Jan 25, 2019

Xx-137Jan 25, 2019

Hi,

On mobile devices HTML5 videos loads files from the server, it slows down loading of the page. Loading of the page lasts from 30 to 60 seconds, depending network bandwidth.
Question: How to prevent downloading of video files from the server on mobile devices?


Best regards, Aleksey.

SSemicolon WebSTAFFJan 31, 2019

Hello,

Consider adding the following JS code just after the js/functions.js JS File linking:


	jQuery(document).ready(function($) {
		if( SEMICOLON.isMobile.any() ) {
			$('video').find('source').attr('src', '');
		}
	});

This should definitely work fine. Hope this Helps!

Let us know if we can help you with anything else or if you find any further issues.

Xx-137Feb 6, 2019

Hi,

Thanks for your support!

Your decision does not work. Video the file is still loaded from the server ((

I had to write such html code:


   
      
         
            
         
         [](#)
      
   

    window.onload = function(){
        if(window.innerWidth >= 1024) {
            jQuery('.video-wrap').prepend('');
        } else {
            jQuery('.video-wrap').append('');
        }
    };

It is similar that it is not correct, but it works...


Best regards, Aleksey.

SSemicolon WebSTAFFFeb 7, 2019

Hello,

You can also consider using the following code:


	
		
		
	
	
	

and then the following JS Code:


	jQuery(document).on( 'ready', function($){
		if( $(window).width() 

This should definitely work fine. Hope this Helps!

Let us know if we can help you with anything else or if you find any further issues.

Have the same question, or something new?

Sign in to the Canvas dashboard to reply or open your own topic. Canvas owners get direct help from the SemiColonWeb team.

Reply on the dashboard