RTCIceCandidate:sdpMLineIndex 属性

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since January 2020.

RTCIceCandidate 接口的 sdpMLineIndex 只读属性是一个用于描述与候选者相关联的媒体的从零开始的媒体行(m-line)索引。

可以通过在传递给 RTCIceCandidate() 构造函数的 candidateInfo 选项对象中指定 sdpMLineIndex 属性的值来配置此属性。如果你使用媒体行(m-line)字符串而不是选项对象调用构造函数,则 sdpMLineIndex 的值将从指定的候选者媒体行字符串中提取。

包含指向提供媒体描述的媒体行集合的从零开始的索引,表明哪个媒体源与候选者相关联;如果没有这样的关联,则为 null

备注: 使用 addIceCandidate() 添加一个 sdpMidsdpMLineIndex 都为 null 的候选者时,将抛出 TypeError 异常。

规范

Specification
WebRTC: Real-Time Communication in Browsers
# dom-rtcicecandidate-sdpmlineindex

浏览器兼容性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
sdpMLineIndex

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
See implementation notes.