At some point I wanted to integrate a Silverlight based player into my blog, so I was looking for a WordPress plugin that would do that. However, I could not find any that was easy enough to use. So I decided to write one myself for self-educational purposes. This post describes and demonstrates the plugin that I wrote and explains how to use it to add Silverlight-based media players to blog posts and pages of a WordPress powered blog.
Description and Features
The plugin has the following features:
- Default player configuration settings, such as size, thumbnail, auto load and auto play.
- Per-instance player configuration settings that can be used to customize each individual player within or across blog posts.
- Unlimited number of players within the same blog post or page.
- Option to not load players on the home page of the blog. This helps to reduce the amount of content to download for visitors who do not want to watch a video.
- 6 player styles
Here is an example of how the media player plugin works:
(the video may play with interruptions – my server’s internet connection is pretty slow)
Download and Install
Download the plugin from here:
The plugin has been tested on WordPress versions from 2.5 up to 2.7. Once you downloaded the plugin files follow these steps to install and configure it:
Step 1: Upload wp-media-player directory (including all files and directories withing) to the /wp-content/plugins/ directory. Make sure that the path to the main plugin php file is /wp-content/plugins/wp-media-player/wp-media-player.php. If path does not look like this then plugin may not show up in the WordPress plugins page.
Step 2: Activate the plugin through the ‘Plugins’ menu in WordPress.
Step 3: Visit the plugin settings options (Options – WP Media Player) for WordPress 2.3.x, (Settings – WP Media Player) for WordPress 2.5.x-2.7
To add a player to a blog post or a page, follow these steps:
Step 1: Encode the video to a Windows Media Video (WMV) format by using Microsoft Expression Encoder or Windows Media Encoder. If you use Windows Media Encoder then follow these instructions to properly encode the video content for Silverlight.
Step 2: Upload the video to WordPress either via FTP or by clicking on “Add Video” in the post editing page:
When uploading the video, take a note of the absolute URL path where the video file has been placed to. Do not click on “Insert into Post” button!
Step 3: Place the following tag inside of the blog post content where you want the video player to appear:
To use a custom placeholder image instead of the default one use the “thumb” parameter, e.g.:
[mediaplayer src=”/absolute/url/path/to/video/file.wmv” thumb=”/absolute/url/path/to/thumb/file.jpg”]
To specify player’s width and height, use the “width” and “height” parameters, e.g.:
[mediaplayer src=”/absolute/url/path/to/video/file.wmv” width=320 height=240]
To change auto load and auto play settings use “autoLoad” and “autoPlay” parameters, e.g.:
[mediaplayer src=”/absolute/url/path/to/video/file.wmv” autoLoad=1 autoPlay=0]
Please try it out on your WordPress installation and let me know if you find any bugs or if you have any suggestions.