MediaTrackSupportedConstraints: groupId 屬性
MediaTrackSupportedConstraints 字典的 groupId 屬性是一個只讀的布林值。當且僅當 使用者代理 支援 groupId 約束時,由 MediaDevices.getSupportedConstraints() 返回的物件中才會包含此屬性(並將其設定為 true)。如果該約束不受支援,則它不會包含在列表中,因此此值永遠不會是 false。
您可以透過呼叫 navigator.mediaDevices.getSupportedConstraints() 來訪問支援的約束字典。
值
如果使用者代理支援 groupId 約束,則此屬性將存在於字典中(並且其值始終為 true)。如果屬性不存在,則表示該屬性已從支援的約束字典中移除,如果您嘗試檢視其值,將得到 undefined。
示例
js
const result = document.getElementById("result");
const supported = navigator.mediaDevices.getSupportedConstraints().groupId;
result.textContent = supported ? "Supported!" : "Not supported!";
結果
規範
| 規範 |
|---|
| 媒體捕獲和流 # dom-mediatrackconstraintset-groupid |
瀏覽器相容性
載入中…