Media.isReadOnlyItem 方法
[與此頁面相關聯的功能Windows 媒體播放機 SDK是舊版功能。 它已被 MediaPlayer 取代。 MediaPlayer已針對Windows 10和Windows 11進行優化。 Microsoft 強烈建議新程式碼盡可能使用MediaPlayer,而不是Windows 媒體播放機 SDK。 Microsoft 建議盡可能重寫使用舊版 API 的現有程式碼,以使用新的 API。]
isReadOnlyItem方法會傳回值,指出是否可以編輯媒體專案的指定屬性。
語法
bRetVal = Media.isReadOnlyItem(
attribute
)
參數
-
屬性 [in]
-
字串 ,表示要測試的屬性名稱。 如需Windows 媒體播放機所支援屬性的相關資訊,請參閱Windows 媒體播放機屬性參考。
傳回值
這個方法會傳回 Boolean。
備註
如果屬性是唯讀的,則無法使用 setItemInfo 方法加以設定。 請注意,當搭配不同版本的 Windows 媒體播放機 使用時,這個方法可能會傳回特定屬性的不同值。
若要使用此方法,需要程式庫的讀取權限。 如需詳細資訊,請參閱 程式庫存取。
Windows 媒體播放機 10 行動裝置版:此屬性一律會傳回 true。
範例
下列 JScript 範例使用 Media。isReadOnlyItem 以填入名為 rwText 的 HTML TEXTAREA 元素,其中包含目前媒體專案的相關資訊。 程式碼會輸出目前媒體專案的每個屬性,以及指出屬性是唯讀還是可讀寫的文字。 Player物件是以 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";
}
規格需求
需求 | 值 |
---|---|
版本 |
Windows 媒體播放機 7.0 版或更新版本。 |
DLL |
|
另請參閱
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應