YouTube Fallback Video


Play a video file from your own server if YouTube is blocked from the end user's perspective.




<div class="containerforyoutubevideo" style="display:none">
<iframe title="YouTube video player" width="709" height="399" src="//www.youtube.com/embed/uUf5pUlUdeg" frameborder="0" allowfullscreen></iframe>
This Video is coming from YouTube because your connection does allow YouTube.
</div>

<div class="containerforvideoonyourserver" style="display:block">
<video preload="metadata" style="width:709px;height:399px" poster="https://www.blumenmaarsen.ch/images/823.jpg" controls>
<source src="https://www.blumenmaarsen.ch/rundumdieblume/www_maarsen_ch/flv/sue.mp4" type="video/mp4">
</video>
This video is the onprem stored file because your connection does not allow YouTube.
</div>

<script>
var img = new Image();
img.onload = function() {
if(this.width>1) {
e=document.getElementsByClassName('containerforyoutubevideo');
for(i=0;i<e.length;i++) {
document.getElementByClassName('containerforyoutubevideo').style.display='block';
document.getElementByClassName('containerforvideoonyourserver'[]i).style.display='none';
}
}
img.src = '//ww'+'w.youtube.com/s/desktop/80d87ec4/img/favicon_48.png?'+new Date();
</script>



Explanations


//ww'+'w.youtube.com/embed/uUf5pUlUdeg = Remote YouTube Video

https://www.blumenmaarsen.ch/images/823.jpg = Video thumbnail on your server

https://www.blumenmaarsen.ch/rundumdieblume/www_maarsen_ch/flv/sue.mp4" = Video file on your server

//www.youtube.com/s/desktop/80d87ec4/img/favicon_48.png = An image on YouTube. Any image from there is possible, as long it is under www.youtube.com (do not use images from img.youtube.com and similar because connectivity www.youtube.com shall be tested)! If the image (favicon_48.png) no longer exists, surf to YouTube and find an current image URL in the source code.

Result

This video is the onprem stored file because your connection does not allow YouTube.

Download

Content Management System u5CMS

Service

English⇄German Translation Service

Flowers

blumen-bern-maarsen.ch