If you would like to make your embedded videos responsive to the screen size your viewers are watching the video on, the code to add is fairly simple, but it is based on the aspect ratio of the video. For YouTube videos, this information can be found under Share >> Embed code. For example, this What Is OER video has a embed code that indicates the video is 560 wide and 315 high has a 16 by 9 aspect ratio. Below is the code for responsive videos of the most common aspect ratios. Below is also an example of code for a video that has additional playing code for a video. To translate and width and height to an aspect ratio, use an aspect ratio calculator.
<!-- 21:9 aspect ratio -->
<div class="embed-responsive embed-responsive-21by9">
<iframe class="embed-responsive-item" src="..."></iframe>
</div>
<!-- 16:9 aspect ratio -->
<div class="embed-responsive embed-responsive-16by9">
<iframe class="embed-responsive-item" src="..."></iframe>
</div>
<!-- 4:3 aspect ratio -->
<div class="embed-responsive embed-responsive-4by3">
<iframe class="embed-responsive-item" src="..."></iframe>
</div>
<!-- 1:1 aspect ratio -->
<div class="embed-responsive embed-responsive-1by1">
<iframe class="embed-responsive-item" src="..."></iframe>
</div>
Example
<div class="embed-responsive embed-responsive-16by9">
<iframe allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen="" class="embed-responsive-item" frameborder="0" src="https://www.youtube.com/embed/VjGflXu6FSk" title="YouTube video player"></iframe>
</div>
Would you like a video to begin playing as soon as a viewer clicks on a guide homepage or other page within your guide? Autoplay may be attention getting, but it can also be annoying to viewers, so it should be used sparingly. If you believe a viewer will be returning to this page over and over, they will likely become more annoyed with it over time, so you may only want to use autoplay on pages you think have information that will only be need once. Also consider whether you want the sound to play or for the video to be mute. The movement of the video will get attention in and of itself, and it gives the option to the viewer of whether to turn on the sound.
First, find the embed URL for a YouTube video by selecting Share. Copy the URL.
If the embed URL ends with a question mark (?), add the following code to the end of the URL
For autoplay only: autoplay=1
For autoplay + mute: autoplay=1&mute=1
If the embed URL does not end with a question mark (?), add the following code to the end of the URL
For autoplay only: ?autoplay=1
For autoplay + mute: ?autoplay=1&mute=1
Example
<div class="embed-responsive embed-responsive-16by9">
<iframe allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen="" class="embed-responsive-item" frameborder="0" src="https://www.youtube.com/embed/BYgPi5SFudg?autoplay=1&mute=1" title="YouTube video player"></iframe>
</div>
Commenting on blog posts requires an account.
Login is required to interact with this comment. Please and try again.
If you do not have an account, Register Now.