--- title: MediaStream.id slug: Web/API/MediaStream/id translation_of: Web/API/MediaStream/id ---
{{APIRef("WebRTC")}}
MediaStream.id
只读属性,一个包含36个字符的 {{domxref("DOMString")}} ,用来作为这个对象的唯一标识符 (GUID) 。
var id = mediaStream.id;
var p = navigator.mediaDevices.getUserMedia({ audio: true, video: true });
p.then(function(stream) {
console.log(stream.id);
};)
Specification | Status | Comment |
---|---|---|
{{SpecName('Media Capture', '#widl-MediaStream-id', 'MediaStream.id')}} | {{Spec2('Media Capture')}} | Initial definition. |
{{ CompatibilityTable() }}
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Basic support | {{ CompatUnknown() }} | {{CompatVersionUnknown}} | {{ CompatGeckoDesktop(41) }} | {{ CompatUnknown() }} | {{ CompatUnknown() }} | {{ CompatUnknown() }} |
Feature | Android | Edge | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | {{ CompatUnknown() }} | {{CompatVersionUnknown}} | {{ CompatGeckoMobile(41) }} | {{ CompatUnknown() }} | {{ CompatUnknown() }} | {{ CompatUnknown() }} |