Media.isReadOnlyItem method

[The feature associated with this page, Windows Media Player SDK, is a legacy feature. It has been superseded by MediaPlayer. MediaPlayer has been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer instead of Windows Media Player SDK, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

The isReadOnlyItem method returns a value indicating whether the specified attribute of the media item can be edited.

Syntax

bRetVal = Media.isReadOnlyItem(
  attribute
)

Parameters

attribute [in]

String indicating the name of the attribute to test. For information about the attributes supported by Windows Media Player, see the Windows Media Player Attribute Reference..

Return value

This method returns a Boolean.

Remarks

If an attribute is read-only, then it cannot be set with the setItemInfo method. Note that this method may return different values for a particular attribute when used with different versions of Windows Media Player.

To use this method, read access to the library is required. For more information, see Library Access.

Windows Media Player 10 Mobile: This property always returns true.

Examples

The following JScript example uses Media.isReadOnlyItem to fill an HTML TEXTAREA element named rwText with information about the current media item. The code outputs each attribute of the current media item, along with text indicating whether the attribute is read-only or read/write. The Player object was created with ID = "Player".

// Store the current media item object.
var cm = Player.currentMedia;

// Create a variable to hold each attribute name.
var atName;

// Loop through the attribute list.
for(var i = 0; i < cm.attributeCount; i++){

   // Get the attribute name.
   atName = cm.getAttributeName(i);

   // Test whether the attribute is read-only.
   var test = ((cm.isReadOnlyItem(atName))?"Read-Only":"Read/Write");

// Print the attribute information to the text area.
   rwText.value += atName + " is " + test;
   rwText.value += "\n";
}

Requirements

Requirement Value
Version
Windows Media Player version 7.0 or later.
DLL
Wmp.dll

See also

Media Object

Media.setItemInfo

Settings.mediaAccessRights

Settings.requestMediaAccessRights