Share via


IWMSActiveMedia::GetProperty

banner art

Previous Next

IWMSActiveMedia::GetProperty

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

Syntax

  HRESULT GetProperty(
  BSTR  bstrProperty,
  BSTR  bstrLanguage,
  BSTR*  pProperty
);

Parameters

bstrProperty

[in] BSTR 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.

bstrLanguage

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

pProperty

[out] Pointer to a BSTR that contains the value associated with the property.

Return Values

If the method succeeds, it returns S_OK. If it fails, it returns an HRESULT error code.

Return code Number Description
DISP_E_BADINDEX 0x8002000B strProperty does not exist.
E_OUTOFMEMORY 0x8007000E There is insufficient memory to complete the function.
E_POINTER 0x80004003 pProperty is a NULL pointer argument.
NS_E_UNSUPPORTED_LANGUAGE 0xC00D145CL strLanguage is an invalid language tag or no that context description exists for the language specified.

Example Code

#include <windows.h>
#include <atlbase.h>    // Includes CComVariant.
#include "wmsserver.h"

// Declare variables and interfaces.
HRESULT             hr;
IWMSServer          *pServer;
IWMSPlayers         *pPlayers;
IWMSPlayer          *pPlayer;
IWMSPlaylist        *pPlaylist;
IWMSActiveMedia     *pActiveMedia;

CComVariant         varIndex;
long                lCount;

// Initialize the COM library and retrieve a pointer
// to the IWMSServer interface.
hr = CoInitialize(NULL);
hr = CoCreateInstance(CLSID_WMSServer,
                      NULL,
                      CLSCTX_ALL,
                      IID_IWMSServer,
                      (void **)&pServer);
if (FAILED(hr)) goto EXIT;

// Retrieve a pointer to the IWMSPlayers interface
// and retrieve the number of connected players.
hr = pServer->get_Players(&pPlayers);
if (FAILED(hr)) goto EXIT;
hr = pPlayers->get_Count(&lCount);
if (FAILED(hr)) goto EXIT;

// If players are connected, retrieve a pointer to
// an IWMSPlayer interface containing the first player.
if (lCount > 0)
{
    varIndex = 0;
    hr = pPlayers->get_Item(varIndex, &pPlayer);
    if (FAILED(hr)) goto EXIT;
}

// Retrieve the playlist 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.
hr = pPlayer->get_RequestedPlaylist(&pPlaylist);
if (FAILED(hr)) goto EXIT;
if (pPlaylist != NULL)
{
    // Retrieve a pointer to the IWMSActiveMedia interface.
    hr = pPlaylist->get_CurrentMediaInformation(&pActiveMedia);
    if (FAILED(hr)) goto EXIT;

    // Retrieve a name-value pair from the active media element.
    CComBSTR bstrTitle("title");
    CComBSTR bstrLangID("");
    CComBSTR bstrTitleText;
    pActiveMedia->GetProperty(bstrTitle, bstrLangID, &bstrTitleText);
}

EXIT:
    // TODO: Release temporary COM objects and uninitialize COM.

Requirements

Header: wmsserver.h.

Library: WMSServerTypeLib.dll.

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

See Also

Previous Next