The Shellware Media Vault is built upon Microsoft Media Services. There is no database backend and all metadata is derived from a memory mapped XML structure built directly from the server's NTFS filesystem.
The vault is organized by Artist, as is reflected in the filesystem. Each Artist has its own Publishing Point and a default "AllMedia" point exists mapped to the root WMA folder.
The Artist Publishing Points are simple Directory based points with wildcards enabled. Repeat and Shuffle are disabled for each.
Artist, Album, Track, Year of Release, and Genre are extracted from the actual WMAs using the Media Services 9 ActiveX/COM support library. The attribute extraction process only occurs when a reload event is issued for the Media Vault XML cache.
The Media Vault XML Table Cache (exposed as a .NET 2.0 XMLDataSource) is built and persisted in memory as illustrated:
The Media Vault webpage is actually an ATLAS.NET ajax implementation of the Microsoft GridView bound to the Media Vault XML table cache XMLDataSource. The stream URLs are constructed based on the contents of the mms* nodes and are categorized by Artist (mmsAuthor), Album (mmsAlbum), and Track (mmsTitle).
The end result is a nicely packaged gridview with all the necessary anchors built without any actual code behind it.
MMS also provides for Dynamic Playlists. Dynamic Playlists rely on an HTTP resource to provide a smil compliant track list. Configuring a Dynamic Playlist based Publishing Point is a very simple process.
By using the httpd:// URI prefix MMS will use an embedded HTTP plugin to connect to the resource. The smil provider can exist on a local or remote host. The only requirement is that it be exposed through an HTTP server. Besides the base URL, MMS also supports a number of special environment type variables that can be added to the URL based on the client connecting to the Publishing Point. HTTP header information such as AUTH_USER, REMOTE_ADDR, or even the entire QueryString contained in the client's mms:// URI can be forwarded the the Dynamic Playlist provider.
One of the first things I realized when I set out to implement Dynamic Playlists was that I would need an easy and efficient way to maintain identity of it. .NET solves this with System.Guid.NewGuid(). I also chose to again rely on Shared Memory (Server Side Application Context) to persist the playlist content and devised a simple object model to represent it.
Now that I had a way to represent my Playlists in true OO fashion, I needed to develop a way to populate, save, collect, and ultimately, compile them into smil documents for streaming. I will forego the details of the new ASP.NET 2.0 TreeView (which is a fine example of an asp.net component), and instead focus on the assembly of the Media Vault catalog which it uses as a datasource of sorts.
Using many of the same functions I built for populating the Media Vault cache (documented above) I create a DTD bound XML document organized by Artist, Album, and Track. A GUID is generated for each track and is one of the attributes bound to the TreeView. After a Playlist's tracks are selected, the Playlist Wizard uses those GUIDs to identify which tracks were selected when populating the Playlist object model that gets stored within the IIS Application Context using a guid of its own.
I came up with a novel approach to saving the Playlist within the Application Context. I chose to localize this activity within the Playlist class itself. I accomplished this by creating an overloaded constructor that takes the Application context as it's sole argument. The context then gets stored to a Private attribute that gets called upon within the SavePlaylist() and DeletePlaylist() methods, as illustrated below:
At this point I need a way to pass the guid generated for the Playlist to my Dynamic Content Provider aspx page. If you recall earlier, I setup my DynamicContent Publishing point using the MMS HTTP Plugin and appended the environment like %QueryString% variable to the URI. I facilitate passing it in via my mms:// reference, either embedded in an HTML anchor tag, or set as an embedded Media Player's URL property. You can see an example of this from the Main Media Vault web page's Active Playlists section:
An example of the resulting smil compliant document served by DynamicContent.aspx is shown below:
This is a very high-level overview of how I was able to bring it all together. If you'd like more information about this implementation, or access to the source code I wrote to support it, feel free to contact me via the Shellware Feedback form.
Last Updated: August 18, 2006