DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Last call! Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • Choosing the Best CSS Frameworks for Enterprise Web Applications
  • How To Integrate a Web Component Into a Mobile App While Preserving Native UX
  • Difference Between Bootstrap and AngularJS in 2022
  • How to Bootstrap a Spring Boot Application Using STS (Spring Tool Suite)? | Spring Boot Tutorial

Trending

  • Cookies Revisited: A Networking Solution for Third-Party Cookies
  • The Cypress Edge: Next-Level Testing Strategies for React Developers
  • Start Coding With Google Cloud Workstations
  • How Large Tech Companies Architect Resilient Systems for Millions of Users
  1. DZone
  2. Coding
  3. Frameworks
  4. How to Implement Bootstrap Responsive Video

How to Implement Bootstrap Responsive Video

If you're new to web development, check out this article on how utilize Bootstrap to create responsive videos on your web page.

By 
Joy Twain user avatar
Joy Twain
·
Updated Nov. 12, 18 · Tutorial
Likes (11)
Comment
Save
Tweet
Share
110.1K Views

Join the DZone community and get the full member experience.

Join For Free

If you are using any videos on your website then make sure they are responsive in nature. A responsive videoautomatically adapts to the screen size of the user.

In this tutorial, you will learn how to implement Bootstrap Responsive Video in your website.

How to Put Videos on a Website

Mostly we use the HTML 5 Video Tag to put a video on a website. The video tag is shown below:

<video width="320" height="240" controls>
  <source src="movie.mp4" type="video/mp4">
</video>

However, we can also embed videos from third-party websites like Youtube and Vimeo.

In Youtube, click the “Share” button then click the “embed” button to copy the embed code of the video. Now, to show this video on your website, simply paste this embed code into your web page, and that’s all. This video will now show up on the web page.

In the below picture, I have marked how to copy the Video’s embed code from Youtube.

how to get embed video code in youtube

Bootstrap Responsive Code

In Bootstrap, the video should be placed in one of two ways – an aspect ratio of 16:9 or 4:3. The code for this is given below:

<!-- 16:9 aspect ratio --> 
<div class="embed-responsive embed-responsive-16by9"> 
    //add video code 
</div> 

<!-- 4:3 aspect ratio --> 
<div class="embed-responsive embed-responsive-4by3">
    //add video code
</div>

Note: There is a prerequisite that you should know how to use Bootstrap on your website. So that you can create a Bootstrap grid and place the video in that grid.

If you want to place a video tag then the above code will become:

<!-- 16:9 aspect ratio --> 
<div class="embed-responsive embed-responsive-16by9"> 
    <video width="320" height="240" controls>
        <source src="movie.mp4" type="video/mp4">
    </video>
</div> 

<!-- 4:3 aspect ratio --> 
<div class="embed-responsive embed-responsive-4by3">
    <video width="320" height="240" controls>
        <source src="movie.mp4" type="video/mp4">
    </video>
</div>

In the same way, if you are using a Youtube embed code for a video then the Bootstrap Responsive Video code will become:

<!-- 16:9 aspect ratio --> 
<div class="embed-responsive embed-responsive-16by9"> 
    <iframe width="560" height="315" src="https://www.youtube.com/embed/VS6UOyTb5eU" 
frameborder="0" allowfullscreen></iframe>
</div> 

<!-- 4:3 aspect ratio --> 
<div class="embed-responsive embed-responsive-4by3">
    <iframe width="560" height="315" src="https://www.youtube.com/embed/VS6UOyTb5eU" 
frameborder="0" allowfullscreen></iframe>
</div>

Testing Bootstrap Responsive Video

Let me show you how this responsive video will look in different screen sizes. I have given 3 screenshots of the view given by these responsive videos.

a. Responsive Video in Smartphones

responsive video in smarphones



b. Responsive Video in Tablets

responsive video in tablets

c. Responsive Video in Laptops

responsive video in laptops

You can check out a demo, here. 

Conclusion

Isn't Boostrap really easy to use? If you have any questions/comments on Bootstrap or this tutorial, then make sure to provide it in the below comments section.

Bootstrap (front-end framework)

Opinions expressed by DZone contributors are their own.

Related

  • Choosing the Best CSS Frameworks for Enterprise Web Applications
  • How To Integrate a Web Component Into a Mobile App While Preserving Native UX
  • Difference Between Bootstrap and AngularJS in 2022
  • How to Bootstrap a Spring Boot Application Using STS (Spring Tool Suite)? | Spring Boot Tutorial

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!