Get the App
SLTechnology News&Howtos  ›  Development  › 

How to play YouTube video automatically in Bootstrap mode

Shulou Source: shulou.com Published: 2022-06-01 03:55:13 09月22日 Update

This article introduces the knowledge of "how to play YouTube videos automatically in Bootstrap mode". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Answer: use JavaScript to add and delete video source URL

If you try to automatically play a YouTube video embedded in Bootstrap mode by attaching a video source URL (that is, attribute values), the video will not work properly because the video starts playing before the display mode. Src?autoplay=1

To resolve this issue, you can add or remove the YouTube video source URL depending on whether you use JavaScript display Bootstrap mode or not. Let's see how it works:

The code is as follows

Autoplay YouTube Video in Bootstrap Modal

. modal-content iframe {

Margin: 0 auto

Display: block

}

This is the end of the content of "how to automatically play YouTube video in Bootstrap mode". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Video mode content more knowledge work practicality achievement next code dilemma reality attribute situation article is in case answer tape URL Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux OPPO Reno MySQL macOS Shulou Technology