Instructions: Embed self-hosted .mp4 video in WordPress

How to embed a video from your own hosting in Wordpress

Many of you using WordPress will simply embed videos in your posts using the URL from YouTube. WordPress then recognizes that it is a film that is on YouTube and automatically builds the appropriate code for embedding it around the URL. In this way, all you have to do is copy and paste the YouTube URL into the post.

However, if you want to embed a video that is not on such a video platform as YouTube, WordPress only displays the URL in the post and does not create a media player to display the video directly in the post. How to do it anyway, I'll show in this post.

WordPress recognizes these audio / video platforms

The whole thing with auto-detection and embedding doesn't just work with YouTube videos, it works with many other platforms:

AnimotoiSnareSpeaker deck
CloudupIssuuSpotify
CollegehumorPolldaddyTED
DailyMotionRedditTumblr
FlickrReverbNationTwitter
FunnyOrDieScribdVideoPress
HuluSlideShareVimeo
ImgurSmugMugcomes
InstagramSoundCloud

Embed with the WordPress media player

The easiest way to embed a video in a post or page without YouTube and Co. works with the WordPress media player. I have to admit, I only noticed that there was such a thing after I had already installed a plugin for embedding.

Once you have uploaded the video, you can incorporate it into a post like an image and then choose whether it should be displayed in a media player.

Once you have uploaded the video, you can incorporate it into a post like an image and then choose whether it should be displayed in a media player.

But the way is very simple:

  1. Make sure that the audio is encoded in AAC (otherwise the sound will be missing afterwards)
  2. Upload the video file via the "Media" area in WordPress
  3. Edit a post or page
  4. Press the "Add media" button
  5. Click on the film and select the option "Integrated media player" at the bottom right under "Display settings for attachments"
  6. after “insert into the page” a WordPress shortcode will be integrated into the post

Of course, you can also create the shortcode yourself if the video is not available in the media library, for example. This format is used for this:

With this shortcode you can embed videos in WordPress via a URL.

With this shortcode you can embed videos in WordPress via a URL.

There are also options that can be built into this shortcode. Among other things, the size can be set with "width" and "height". You can find a full list of options here at WordPress.org.

This is what the embedded video looks like on my customer's website - all with WordPress home remedies and without YouTube.

This is what the embedded video looks like on my customer's website - all with WordPress home remedies and without YouTube.

Embed videos with Easy Video Player plugin

The first option I chose before discovering WordPress' own media player system was the WordPress plugin "Easy video player".

This actually only has a few features and options that set it apart from the WordPress player as an alternative. I'll translate from the plugin homepage and comment on it:

  • Embed MP4 video in your website (WP is built out of the box)
  • Embed responsive video for a better user experience on mobile devices (WP already offers this, too)
  • Embed HTML5 video which is compatible with all major browsers
  • Embed video with "Poster Images" (WP also offers)
  • Embed video that is played in a loop (WP also offers)
  • Embedding of video with the "mute" option enabled
  • Customize the player appearance using CSS classes
  • Option to choose between MediaElement Player or the normal WordPress Video Player

So the bottom line is that there isn't much to be said for installing another plug-in for the videos. I'd rather keep WordPress lean and use the WordPress shortcode for embedding.

If you use the "Easy Video Player" plug-in, the media player looks like this, for example.

If you use the "Easy Video Player" plug-in, the media player looks like this, for example.

Advantages and disadvantages of self-hosted videos

In addition, a short word about the advantages and disadvantages of not using YouTube and Co. In my current case, the video had to be hosted myself because my customer did not want to use YouTube on the website for data protection reasons. With the embedding of a video, cookies are inevitably set for the website visitor and we would have, for example, with Borlabs Cookie need to provide a way to refuse cookies.

To get around this, the video ended up on the client's hosting space.

The advantages:

  • You don't share user data with Google.
  • You have full control over the quality of the video as it is not compressed and converted again.
  • You can exchange the video for a revised version at any time, which is only possible on YouTube if you save the video as a "new" video.
  • The video is ad-free and no videos from the competition are displayed at the end, which could distract visitors from the website.

The disadvantages:

  • The loading time of the video is certainly longer than if you choose the route via YouTube, since the video platform reserves the video for all possible end devices in different qualities.
  • Due to the longer loading time, it can happen that you lose website users (according to one Akamai study 53% of visitors drop off if the page loads for more than 3 seconds).
  • The video does not appear on YouTube and is therefore not made available to the international audience via search. This means that a potential customer will slip by the rags who do not even notice your own website. As an alternative, you can consider hosting the video on the website itself, but also making it available on YouTube.
The faster loading time from videos that are hosted externally is a point that speaks for YouTube or Vimeo.

The faster loading time from videos that are hosted externally is a point that speaks for YouTube or Vimeo.

My conclusion

YouTube, video and the like are a good way of reaching new visitors and thus potential customers relatively quickly. The optimization of loading times for all possible devices is also a plus point that has to be attributed to the video platforms.

However, if privacy is a concern, hosting the video on your own server may be a better choice. I think you have to evaluate this on a case-by-case basis.

In the case of my customer, self-hosting was definitely the right decision. WordPress makes it very easy to integrate the video using a shortcode.

-
Do you like my blog? Then I would be happy to receive a short review on Google. Easy leave something here for a moment - that would be great, thank you!

Leave a Comment

Your e-mail address will not be published. Required fields are marked with * .