Embed video file beautifully in WordPress using Video.js HTML5 Player. Embed HTML5 compatible responsive video in your post/page with Video.js.
Video.js HTML5 Player is a user-friendly plugin that supports video playback on desktop and mobile devices. It makes super easy for you to embed both self-hosted video files or video files that are externally hosted using Video.js library.
In order to embed a video create a new post/page and use the following shortcode:
[videojs_video url="https://example.com/wp-content/uploads/videos/myvid.mp4"]
Here, “url” is the location of the MP4 video source file (H.264 encoded). You need to replace the sample URL with the actual URL of the video file.
The following options are supported in the shortcode.
WebM
You can specify a WebM video file in addition to the source MP4 video file. This parameter is optional.
[videojs_video url="https://example.com/wp-content/uploads/videos/myvid.mp4" webm="https://example.com/wp-content/uploads/videos/myvid.webm"]
Ogv
You can specify a Ogv video file in addition to the source MP4 & WebM video files. This parameter is optional.
[videojs_video url="https://example.com/wp-content/uploads/videos/myvid.mp4" webm="https://example.com/wp-content/uploads/videos/myvid.webm" ogv="https://example.com/wp-content/uploads/videos/myvid.ogv"]
Width
Defines the width of the video file (Height is automatically calculated). This option is not required unless you want to limit the maximum width of the video.
[videojs_video url="https://example.com/wp-content/uploads/videos/myvid.mp4" width="480"]
Preload
Specifies if and how the video should be loaded when the page loads. Defaults to “auto” (the video should be loaded entirely when the page loads). Other options:
“none” – the video should not be loaded when the page loads
[videojs_video url=”https://example.com/wp-content/uploads/videos/myvid.mp4″ preload=”metadata”]
Controls
Specifies that video controls should be displayed. Defaults to “true”. In order to hide controls set this parameter to “false”.
[videojs_video url="https://example.com/wp-content/uploads/videos/myvid.mp4" controls="false"]
When you disable controls users will not be able to interact with your videos. So It is recommended that you enable autoplay for a video with no controls.
Autoplay
Causes the video file to automatically play when the page loads.
[videojs_video url="https://example.com/wp-content/uploads/videos/myvid.mp4" autoplay="true"]
Poster
Defines image to show as placeholder before the video plays.
[videojs_video url="https://example.com/wp-content/uploads/videos/myvid.mp4" poster="https://example.com/wp-content/uploads/poster.jpg"]
Loop
Causes the video file to loop to beginning when finished and automatically continue playing.
[videojs_video url="https://example.com/wp-content/uploads/videos/myvid.mp4" loop="true"]
Muted
Specifies that the audio output of the video should be muted.
[videojs_video url="https://example.com/wp-content/uploads/videos/myvid.mp4" muted="true"]
The plugin supports the m3u8 file format that can be used for Video.js HTTP Streaming. It allows you to play HLS, DASH, and other HTTP streaming protocols with Video.js, even where they are not natively supported.
[videojs_video url="https://example.com/wp-content/uploads/videos/myvid.m3u8"]
For detailed documentation please visit the Videojs HTML5 Player plugin page
Video.js is a web video player built from the ground up for an HTML5 world. It supports HTML5 video playback on desktop and mobile devices.