You are invited to Log in or Register a free Frihost Account!

Syndicate Rich Media

Media RSS can tell Yahoo! and the world about your audio and video.
Web publishers have been using the syndication format RSS to move text around the Internet since 1999. Typically, an RSS feed contains summaries of news stories or weblog posts and URLs that point to the permanent location of those pieces of text. The type of content that could be delivered via RSS expanded when the format added support for enclosures. Enclosures are like email attachments and can be used to include any type of binary file, including audio and video.
This support for enclosures led to a new form of audio distribution called podcasting, which lets people subscribe to audio shows via an RSS file and automatically download new episodes to an iPod or other portable media player. This new distribution method has generated an explosion of independent audio content and a new audience for that content.
Looking forward, it's not hard to imagine a similar scenario with video content. Anyone with a computer and a digital video camera can produce their own content, and the Internet is a perfect distribution system for those digital bits. Video syndication poses some additional challenges, but Yahoo! has already started building the tools necessary for video syndication.
6.6.1. Introducing Media RSS
Yahoo! wanted something more flexible for publishers of audio and video than a single "attachment" for items in their RSS feed. And they wanted publishers to be able to describe those media files in a structured way. Unfortunately, the enclosure capabilities of RSS don't quite fit the bill. While you can definitely include a video file as an enclosure, you can't include multiple files or describe the files in a structured way.
One of the strengths of the RSS syndication format is the fact that anyone can extend the format with modules. And Yahoo! has taken the enclosure features of RSS a step further with its Media RSS module.

You can read the specification for Media RSS at or read through the frequently asked questions at

Beyond giving publishers a bit more control, this more fine-grained approach to describing media within RSS helps Yahoo! discover video to index for Yahoo! Video Search [Hack #11]. Because many audio and video publishers include their media files in special player pop-up windows, finding and indexing the video is not as simple as finding and indexing web pages. Yahoo! is encouraging people who provide audio and video to use Media RSS as a way to tell Yahoo! what to include in their video search engine.
Here's a look at some of the ways Media RSS expands the enclosure capabilities of RSS:

Multiple files
The <media:group> tag allows for multiple media files within a single <item>. This way, a single news story that contains several video clips could include each of the clips within a single RSS item.

The <media:content> tag includes nine attributes that describe the video file, including url, type, bitrate, duration, height, and width.

Publishers who want to supply a thumbnail for a video file can use the <media:thumbnail> tag and include a thumbnail url, height, and width.

The <media:credit> tag can be used to indicate who put together the content. A role attribute indicates a title, and the tag itself holds someone's name.

The <media:text> tag could be used to include lyrics, a transcript, or some related text. The type attribute specifies whether the text is plain or HTML.

Publishers who want to control the way a video or audio clip is played can provide a URL to a web-based player with the <media:player> tag.

Each media file included in a Media RSS file can be categorized with the <media:category> tag, giving more information about the content of the file.
To use the extended capabilities of the Media RSS Module, you simply need to declare the Media RSS namespace in the opening RSS tag, like this:
<rss version="2.0" xmlns:media="">

This declaration gives computers parsing the file some indication of how the file should be used, and it gives curious people viewing the file a way to look up the precise way the <media:> tags should be used, so they can understand what they're looking at.
6.6.2. Automating Media RSS
Most RSS feeds today are generated with content management software. After you write a news story or weblog post, you don't even have to think about the RSS that describes it. The RSS is generated automatically for you. As Media RSS evolves, it will likely be generated by software as well, and this hack illustrates how a simple script can generate Media RSS for you.
Imagine you have a directory full of video on your server. The video might be linked from various web pages on your site, but you'd like to be sure that all of your video files are indexed by Yahoo! Video so they'll appear in Yahoo! Search results. This script solves the problem by creating a Media RSS file based on a directory full of media files that's suitable for submitting to Yahoo!.
6.6.3. The Code
This code is an ASP file written with VBScript that can be used on Windows servers. Save the following code to a file called mRSS.asp and be sure to alter the three values at the top to match your setup:
' mRSS.asp
' Finds video files in a directory and generates a Media RSS file
' describing those video files.
' Change these values to fit your setup.
' BASE_URL is the publicly available address for the directory
' MEDIA_ADULT indicates whether or not the files are for adults only
' MEDIA_EXTS is a list of recognized media extensions that you want
' to include in the Media RSS file
Const BASE_URL = "http://insert/path/to/videos/"
Const MEDIA_ADULT = "false"
Const MEDIA_EXTS = "avi,mov,mp3,mpg,mpeg,wmv"

' Set content type for the page
Response.ContentType = "text/xml"

%><?xml version="1.0"?>
<rss version="2.0" xmlns:media="">
<title>My Site Videos</title>
<description>Various videos I've produced</description>
' Start the FileSystem Object
Set fs = Server.CreateObject("Scripting.FileSystemObject")

' Find the current directory
thisPath = Request.ServerVariables("path_info")
lastS = InStrRev(thisPath,"/")
thisPath = Mid(thisPath,1,lastS)
thisFullPath = Server.MapPath(thisPath)

' Load the current directory
Set fsFolder = fs.GetFolder(thisFullPath)
Set fsFiles = fsFolder.Files

' Loop through each file in the directory and
' check the extension. If it's a recognized
' type, build the RSS item
For Each Item in fsFiles
strName = Item.Name

intDot = InStrRev(strName,".") + 1
strShortName = Left(strName,intDot - 2)
strExtension = LCase(Mid(strName,intDot,Len(strName)))
If InStr(MEDIA_EXTS,strExtension) Then
strSize = Item.Size
dtmDate = Item.DateCreated
dtmMod = Item.DateLastModified
strType = Item.Type
response.write "<item>" & Chr(13)
response.write " <title>" & strShortName & "</title>" & Chr(13)
response.write " <link>" & BASE_URL & strName & "</link>" &

response.write " <media:content url=""" & BASE_URL & strName

& """"
response.write " fileSize=""" & strSize & """"
response.write " type=""" & getType(strExtension) & """ />"

& Chr(13)
response.write " <media:adult>" & MEDIA_ADULT & "</media:

response.write Chr(13) & "</item>" & Chr(13)
End If

' Clean up the objects
Set fsFiles = Nothing
Set fsFolder = Nothing
Set fs = Nothing
' This function translates a file extension
' into its content type
Function getType(ext)
Select Case ext
Case "avi"
getType = "video/avi"
Case "mov"
getType = "video/quicktime"
Case "mp3"
getType = "audio/mpeg"
Case "mpeg","mpg"
getType = "video/mpeg"
Case "wmv"
getType = "video/x-ms-wmv"
End Select
End Function

This code loops through the files in a directory and checks the file extension against the list of extensions set as MEDIA_EXTS. If the extension is one of the set types, the script creates an RSS item using the filename as the <title>, and the value set in BASE_URL plus the filename as the <link>.
The script then adds a minimal <media:content> tag to describe the file and the <media:adult> tag to indicate whether the file has adult content. This value is hardcoded into the script, so you'll need to keep your adult files separate from your kid-friendly files. You can change how the script treats the file by setting the MEDIA_ADULT variable to true or false at the top of the script.
6.6.4. Running the Hack
To run the code, place mRSS.asp in a directory that is available on the Web and contains media files, and bring its URL up in a browser. For example:

You should see an RSS feed with a list of all the media files in the directory. Each <item> in the feed will correspond to a file and should look something like this:
<media:content url=""

This simple feed doesn't take advantage of all the features of Media RSS, but it's enough to build a feed suitable for submitting to Yahoo! Video.

You can validate any RSS feedincluding Media RSSwith the Feed Validator ( Simply plug in your RSS feed URL into the form, and the validator will fetch the feed and point out any problems.

6.6.5. Submitting Video to Yahoo!
Once you have an RSS feed filled with pointers to rich media, you can submit the feed to Yahoo! to be sure your video is available to Yahoo! searchers. Browse to and add your RSS feed URL to the form. You can also include your email address, web site URL, and company name, but these are optional. Once Yahoo! has your Media RSS URL in its database, a Yahoo! crawler will begin visiting your feed and indexing your video.
If you put time and energy into publishing independent content, describing it with Media RSS can help you reach a wider audience by making the content available through Yahoo! Video Search.
Copy + Paste.
No quote tags.
No credit.

If you think I'm wrong in anyway, please inform me.

Related topics
add some media code in the forum
No Media Player Windows
Windows Vista Official Thread
What do you think about Russia?
Media's forum
Survey: Which type of advertisements are you interested in?
Flash not working on Firefox
Horde of Nightmares : Gaming Syndicate
Some Tools
Macbellads Network CPC,CPA,CPM, TEXT, BANNER, Media Exchange
Solved: Need convert php-template to css-html static
news: Super rich see federal taxes drop dramatically
Tea Party = Occupy??
Love small games?
This topic is locked: you cannot edit posts or make replies.    Frihost Forum Index -> Scripting -> Php and MySQL

© 2005-2011 Frihost, forums powered by phpBB.