and like us on FB

On the 1st of July in 2015, WordPress announced a complete overhaul of VideoPress . VideoPress is a commercial product offered as an upsell to the WordPress.com , and Jetpack (WordPress.org) self hosted service. Built on top of the Open Source Media Framework its behaviour is controlled entirely by JavaScript, HTML and CSS, meaning that theming and customization options can be built upon the very malleable slate.

The player is one of my personal favorites and I await eagerly for the guys at WordPress to either make it commercially available as a self-hosted player, or open it up to the Open Source community – as they’ve already done with certain components .

This article will provide you with shortcode that will render a VideoPress video in your WordPress website (with optional meta data). Player options such as looping, autoplay, and the offset start time are all available as shortcode attributes. The player itself has a share button that launches a blind that offers embed code, download links and a permalink.

A PHP version is available for download. Requires Simple Cache.

The Result

Shortcode of [videopress v="https://videopress.com/v/iQnkO4EL"] (a video that demonstrates the features of the player) will render as follows.

VideoPress Share (20s). Posted: 1st July 2015

By default the video will display the video title, length, and description – with the description silenced by the attribute of meta="0". To render a video without the description, and and starting at the 80 second mark, we’ll use the shortcode of [videopress v="https://videopress.com/v/kUJmAcSf" meta="0" offset="80"] (attributes are discussed below).

Shortcode Attributes

The following shortcode attributes are available.

v

v is the full video URL or just the video ID.

width

The width refers to the default video width. Ensure you hardcode it to a suitable width that suits your own WordPress post container.

height

The height is the height of the video container. The video will automatically scale based on your width. You should only define it if the default video doesn’t scale correctly.

loop

If you would like your video to loop, use loop="1". False by default.

autoplay

If you would like your video to autoplay on page load, use autoplay="1". False by default.

offset

If you would like to offset the start time of your video, use offset="300" – where the value is the number of seconds. In this case, 5 minutes.

meta

The meta is the small container under your video with video data. Use meta="0" to remove it. We cache the result as a transient for occasions when the video title or description changes.

The Shortcode Function

Copy and paste the WordPress function into your theme's functions.php file or, if you sensibly have one installed, your custom functions plugin. You may optionally download and install our plugin from the bottom of of the page.

If you require shortcode to work in a sidebar widget, you'll have to enable the functionality with a filter. If you're using our custom functions plugin, you'll have that feature enabled by default.

Considerations

  • Additional information can be extracted from the JSON result and included to style the meta box to your liking.
  • WP’s embedded JavaScript will scale the video container in a responsive way without any additional CSS.
  • The video duration format can be altered as described here.

Download

Title: Embed VideoPress Videos
Description: Embeds a VideoPress video (and optional meta data) in your website with shortcode.
Download: Shortcode (V0.2) | WP Plugin (V0.2) | PHP Code (V0.2)

Shortt URL for this post: http://shor.tt/10wD