Warning: Constant MULTISITE already defined in /home/pbmalartu/public_html/wp-config.php on line 107

Warning: Constant SUBDOMAIN_INSTALL already defined in /home/pbmalartu/public_html/wp-config.php on line 108

Warning: Constant DOMAIN_CURRENT_SITE already defined in /home/pbmalartu/public_html/wp-config.php on line 109

Warning: Constant PATH_CURRENT_SITE already defined in /home/pbmalartu/public_html/wp-config.php on line 110

Warning: Constant SITE_ID_CURRENT_SITE already defined in /home/pbmalartu/public_html/wp-config.php on line 111

Warning: Constant BLOG_ID_CURRENT_SITE already defined in /home/pbmalartu/public_html/wp-config.php on line 112

Warning: The magic method Pressbooks\Book::__wakeup() must have public visibility in /home/pbmalartu/public_html/wp-content/plugins/pressbooks/inc/class-book.php on line 62
Embedding YouTube Videos – BC Open Textbook Authoring Guide ="http://www.w3.org/2000/svg" viewBox="0 0 512 512">

Adding Videos

Embedding YouTube Videos

Typically, the best way to add videos to a textbook is to host them on YouTube, and then embed them into the book afterwards. This section assumes that the videos to be embedded are already hosted on YouTube.

There are two main ways to embed a YouTube video into a Pressbooks chapter:

Automatic Embed

The easiest way to embed a video is to simply copy the video’s URL and paste it into either the Visual or Text view in the Pressbooks editor. Thus, the following code:

Opening paragraph here...
https://www.youtube.com/watch?v=5_t6lmKhBOI
Closing paragraph here...

Would yield the following:

Opening paragraph here…

Closing paragraph here…

Manual Embed

Another way to embed a video is to manually insert the embed code from the YouTube video. To do this, go to the YouTube video and right-click on the video, then select the “Copy embed code” option, and press Ctrl-C (PC) or Command-C (Mac) to copy the embed code. You can then paste the embed code into the Text view of the Pressbooks editor.

Right-click the image, then select "Copy embed code."

Right-click the image, then select “Copy embed code.”

Once the embed code is highlighted, use Ctrl-C (PC) or Command-C (Mac) to copy the embed code.

Once the embed code is highlighted, use Ctrl-C (PC) or Command-C (Mac) to copy the embed code.

The embed code likely makes the video display too large – the ideal size is 500 by 281 pixels. Go into the Text View to edit these dimensions:

The default embed code ought to look like this:

<iframe width="854" height="480" src="https://www.youtube.com/embed/oXOSDwVX0Dw" allowfullscreen>

Change that to:

<iframe width="500" height="281" src="https://www.youtube.com/embed/oXOSDwVX0Dw" allowfullscreen>

Thus, the following code:

Opening paragraph here...
<iframe width="500" height="281" src="https://www.youtube.com/embed/oXOSDwVX0Dw" allowfullscreen>
Closing paragraph here...

Would yield the following:

Opening paragraph here…

Closing paragraph here…

License

Icon for the Creative Commons Attribution 4.0 International License

BC Open Textbook Authoring Guide by BCcampus is licensed under a Creative Commons Attribution 4.0 International License, except where otherwise noted.

Share This Book

css.php