Plugin Directory

WordPress Video Solution Framework

URL Structure

Sample Video URL Structure Note that in version 1.0 and beyond, by default you don't need to modify any .htaccess. However, if you want to have shorter and more concise URL structure, you can follow the example below.

Suppose a user uploads a video, which is transcoded and processed successfully by the video system Internally, the video is assigned the guid: hFr8Nyar. The internal shortcode produced is [wpvideo hFr8Nyar].

Before the video is displayed on a WordPress blog, the parsing function in video.php converts the shortcode into the following embed code:

<embed src="http://v.mydomain.com/hFr8Nyar" type="application/x-shockwave-flash"
 width="400" height="224" allowscriptaccess="always" allowfullscreen="true"></embed>

In the above example, v.mydomain.com/hFr8Nyar is rewritten to v.mydomain.com/wp-content/plugins/video/flvplayer.swf?guid=f6n7RD5B by the following rewrite rule defined in .htaccess:

RewriteCond %{HTTP_HOST} ^v\.mydomain\.com
RewriteCond %{REQUEST_URI} !/videofile/
RewriteCond %{REQUEST_URI} !/wp-content/
RewriteRule ^([^/]+) /wp-content/plugins/video/flvplayer.swf?guid=$1&video_info_path=http://v.mydomain.com/wp-content/plugins/video/video-xml.php [L,R=302]

Once the player (flvplayer.swf) is loaded, it receives the video guid, and path to obtain video XML information. then the flash player queries video-xml.php to retrieve all the relevant information about a video, including different formats, thumbnail images, duration, and other meta information.

For example, for the above guid hFr8Nyar, the video player queries and obtains the following xml data.

Here's a link to video xml information for guid hFr8Nyar

The player then intelligently loads the most suitable video files and plays the video. For example, if the player checks the embed width and height, and decides that it is best to fetch and play the smaller version, it will use the fmt_std section of the xml file and request the corresponding movie file and original thumbnail images.

As you can see in this example, the video files URL structure has the following format: blog_domain.videos.mydomain/guid/format

The important thing is to use a consistent structure and you can serve the files accordingly.

On the system side, you need to make sure you can serve the video files according to the URL structure.

The following rules are configured in .htaccess for this purpose:

RewriteCond %{REQUEST_URI} ^/$
RewriteCond %{HTTP_HOST} ^(.+)\.videos\.mydomain\.com
RewriteRule (.*) http://%1.mydomain.com/ [R,L]

RewriteCond %{HTTP_HOST} ^(.+)\.videos\.mydomain\.com
RewriteCond %{REQUEST_URI} !blogs.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/(.*)/(.*)$  /wp-content/blogs.php?video_guid=$1&type=$2&format=$3 [L]

In the above, the video is served by /wp-content/blogs.php. This is a purely system-specific example. You will need to determine how you will serve your videos, either from your own local data server or using CDN.

Download

FYI

  • Other Versions »
  • Last Updated: 2009-9-17
  • Requires WordPress Version: 2.6 or higher
  • Compatible up to: 2.8

Compatibility beta

Your Setup

Log in to vote.

The Consensus

No data

Average Rating

5 stars
4 stars
3 stars
2 stars
1 star
(16 ratings)