Lesson 16Adding Video and Audio

Changes in WordPress, combined with new HTML5 capabilities, mean that adding video and audio to your website is now as simple as adding images. That's good news because the popularity and importance of video continue to grow. And the potential for audio to enhance your site becomes truly practical. So the question now is not whether you can use video or audio in WordPress, but where to store and serve these sometimes numerous and large files.

Video

This section shows you how to insert video that you host on another server, as well as video you upload to WordPress, and how to decide between each method. You also see how to resize videos to fit a specific location on your site.

Inserting Video Hosted with a Third Party

As a rule of thumb, you don't want to put video files on your (very likely, shared) hosting account. They'll slow down your site and potentially overload your server if you get any kind of traffic to them. So what do you do?

For most of us, the obvious answer is YouTube:

  • Accounts are free.
  • You can store and serve hundreds, even thousands, of videos.
  • Public videos get exposure through the YouTube search engine.

There are other scenarios and other solutions (some are mentioned later) but let's use YouTube as an example so that you can see how simple the process of embedding external video is.

I've created a YouTube account and uploaded a video. (I won't go into details here because it's well-documented online.)

I copied the URL ...

Get WordPress 24-Hour Trainer, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.