MediaStream: thuộc tính 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.

Thuộc tính chỉ đọc id của giao diện MediaStream là một chuỗi chứa 36 ký tự biểu thị một định danh duy nhất (GUID) cho đối tượng.

Giá trị

Một chuỗi.

Ví dụ

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

promise.then((stream) => {
  console.log(stream.id);
});

Thông số kỹ thuật

Specification
Media Capture and Streams
# dom-mediastream-id

Tương thích trình duyệt

Xem thêm

  • MediaStream, giao diện mà thuộc tính này thuộc về.