Play Youtube Video Builder in Background in HTML5

HTML5 Background Video Builder is a simple jquery-based plugin that helps create a responsive html5 video in the background. Placing background videos in the first fold section or anywhere else is a very popular and popular trend on the website.

youtube video html, youtube iframe api, youtube iframe api npm, javascript video player, youtube embed autoplay

How to make use of it:

1. To start, insert the JavaScript jquery-tape-plugin.js and Stylesheet jquery-tape-styles.css into the HTML doc.

<link href="jquery-tape-styles.css" rel="stylesheet" />
<script src="/path/to/cdn/jquery.slim.min.js"></script>
<script src="jquery-tape-plugin.js"></script>

2. Then define the path to the HTML5 video that might be used as a background in a particular container.

<div class="container" 
     id="example" 
     data-mp4="1.mp4" 
     data-webm="1.webm">
     <div class="content">Any Content Here</div>
</div>

3. Apply a height property to the container and make it relative positioned.

.container {
  width: 600px;
  height: 450px;
  position: relative;
}

4. Finally, call the function buildHtmlVideo on the container and complete it.

buildHtmlVideo({
  parentElement: $("#parentContainer")
});

5. Determine whether or not to autoplay the HTML5 video on mobile, tablet, or desktop.

buildHtmlVideo({
  parentElement: $("#parentContainer"),
  playInMobile: true,
  playInTablet: true,
  playInDesktop: true
});

6. Specify a fallback picture for the video background.

buildHtmlVideo({
  parentElement: $("#parentContainer"),
  fallbackImage: "1.jpg"
});

7. Override the default data attributes:

buildHtmlVideo({
  parentElement: $("#parentContainer"),
  webmVideo: $("#parentContainer").attr("data-webm"),
  mp4Video: $("#parentContainer").attr("data-mp4")
});

8. Execute a callback function when the plugin has been initialized.

buildHtmlVideo({
  parentElement: $("#parentContainer"),
  callback: function() {
    console.log("Build complete");
  }
});

9. To show content on the top of the video background, remember to make the position absolute and modify the z-index property slightly.

.content {
  z-index: 9999; 
  position: absolute; 
  top:2rem; left: 2rem;
}

Put HTML5 Video As A Background In HTML, HTML5 Background Video Plugin/Github


See Demo And Download

Official Website(sricharankrishnan): Click Here

This superior jQuery/javascript plugin is developed by sricharankrishnan. For extra Advanced usage, please go to the official website.

Related Posts

Google-Translate-Dropdown-Customize-With-Country-Flag

Google Translate Dropdown Customize With Country Flag | GT API

Flag google translates jQuery text that takes advantage of the Google Cloud Translation API to translate web content between languages by selecting a country from the dropdown…

Bootstrap-Fileinput

HTML 5 File Input Optimized for Bootstrap 4.x./3.x with File Preview | Bootstrap Fileinput

bootstrap-fileinput is an improved HTML 5 file input  Bootstrap 5.x, 4.x and 3.x with file preview for different files, provides multiple selections, resumable section uploads, and more….

HStack-and-VStack-in-CSS

CSS Layout Components Horizontal/Vertical Stack | HStack and VStack

HStack and VStack in CSS – CSS layout components that (basically) stack anything horizontally and vertically. A pure CSS library that makes it easy to stack elements…

Floating-Whatsapp-Chat-Button

How to Add Floating Whatsapp Chat Button In HTML | venom-button

Venom Button is a very simple plugin for the jQuery floating WhatsApp button. Adds a floating button to your site that calls WhatsApp Click to Chat API. It will automatically start the WhatsApp…

Data-Table-Generator-Tabulator

Interactive Data Table Generator with JS/jQuery and JSON | Tabulator

Tabulator allows you to create interactive tables in seconds from any HTML Table, JavaScript array, AJAX data source, or JSON format data. Just include the library in your…

alert-confirm-prompt-attention-js

Simple Alert, Confirm, Prompt Popup Using Vanilla JavaScript Library | attention.js

JavaScript provides various built-in functionality to display popup messages for different purposes. Attention JS is a vanillaJS plugin used to create a custom alert, confirm, or Prompt…

Leave a Reply

Your email address will not be published. Required fields are marked *