Make Your Book

Pressbooks allows you to include a variety of embedded media in your book. You have likely encountered content like this all over the web: YouTube videos in blog posts, Tweets embedded in news articles, or timelines and simulations on an educational site. Many of the same kinds of media or interactive content can be included in your book, allowing your readers to watch videos, view interactive maps, engage with simulations, and more without ever leaving your book.

Display Uploaded Media in Your Book

You can upload some media files, like images and reasonably sized audio files, directly to your book’s media library. Media from your book’s media library can be embedded using the ‘Add’ Media’ button located just above the visual editor. The following is a partial list of supported media file types (your network may allow you to upload additional file types):

Images Audio Video Files
  • jpg
  • jpeg
  • png
  • gif
  • mp3
  • midi
  • MID
  • m4a
  • mov
  • avi
  • wmv
  • mp4
  • pdf
  • epub
NOTE: We discourage users from uploading video directly to their Pressbooks media library in most cases because it’s difficult to provide universal playback support for most videos across all browsers and because video files are often larger than your maximum file upload size. Embedding from a dedicated video streaming service (like YouTube, Vimeo, or Kaltura) is almost always a better choice for including video in your book.

Embed Content via oEmbed

You can automatically embed media from a variety of providers (like YouTube, Twitter, Vimeo, TED, Flickr, Reddit, TikTok, Spotify, and more) which support the oEmbed specification. To embed content from a supported oembed provider:

  1. Copy the URL of the video, audio, or other media (i.e. https://www.youtube.com/watch?v=hrcrFJVgbbs)
  2. Paste the URL onto its own line into the Visual editor
  3. Click Save 

The URL you pasted in step two, should be automatically replaced by the embedded content in the visual editor. After you save the chapter or post, the content will display in the webbook and can be seen by readers if the book is made public.

Embed iframes

Pressbooks restricts the embedding on iframes from most other sites for security reasons. We will allow iframes to be embedded from the following providers, however:

Note: Network managers can permit the embedding of iframes from any other trusted provider via a network-specific iframe allowlist. Contact your network manager with questions about embedding iframes from sources other than those listed above.

 

To embed an iframe from a source that has been permitted for your network:

  1. Copy the source object’s <iframe> embed code (this is usually available in the sharing options of the media on its source website)
  2. Switch to the Text editor in Pressbooks and paste the iframe code you copied in step 1.
  3. Click Save

If the source comes from a permitted domain, the video should then appear in your visual editor and webbook. If you’re unable to embed an iframe from a source because it isn’t allowed for your network, consider simply adding a hyperlink to the resource.

Use Embed and Media Shortcodes

Pressbooks supports two shortcodes, Embed and Media, which can be used to embed media in your book. The embed shortcode is most useful when you’re drafting content outside of Pressbooks (in a word processor, for example) but want to import it later. Using the embed shortcode signals to Pressbooks that there’s an embedded video and not just a regular link in your book. Here’s a sample embed shortcode for the video embedded earlier in this chapter: [em​bed]https://www.youtube.com/watch?v=hrcrFJVgbbs[/em​bed] 

The media shortcode allows you to embed an externally hosted media file (like an image) and includes an optional paramater which will let you define a caption for that embedded media element. Here’s a sample media shortcode (with caption) for a photograph of the Hagia Sophia which is hosted on Wikimedia:

https://commons.wikimedia.org/wiki/Category:Hagia_Sophia#/media/File:Hagia_Sophia_Mars_2013.jpg
The Hagia Sophia. This photograph was taken by Arild Vågen and is licensed under a CC-BY-SA license

Insert H5P Activities

Many Pressbooks networks designed for educational publishing include an integration with H5P, a powerful open source tool that allows you to insert interactive quizzes and other learning activities directly into your webbook. Learn more about creating H5P activities in your book.

H5P creation is not available to authors on Pressbooks.com. If you’re interested in using H5P in your book project, please contact sales@pressbooks.com.

Embedded Media in Exports

Not all embedded media can be displayed in ebook and PDF files. Pressbooks attempts to provide a graceful fallback for any embedded content which cannot be displayed with its proper functionality in any of our export formats. This fallback consists of an inserted message that is populated with information available in the system (may include a title, thumbnail, the kind of media, etc.) and provides the reader with a link to the webbook version of the chapter so they can view the missing element (print readers will see a short URL that they can type into a browser). See a couple of examples below.

License

Icon for the Creative Commons Attribution 4.0 International License

Pressbooks User Guide Copyright © 2012 by Pressbooks is licensed under a Creative Commons Attribution 4.0 International License, except where otherwise noted.

Share This Book