Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
js-media-devices
Advanced tools
Manage Media Devices use javascript.
The MediaDevices interface provides access to connected media input devices like cameras and microphones.
npm i js-media-devices
检查浏览器是否支持 MediaDevices
Return type
是或否
boolean
获取音频设备列表(输入+输出)
Return type
音频设备信息列表
Promise<MediaDeviceInfo[]>
根据设备 ID 获取对应的音频输出流
Parameters
deviceId
(string
) – 设备 IDReturn type
音频流
Promise<MediaStream>
获取音频输出设备列表
Return type
音频设备信息列表
Promise<MediaDeviceInfo[]>
授权并获取设备列表(所有)
Return type
媒体设备信息列表
Promise<MediaDeviceInfo[]>
获取音频输入设备列表
Return type
音频设备信息列表
Promise<MediaDeviceInfo[]>
只授权音频设备并获取音频设备列表
Return type
音频设备信息列表
Promise<MediaDeviceInfo[]>
只授权视频并获取视频设备列表
Return type
视频设备信息列表
Promise<MediaDeviceInfo[]>
根据视频输入设备 ID 和音频输入设备 ID 获取相应媒体流
Parameters
videoDeviceId
(string
) – 视频输入设备 IDaudioDeviceId
(string
) – 音频输入设备 IDReturn type
媒体流
Promise<MediaStream>
获取视频输入设备列表
Return type
视频设备信息列表
Promise<MediaDeviceInfo[]>
根据设备 ID 获取对应的视频输出流
Parameters
deviceId
(string
) – 设备 IDoptions
(any
) – Optional. 选项 { minWidth, minHeight, width, height }Return type
视频流
Promise<MediaStream>
根据音频输出设备 ID 设置当前音频输出设备
Parameters
element
(HTMLAudioElement
) – HTMLAudioElementdeviceId
(string
) – 音频输出设备 IDReturn type
提示信息
Promise<string>
停止视频流/音频流
Parameters
stream
(MediaStream
) – 视频流或音频流Return type
void
import JsMediaDevices from "js-media-devices";
const device = new JsMediaDevices()(async () => {
await device.getDeviceList(); // find out: src/index.js
await device.setOutAudioDevices(element, deviceId);
})();
yarn global add uglify-js
FAQs
JavaScript MediaDevices Manage Api. Video, Audio Device Manage.
The npm package js-media-devices receives a total of 7 weekly downloads. As such, js-media-devices popularity was classified as not popular.
We found that js-media-devices demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.