Share via


IWMSActiveMedia.GetProperty (C#)

banner art

Previous Next

IWMSActiveMedia.GetProperty (C#)

The GetProperty method retrieves a specific property from the active media element.

Syntax

  string = IWMSActiveMedia.GetProperty(
  string  strProperty,
  string  strLanguage 
);

Parameters

strProperty

[in] string containing the name of the property to retrieve. The properties are stored in a content description context. This parameter can be one of the following values, or a custom value that is defined in the clientData playlist element.

Value Description
title Retrieves the content title from the content file header, if available, or from the value specified by the title attribute in the clientData element of a playlist. The value specified in the clientData element, if present, overrides the header value.
album Retrieves the album name from the content file header, if available, or from the value specified by the value attribute in the clientData element of a playlist. The value specified in the clientData element, if present, overrides the header value.
artist Retrieves the artist name from the content file header, if available, or from the value specified by the artist attribute in the clientData element of a playlist. The value specified in the clientData element, if present, overrides the header value.
author Retrieves the author of the playlist or media file from the content file header, if available, or from the value specified by the author attribute in the clientData element of a playlist. The value specified in the clientData element, if present, overrides the header value.
bannerAbstract Retrieves the text to be displayed as a ToolTip for the Windows Media Player banner graphic identified by the bannerURL property. The text is retrieved from the content file header or from the bannerAbstract attribute of the clientData playlist element. The value specified in the clientData element, if present, overrides the header value.
bannerInfoURL Retrieves the URL of the Web page that a user can access by clicking the Windows Media Player banner graphic identified by the bannerURL property. The URL can be retrieved from the content file header or from the bannerInfoURL attribute of the clientData playlist element. The value specified in the clientData element, if present, overrides the header value.
bannerURL Retrieves the URL of a graphics file that is displayed in Windows Media Player. The URL is retrieved from the content file header or from the bannerURL attribute of the clientData playlist element. The value specified in the clientData element, if present, overrides the header value.
copyright Retrieves copyright information from the content file header, if available, or from the value specified by the copyright attribute in the clientData element of a playlist. The value specified in the clientData element, if present, overrides the header value.
genre Retrieves category information from the content file header, if available, or from the value specified by the genre attribute in the clientData element of a playlist. The value specified in the clientData element, if present, overrides the header value.
logURL Retrieves an URL that can be used to post logging statistics to a server. The URL is retrieved from the content file header or from the logURL attribute of the clientData playlist element. The value specified in the clientData element, if present, overrides the header value.
WMS_CONTENT_DESCRIPTION_DESCRIPTION Retrieves the content description from the content file header, if available.
WMS_CONTENT_DESCRIPTION_PLAYLIST_ENTRY_URL Retrieves the path to a content file. This is equivalent to the src attribute that can be specified in a playlist file.
WMS_CONTENT_DESCRIPTION_RATING Retrieves rating information from the file header, if available.
WMS_CONTENT_DESCRIPTION_ROLE Retrieves the role of a media element in a playlist. This value is specified by the role attribute.

strLanguage

[in] string containing the national language for the property. This must conform to RFC-1766.

Return Values

This method returns a string that contains the value associated with the property.

If this method fails, it throws an exception.

Number Description
0x8002000B strProperty does not exist.
0x8007000E There is insufficient memory to complete the function.
0xC00D145CL strLanguage is an invalid language tag or that no context description exists for the language specified.

Example Code

using Microsoft.WindowsMediaServices.Interop;
using System.Runtime.InteropServices;

// Declare variables.
WMSServer         Server;
IWMSActiveMedia   ActiveMedia;
IWMSPlayers       Players;
IWMSPlayer        Player;
IWMSPlaylist      Playlist;

string            strProperty;

try {
    // Create a new WMSServer object.
    Server = new WMSServerClass();

    // Retrieve an IWMSPlayers object.
    Players = Server.Players;

    // If players are connected, retrieve first IWMSPlayer object
    // in the IWMSPlayers collection.
    if (Server.Players.Count > 0)
    {
        Player = Server.Players[0];

        // Retrieve the IWMSPlaylist object for the player.
        // NOTE: A valid playlist file is not always returned.
        // This may be the case, for example, if the user requested
        // a specific content file or if a broadcast publishing point 
        // is being used.
        Playlist = Player.RequestedPlaylist;

        if (Playlist != null)
        {
            // Retrieve the IWMSActiveMedia object.
            ActiveMedia = Playlist.CurrentMediaInformation;

            // Retrieve a name-value pair from the active media element.
            // NOTE: This is a generic name-value pair. Name-value pairs
            // are user-defined.
            string strTitle;
            strTitle = "title";
            string strLangID;
            strLangID = "";
            strProperty = ActiveMedia.GetProperty(strTitle, strLangID);
        }
    }
}
catch (COMException comExc) {
    // TODO: Handle COM exceptions.
}
catch (Exception e) {
    // TODO: Handle exceptions.
}

Requirements

Reference: Add a reference to Microsoft.WindowsMediaServices.

Namespace: Microsoft.WindowsMediaServices.Interop.

Assembly: Microsoft.WindowsMediaServices.dll.

Library: WMSServerTypeLib.dll.

Platform: Windows Server 2003 family, Windows Server 2008 family.

See Also

Previous Next