Your Favorite YouTube Video as a Background


BackTube takes a single video from YouTube and injects it as a background on any element.

Find Out More

Youtube as background on the fly!


BackTube is capable to set element's background to video with no hassle. Just load the script and instantiate then you're done.

Set Video to background

API


element

HTML element to set video background with given videoId.
YouTube iframe will be appended to the specified element.

// shows background video to #video element
var element = document.getElementById('video');
new BackTube(element, 'some_video_id');

videoId

Video id is the value of `v` key in any YouTube video URL. ie) https://www.youtube.com/watch?v=EKyirtVHsK0

// shows background video to #video element
new BackTube(document.querySelector('#vid'), 'some_video_id');