We needed to setup a small video file, looping as the background on Saskatoon musician, Jordan Cook’s website as a teaser of what’s to come with his band Reignwolf. Creating the video was fairly simple, we grabbed some static video files with licensing that allowed us to use them, a color bar image that was free to use, and the clips provided by Jordan. We used iMovie to edit them together and compress the file into a mp4 video that was as small as we could get it so it would load quick on the web.
All of the portions in italicized dark red you will need to replace with your pictures, videos, etc.
This way worked fine… kind of. It loaded fast most of the time, but had moments of lag. Every now and then when the website was accessed, it would take forever to get going. In these moments, fans that were accessing the website thought it was broken because people are impatient. Also, it is the almighty murderer of bandwidth. So, we needed a better solution. Our original idea was YouTube, so we decided to head back in that direction.
Second Attempt
We came across a jQuery plugin by the name of Tubular. Pretty much exactly what we need!
We are a proud supporter of FreshBooks Cloud Accounting. We invite you to give it a try! If you click their logo below you can start the free trial using our invite. From there, if you end up joining and upgrading to a paid plan, both of us get a free month out of the deal!
Set Up A YouTube Video As A Website Background
First Attempt
We needed to setup a small video file, looping as the background on Saskatoon musician, Jordan Cook’s website as a teaser of what’s to come with his band Reignwolf. Creating the video was fairly simple, we grabbed some static video files with licensing that allowed us to use them, a color bar image that was free to use, and the clips provided by Jordan. We used iMovie to edit them together and compress the file into a mp4 video that was as small as we could get it so it would load quick on the web.
video#bgvid {
position: fixed;
top: 50%;
left: 50%;
min-width: 100%;
min-height: 100%;
width: auto;
height: auto;
z-index: -100;
-webkit-transform: translateX(-50%) translateY(-50%);
transform: translateX(-50%) translateY(-50%);
background: url(picture-background-while-video-loads.jpg) no-repeat;
background-size: cover;
}
< /style>
< !--[if lt IE 9]>< script>document.createElement(‘video’);< ![endif]-->
< video autoplay loop poster="picture-background-while-video-loads.jpg” id=”bgvid”>
< source type="video/mp4" src="video.mp4“>
< /video>
All of the portions in italicized dark red you will need to replace with your pictures, videos, etc.
This way worked fine… kind of. It loaded fast most of the time, but had moments of lag. Every now and then when the website was accessed, it would take forever to get going. In these moments, fans that were accessing the website thought it was broken because people are impatient. Also, it is the almighty murderer of bandwidth. So, we needed a better solution. Our original idea was YouTube, so we decided to head back in that direction.
Second Attempt
We came across a jQuery plugin by the name of Tubular. Pretty much exactly what we need!
video#bgvid {
position: fixed;
top: 50%;
left: 50%;
min-width: 100%;
min-height: 100%;
width: auto;
height: auto;
z-index: -100;
-webkit-transform: translateX(-50%) translateY(-50%);
transform: translateX(-50%) translateY(-50%);
background: url(picture-background-while-video-loads.jpg) no-repeat;
background-size: cover;
}
< /style>
< !--[if lt IE 9]>< script>document.createElement(‘video’);< ![endif]-->
< video id="bgvid">< /video>
< script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js">< /script>
< script src="jquery.tubular.1.0.js">< /script>
< script>
$(document).ready(function (){
var options = { videoId: ‘youtube_video_id‘, repeat: true };
$(‘#bgvid’).tubular(options);
});
< /script>
All of the portions in italicized dark red you will need to replace with your pictures, videos, youtube video ID, etc.
The results ended up looking something like this:
The following are the options and defaults for Tubular.
For any other information on the plugin, check out the plugin source below.
Good luck!
Source: seanmccambridge.com/tubular
Facebook
Advertisement
Recent Posts
Freshbooks
We are a proud supporter of FreshBooks Cloud Accounting. We invite you to give it a try! If you click their logo below you can start the free trial using our invite. From there, if you end up joining and upgrading to a paid plan, both of us get a free month out of the deal!