Background video is not loading

11 replies · opened Aug 31, 2021

CcompTIMAug 31, 2021

Hello SemiColonWeb team

I have a website, see https://fabian-uehlin.de/tdc/fabian.php and I want to integrate a background video.
I did this:

  
    
  

But the video is not loading, what's wrong here?

SSemicolon WebSTAFFAug 31, 2021

Hello,

The Video is blocked from AutoPlaying by the Browser as it is not muted. You will notice that as soon as you add the muted Attribute to the `` Tag, it will start playing. This is something Modern Browsers now enforce upon for a better User Experience.

Hope this Helps!

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

CcompTIMAug 31, 2021

Thank you very much. Yes, with muted it is working. But how can the user enable the sound by himself?

SSemicolon WebSTAFFAug 31, 2021

Hello,

Please consider using this Solution: https://themes.semicolonweb.com/html/canvas/index-video-sound-event.html .

CSS:
[ch_pre type="css"]#video-slider-mute {
position: absolute;
top: auto;
left: auto;
right: 20px;
bottom: 20px;
width: 32px;
height: 32px;
line-height: 32px;
border-radius: 50%;
background-color: rgba(255,255,255,0.2);
color: #FFF;
font-size: 16px;
text-align: center;
text-shadow: 1px 1px 1px rgba(0,0,0,0.1);
}

#video-slider-mute i {
position: relative;
left: 1px;
}

#video-slider-mute i:nth-of-type(2),
#video-slider-mute.video-muted i:nth-of-type(1) { display: none; }

#video-slider-mute.video-muted i:nth-of-type(2) { display: block; }[/ch_pre]

JS:
[ch_pre]
jQuery('#video-slider-mute').on('click', function(e){
e.preventDefault();

	if( jQuery(this).hasClass('video-muted') ) {
		jQuery('#slide-video').prop( 'muted', false );
	} else {
		jQuery('#slide-video').prop( 'muted', true );
	}

	jQuery(this).toggleClass('video-muted');
});

[/ch_pre]

HTML:
[ch_pre][/ch_pre]

This will definitely work fine. Hope this Helps!

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

CcompTIMAug 31, 2021

I integrated the code, but the icon in the right lower corner is not clickable.
Is there a layer over it preventing the click?

SSemicolon WebSTAFFAug 31, 2021

Hello,

Consider adding the HTML directly inside the #wrapper instead of inside the .video-wrap DIV. You can also assign a Custom Z-Index like: style="z-index:199;" to place it at the top of the stack so that it is clickable.

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.

CcompTIMAug 31, 2021

Thanks so much, two last issues:

The video is muted from the beginning, but it seems from the icon, that it is not muted.
To unmute it, I need to click two times on the icon. How can I solve this issue?

And the video is not displayed on my iPhone? What is preventing it playing on it?

SSemicolon WebSTAFFSep 1, 2021

Hello,

  1. Simply add the .video-muted Class to the #video-slider-mute Element.

  2. Apple and Android do not allow autoplay for HTML5 Videos/Audio to prevent unsolicited usage of Bandwidth (which can be Cellular) on the User’s Mobile Device. They can only be played on their native Video Player.

Here is the Official Reference for Apple: https://developer.apple.com/library/safari/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/Device-SpecificConsiderations/Device-SpecificConsiderations.html .

Meanwhile, currently, the Inline Video Autoplay is supported only from iOS 10 onwards. You can use the following instructions to make it work on iOS 10 or above devices:

a. Add the playsinline Attribute to the <video> Tag. Example:
[ch_pre]<video id="slide-video" poster="images/videos/explore-poster.jpg" preload="auto" loop autoplay muted playsinline>
...
</video>[/ch_pre]

b. Then add the .no-placeholder Class to the .video-wrap Container that encloses the <video> Tag. Example:
[ch_pre]<div class="video-wrap no-placeholder">
<video poster="images/videos/explore-poster.jpg" preload="auto" loop autoplay muted playsinline>
...
</video>
<div class="video-overlay" style="background-color: rgba(0,0,0,0.55);"></div>
</div>[/ch_pre]

This should definitely work fine. Hope this Helps!

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

CcompTIMSep 1, 2021

Works perfect!

Only on my mobile iPhone, when loading https://thedriver.club (new location of the web page), there is at the bottom of the page a white space, see attached screenshot.

I have no idea how to debug it, because on my desktop, everything seems to be okay.

SSemicolon WebSTAFFSep 1, 2021

Hello,

This is due to the following lines of code in the css/custom.css File:
[ch_pre type="css"]#copyrights {
background-color: transparent;
margin-top:-100px;
}[/ch_pre]

You might need to define a different margin-top Value in different Media Queries.

Example:
[ch_pre type="css"].device-xs #copyrights {
margin-top:-130px;
}[/ch_pre]

Make sure that you add the .custom-hero-bg Class to the Hero Section. The Responsive Classes are as follows:

.device-xl – Class for Large Devices >=1200px

.device-lg – Class for Medium Devices >=992px to 1199px

.device-md – Class for Tablets

.device-sm – Class for Landscape Mobiles or Phablets.

.device-xs – Class for Portrait Mobiles

You can add these Custom CSS codes in the css/custom.css File.

This will definitely work fine. Hope this Helps!

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

CcompTIMSep 1, 2021

Thanks, works great!

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