Videos


Note: All videos should be uploaded to a video hosting location other than on our Drupal sites. Drupal is not designed to host videos and sites like YouTube and Vimeo have much better accessibility, especially across mobile and tablet devices.

Add Videos

Place your cursor where you want the YouTube or Vimeo video to be inserted.

Click on the iFrame (globe) icon on the right-hand side of the formatting bar.

Screenshot of WYSIWYG of button to add a video

That will bring up the IFrame Properties pop-up box.

Drupal iFrame editor with "video" in the advisory title box

In the Advisory Title box, enter in the word Video. You can also enter in the title of the video.

Add YouTube Video  |  Add Vimeo Video


YouTube Videos

To add a YouTube video, go to the YouTube page. Click on Share below the title of the video.

Screenshot of YouTube screen

That will give you a menu for Share, Embed, and Email. Click on Embed.

Screenshot of YouTube screen highlight the embed button

A line of HTML code that begins with <iframe will appear. In the line of code, highlight the web address for the YouTube site that is located there. Start with https://www.youtube.com/embed/ (do not include the quotation marks). Copy the web address.

Screenshot of YouTube screen highlight the source code

Paste the copied URL into the URL box in the iFrame Properties box. That should embed your video. Continue to "Reset Video After Playing" and "Make Videos Responsive."

Drupal iFrame editor with "video" in the advisory title box

Vimeo Videos

The process is essentially the same for embedding a video from Vimeo.

To add a Vimeo video, go to the Vimeo page of the video. Click on the "Share" button below the title or on the video.

Screenshot of UO Vimeo video and share button

That will give you a menu for Share this video with Link, Email, and Embed.

Click on Embed. A line of HTML code that begins with <iframe will appear. In the line of code, highlight the web address for the Vimeo site that is located there. Start with https://player.vimeo.com/video/ (do not include the quotation marks). Copy the web address.

Screenshot of Vimeo embed settings

Paste the copied URL into the URL box in the iFrame Properties box. That should embed your video. Continue to "Make Videos Responsive."

Drupal iFrame editor with "video" in the advisory title box

Reset YouTube Videos After Playing

If you want to have the video return to the start of that particular video when it concludes, rather than going to a new video or showing related videos, just add ?rel=0 after the URL when you paste it in the iFrame Properties box. Example: For the video above, you would put https://www.youtube.com/embed/E_qE0aIpzGg?rel=0 in the URL box.


Make Videos Responsive

Once you have the URL entered, enter in a title for the video.

Screenshot of the iFrame Properties with Advanced circled

Once you have entered the code, click on “OK.” That will return you to the page. NOTE: You will not be able to see the video on the edit screen. It will show up on the edit screen as a white box outlined in black with iFrame written in red in the middle.

Now that you have added the iFrame video to the page, click on the “Source" button in the editor menu.

Body copy with the link for Disable rich-text circled

This will show a view of the page in HTML code.

HTML code for a basic page

Find the start of the code for your video, which begins with <iframe, and place the cursor just before the <iframe

HTML code for a basic page with iframe code highlighted

Make sure the iFrame has the style="position:absolute; width:100%; height:100%" in the video code. If it does not have all of that code, add anything missing, then paste in the following HTML code just before the <iframe at the beginning: <div style="position:relative; width:100%; height:0px; padding-bottom:56.25%;">

Then paste in the following HTML code just after the </iframe> at the end: </div>

HTML code for a basic page with iframe code and div code highlighted

The final code all together should look something like this:

<div style="position:relative; width:100%; height:0px; padding-bottom:56.25%;"><iframe frameborder="0" scrolling="no" src="https://www.youtube.com/embed/UZEy9FVn7s4?rel=0" style="position:absolute; width:100%; height:100%" title="video"></iframe></div>

Notes about padding:

In general, most videos in a standard aspect ratio will use the 56.25% number. However, you may need to adjust your padding % depending on the specific aspect ratio of your videos and the location of the embedded video. As an example, some of the common header video ratios are 34.7%, 36.55%, 37.48%, and 40.7%.

Header videos will also generally need to have an additional class added to the other hero template classes: envelope-hero--video. Adding the "envelope-hero--video" class will allow your video to scale fullwidth.

After you have added all of the HTML code, you can click the source button to return to the normal editing screen.

Be careful while working around the video in your page as while the iFrame box will not appear as a video, but as an empty box and it is easy to accidentally click inside the video <div> code instead of the page's text area.

Accessibility in Practice

Caption all videos. YouTube has very useful built in captioning tools. For videos not hosted on YouTube you can caption your videos using web applications like Universal Subtitles.

All audio files must contain links to text transcripts.

Your videos need to have title="video"in the embed code, which is generally only added in Drupal 8+ versions in the source code.


Inserting Videos from Other Sources

Very rarely you may run across a video from somewhere other than YouTube, Vimeo, or media.uoregon.edu that you need to embed. Should you find yourself in this situation, you will need to insert the video using an iFrame.

Place your cursor where you want the video to be inserted.

Click on the iFrame (globe) icon on the right-hand side of the formatting bar.

iFrame button

That will bring up the IFrame Properties pop-up box.

Drupal iFrame editor with "video" in the advisory title box

Paste the URL from the video into the URL box of the iFrame pop-up.

Adjust the Width and Height relative to your video requirements.

Click the OK button, and your video will be inserted. Note that you will not see your video until you publish your page, when the iFrame content is updated.


Example Featured Video

 

When used as a Featured Hero video your code may look something like this:

<div class="envelope-hero envelope-hero--text-bottom">
<div class="envelope-hero__container">
<div class="envelope-hero__photo">
<div style="position:relative; width:100%; height:0px; padding-bottom:40.28%; background-size: cover;"><iframe allowfullscreen="" frameborder="0" scrolling="no" src=https://player.vimeo.com/video/786031724?h=3dec58a0f7&amp;background=1 style="position:absolute; width:100%; height:100%" title="University Communications examples of past video projects loop"></iframe></div></div>
</div>