Navigator:mediaDevices 属性

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.

* Some parts of this feature may have varying levels of support.

安全上下文: 此项功能仅在一些支持的浏览器安全上下文(HTTPS)中可用。

Navigator.mediaDevices 只读属性返回一个 MediaDevices 对象,该对象可提供对相机和麦克风等媒体输入设备以及屏幕共享的连接访问。

语法

js
navigator.mediaDevices

返回值

MediaDevices 单例对象。通常,你只需直接使用此对象的成员,例如调用 navigator.mediaDevices.getUserMedia()

规范

Specification
Media Capture and Streams
# mediadevices

浏览器兼容性

Report problems with this compatibility data on GitHub
desktopmobileserver
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Deno
Node.js
mediaDevices
Secure context required

Legend

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

Full support
Full support
No support
No support

参见