1. Home
  2. Docs
  3. WPS Player
  4. Shortcode

Shortcode

WPS Player Shortcode is an advanced feature of WPS Player.

In most cases you will just want to use WPS Player to replace the poor video player integrated in WordPress.

WPS Player will replace all videos and iframes on your site automatically. Use the shortcode only if you need to display a video on a specific place of your site.

To fully understand this article, you must have some knowledges about WordPress shortcodes.

Table of content

Introduction to WPS Player Shortcode

WPS Player includes a shortcode. This shortcode allows you to embed MP4 video files anywhere on your site. Then playback them using benefit from the WPS Player options.

WordPress already gets its own Video Shortcode. The way the WPS Player Shortcode works is almost identical.

The difference is that you can also define several links for the same video with different resolutions.

When you use multiple resolutions of a same video, your visitors are able to switch from a resolution to another via the video quality switcher menu integrated in WPS Player.

When to use WPS Player Shortcode

WordPress offers many ways to display videos on your site. But here is the exact scenario where you need to use WPS Shortcode:

  1. You need to display a MP4 video on a specific place on your site. This can be in the content of a page, an article or inside a widget.
  2. You have multiple resolutions of this video.

If you don’t have multiple resolutions files for this video, you can use the default WordPress Video Shortcode.

How to use WPS Player Shortcode

Here is a simple exemple of how to use WPS Player Shortcode:

[wpsplayer 720p="video-source.mp4"]

  • wpsplayer – This is the name of the shortcode.
  • 720p – This is the parameter to add a video source for the 720p resolution.

WPS Player Shortcode comes with the same parameters as WordPress Video Shortcode plus its own parameters for the different resolutions of the video.

Resolutions parameters

  • 4k – The url of your video in 4k.
  • 1080p – The url of your video in 1080p.
  • 720p – The url of your video in 720p.
  • 480p – The url of your video in 480p.
  • 360p – The url of your video in 360p.
  • 240p – The url of your video in 240p.

You can use as many resolutions as you want.

If you use only one resolution parameter, the quality switcher won’t be displayed on the player because there won’t be any other resolution to switch to.

Each video link must be unique. Don’t use the same video url for multiple resolutions. The quality switcher would not work in this case.

Other parameters

  • poster – Defines image to show as placeholder before the media plays.
  • loop – Allows for the looping of media.
    • “off” – (default) does not loop the media.
    • “on” – media will loop to beginning when finished and automatically continue playing.
  • preload – Specifies if and how the video should be loaded when the page loads.
    • “metadata” – (default) only metadata should be loaded when the page loads.
    • “none” – the video should not be loaded when the page loads.
    • “auto” – the video should be loaded entirely when the page loads.

Code exemples

Display a video with a poster and 3 different resolutions (480p, 720p and 1080p) of the same video:

[wpsplayer poster="url-to-image-source.jpg" 480p="url-to-480p-video-source.mp4" 720p="url-to-720p-video-source.mp4" 1080p="url-to-1080p-video-source.mp4"]

Display a video that loops, with a poster and only 1 resolution (720p) of the video:

[wpsplayer loop="on" poster="url-to-image-source.jpg" 720p="url-to-720p-video-source.mp4"]

Was this article helpful to you? Yes No