Media.isReadOnlyItem 方法
isReadOnlyItem 方法返回一个值,该值指示是否可以编辑媒体项的指定属性。
语法
bRetVal = Media.isReadOnlyItem(
attribute
)
参数
-
属性 [in]
-
指示要测试的属性的名称的字符串。 有关Windows 媒体播放器支持的属性的信息,请参阅Windows 媒体播放器属性参考。
返回值
此方法返回 布尔值。
备注
如果属性是只读的,则不能使用 setItemInfo 方法设置它。 请注意,当与不同版本的Windows 媒体播放器一起使用时,此方法可能会返回特定属性的不同值。
若要使用此方法,需要读取对库的访问权限。 有关详细信息,请参阅 库访问。
Windows 媒体播放器 10 移动版:此属性始终返回 true。
示例
以下JScript示例使用媒体。isReadOnlyItem,用于填充名为 rwText 的 HTML TEXTAREA 元素,其中包含有关当前媒体项的信息。 代码输出当前媒体项的每个属性,以及指示该属性是只读还是读/写的文本。 已创建 ID 为“Player”的 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";
}
要求
要求 | 值 |
---|---|
版本 |
Windows 媒体播放器版本 7.0 或更高版本。 |
DLL |
|