How to Embed Links and Videos in Moodle

How to Embed Links and Videos in Moodle

» Technology » Tools » Moodle Tools » How to Embed Links and Videos in Moodle



If you want to include any links to outside web resources in your course, you can add them to the page of a Moodle lesson or book, the course homepage, or anywhere else that you enter text using the Moodle text editor. To do this, copy the URL of the website you want to link to, highlight the text you want to link in the editor, then click on the “Insert/edit link” button. (Note: you will need to expand the toolbar in the editor to see this button.) Paste the URL you copied into the “Link URL” line of the popup box, then change the “Target” dropdown menu to the “Open in new window (_blank) option.”

TIP: We recommend that you always set links to open in a new window so that students do not lose their place in your Moodle course. If the link is set to open in the same window, then students have to use the “Back” button in their browser to return to Moodle. If enough time has passed, they may even be signed out of Moodle and have to log back into the course. Setting links to open in a new tab avoids this problem.

If you plan to include any videos in your course, you can embed them anywhere you can insert a link. Some of the most commonly used places are a Moodle page, or the pages of a book or a lesson. YouTube videos are the easiest to embed because Moodle will automatically convert a link to a YouTube video into an embedded video.

To embed videos from other sites, find the embed code for the video in the video’s sharing settings and copy it from the site. Then, open the editor for the Moodle page where you want to display the video. Click on the “Edit HTML source” button in the editor, and paste the embed code in the appropriate location on the page. Click “Update,” then click “Save changes.”

PRO TIP: The embed code is usually formatted with an iframe tag that looks something like this: 

<iframe width=”560″ height=”315″ src=”https://……” frameborder=”0″ allowfullscreen></iframe>

If you would like to adjust the size of the embedded video player, you can do so by changing the width and height in the HTML code. 

How to Undo Automatically Embedded Videos

Most of the time it is helpful to have Moodle automatically embed YouTube videos on the page for you so that students can watch the video right in Moodle rather than have to leave Moodle and go to YouTube to view the content. But every once in a while, you might find yourself wanting to include a link to a video without embedding it, perhaps in a footnote or a recommendation to watch later. If you need to insert a YouTube link that does not automatically embed the video in Moodle, you can do so by making a slight adaptation to the link URL.

When Moodle converts your YouTube link into an embedded video, it looks something like this in the HTML code:

<a href=”https://www.youtube.com/watch?v=abcdef12345″ target=”_blank”>https://www.youtube.com/watch?v=abcdef12345</a>

Find the place where it says ?v= followed by a string of letters and numbers, which gives the unique address to your video. Between the ? and the letter v, insert the following:

embed=no&amp;

The resulting code will look something like this:

<a href=”https://www.youtube.com/watch?embed=no&amp;v=abcdef12345″ target=”_blank”>https://www.youtube.com/watch?v=abcdef12345</a>

Once you save the changes in your HTML editor, the link will show on the page but the embedded video will not.

PRO TIP: If you need to achieve the same effect with a video that comes from a website other than YouTube, you can insert a <span class=”nolink”> tag inside the <a href> tag, like this:

<a href=”https://vimeo.com/1234567″ target=”_blank”><span class=”nolink”>https://vimeo.com/1234567</span></a>



How to Set Up the Gradebook (Part 2)
Extending Moodle Using HTML (Part 1)