Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
rtc-detect 用来检测当前环境对 TRTC SDK 的支持度。
npm install rtc-detect
import RTCDetect from 'rtc-detect';
// 初始化监测模块
const detect = new RTCDetect();
// 获得当前环境监测结果
const result = await detect.getReportAsync();
console.log('result is: ' + result);
判断当前环境是否支持 TRTC。
const detect = new RTCDetect();
const data = await detect.isTRTCSupported();
if (data.result) {
console.log('current browser supports TRTC.')
} else {
console.log(`current browser does not support TRTC, reason: ${data.reason}.`)
}
获取当前系统环境参数。
Item | Type | Description |
---|---|---|
UA | string | 浏览器的 ua |
OS | string | 当前设备的系统型号 |
browser | object | 当前浏览器信息{ name, version } |
displayResolution | object | 当前分辨率 { width, height } |
getHardwareConcurrency | number | 当前设备 CPU 核心数 |
const detect = new RTCDetect();
const result = detect.getSystem();
获取当前环境 API 支持度。
Item | Type | Description |
---|---|---|
isUserMediaSupported | boolean | 是否支持获取用户媒体数据流 |
isWebRTCSupported | boolean | 是否支持 WebRTC |
isWebSocketSupported | boolean | 是否支持 WebSocket |
isWebAudioSupported | boolean | 是否支持 WebAudio |
isScreenCaptureAPISupported | boolean | 是否支持获取屏幕的流 |
isCanvasCapturingSupported | boolean | 是否支持从 canvas 获取数据流 |
isVideoCapturingSupported | boolean | 是否支持从 video 获取数据流 |
isRTPSenderReplaceTracksSupported | boolean | 是否支持替换 track 时不和 peerConnection 重新协商 |
isApplyConstraintsSupported | boolean | 是否支持变更摄像头的分辨率不通过重新调用 getUserMedia |
const detect = new RTCDetect();
const result = detect.getAPISupported();
获取当前环境可用的设备。
Item | Type | Description |
---|---|---|
hasWebCamPermissions | boolean | 是否支持获取用户摄像头数据 |
hasMicrophonePermission | boolean | 是否支持获取用户麦克风数据 |
cameras | array | 用户的摄像头设备列表,包含支持视频流的最大宽高和帧率 |
microphones | array | 用户的麦克风设备列表 |
speakers | array | 用户的扬声器设备列表 |
const detect = new RTCDetect();
const result = await detect.getDevicesAsync();
获取当前环境参数对编码的支持度。
Item | Type | Description |
---|---|---|
isH264EncodeSupported | boolean | 是否支持 h264 上行 |
isH264DecodeSupported | boolean | 是否支持 h264 下行 |
isVp8EncodeSupported | boolean | 是否支持 vp8 上行 |
isVp8DecodeSupported | boolean | 是否支持 vp8 下行 |
const detect = new RTCDetect();
const result = await detect.getCodecAsync();
获取当前环境监测报告。
Item | Type | Description |
---|---|---|
system | object | 和 getSystem() 的返回值一致 |
APISupported | object | 和 getAPISupported() 的返回值一致 |
codecsSupported | object | 和 getCodecAsync() 的返回值一致 |
devices | object | 和 getDevicesAsync() 的返回值一致 |
const detect = new RTCDetect();
const result = await detect.getReportAsync();
检测 Chrome 浏览器是否开启硬件加速。
注意:该接口的实现依赖于 WebRTC 原生接口,建议在 isTRTCSupported 检测支持后,再调用该接口进行检测。检测最长耗时 30s。经实测:
const detect = new RTCDetect();
const data = await detect.isTRTCSupported();
if (data.result) {
const result = await detect.isHardWareAccelerationEnabled();
console.log(`is hardware acceleration enabled: ${result}`);
} else {
console.log(`current browser does not support TRTC, reason: ${data.reason}.`)
}
FAQs
rtc-detect
The npm package rtc-detect receives a total of 260 weekly downloads. As such, rtc-detect popularity was classified as not popular.
We found that rtc-detect demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers 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
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.