MediaStream.id

Baseline Widely available

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

MediaStream.id 只读属性,一个包含 36 个字符的 DOMString ,用来作为这个对象的唯一标识符 (GUID) 。

语法

js
var id = mediaStream.id;

示例

js
var p = navigator.mediaDevices.getUserMedia({ audio: true, video: true });

p.then(function(stream) {
   console.log(stream.id);
};)

规范

Specification
Media Capture and Streams
# dom-mediastream-id

浏览器兼容性

BCD tables only load in the browser

相关链接