
Security News
rv Is a New Rust-Powered Ruby Version Manager Inspired by Python's uv
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
rtc-detect
Advanced tools
rtc-detect is used to detect whether the current environment is working smoothly in WebRTC application built by TRTC SDK.
English | 简体中文
rtc-detect is used to detect whether the current environment is working smoothly in WebRTC application built by TRTC SDK.
npm install rtc-detect
import RTCDetect from 'rtc-detect';
// init
const detect = new RTCDetect();
// get detect result
const result = await detect.getReportAsync();
console.log('result is: ' + result);
This API is used to check whether the current environment supports 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}.`)
}
This API is used to get the current system environment parameters.
Item | Type | Description |
---|---|---|
UA | string | user agent |
OS | string | system |
browser | object | browser infomation: { name, version } |
displayResolution | object | resulution: { width, height } |
getHardwareConcurrency | number | current device CPU core count |
GPU | string | GPU info |
const detect = new RTCDetect();
const result = detect.getSystem();
This API is used to get the API support of the current environment.
Item | Type | Description |
---|---|---|
isUserMediaSupported | boolean | whether to support getting user media from media device |
isWebRTCSupported | boolean | whether to support WebRTC |
isWebSocketSupported | boolean | whether to support WebSocket |
isWebAudioSupported | boolean | whether to support WebAudio |
isScreenCaptureAPISupported | boolean | whether to support getting media steam from screen |
isCanvasCapturingSupported | boolean | whether to support getting media stream from canvas element |
isVideoCapturingSupported | boolean | whether to support getting media stream from video element |
isRTPSenderReplaceTracksSupported | boolean | whether to support not renegotiating with peerConnection when replacing track |
isApplyConstraintsSupported | boolean | whether to support changing the resolution of the camera without re-calling getUserMedia |
const detect = new RTCDetect();
const result = detect.getAPISupported();
This API is used to get the available devices in the current environment.
Item | Type | Description |
---|---|---|
hasWebCamPermissions | boolean | Whether the user camera data can be obtained |
hasMicrophonePermission | boolean | Whether the user mic data can be obtained |
cameras | array | A list of the user's camera devices, including information on the resolution of supported video streams, maximum aspect and maximum frame rate (maximum frame rate is not supported by some browsers) |
microphones | array | A list of user mics |
speakers | array | A list of user speakers |
CameraItem
Item | Type | Description |
---|---|---|
deviceId | string | Device ID, which is usually unique and can be used to capture identifying devices |
groupId | string | Group identifier, two devices have the same group identifier if they belong to the same physical device |
kind | string | Camera device type: 'videoinput' |
label | string | Label describing this device |
resolution | object | Information about the camera's supported resolutions, maximum width and height, and maximum frame rate, eg: {maxWidth: 1280, maxHeight: 720, maxFrameRate: 30} |
DeviceItem
Item | Type | Description |
---|---|---|
deviceId | string | Device ID, which is usually unique and can be used to capture identifying devices |
groupId | string | Group identifier, two devices have the same group identifier if they belong to the same physical device |
kind | string | Physical device type, eg: 'audioinput', 'audiooutput' |
label | string | Label describing this device |
const detect = new RTCDetect();
const result = await detect.getDevicesAsync();
This API is used to get the codec support of the current environment.
Item | Type | Description |
---|---|---|
isH264EncodeSupported | boolean | whether to support h264 uplink |
isH264DecodeSupported | boolean | whether to support h264 downlink |
isVp8EncodeSupported | boolean | whether to support vp8 uplink |
isVp8DecodeSupported | boolean | whether to support vp8 downlink |
isVp9EncodeSupported | boolean | whether to support vp9 uplink |
isVp9DecodeSupported | boolean | whether to support vp9 downlink |
isH265EncodeSupported | boolean | whether to support h265 uplink |
isH265DecodeSupported | boolean | whether to support h265 downlink |
isAV1EncodeSupported | boolean | whether to support AV1 uplink |
isAV1DecodeSupported | boolean | whether to support AV1 downlink |
const detect = new RTCDetect();
const result = await detect.getCodecAsync();
This API is used to get the detection report of the current environment.
Item | Type | Description |
---|---|---|
system | object | same as getSystem() result |
APISupported | object | same as getAPISupported() result |
codecsSupported | object | same as getCodecAsync() result |
devices | object | same as getDevicesAsync() result |
const detect = new RTCDetect();
const result = await detect.getReportAsync();
This API is used to check whether hardware acceleration is enabled on the Chrome browser.
Note: the implementation of this API depends on the native WebRTC API. We recommend you call this API for check after calling isTRTCSupported
. The check can take up to 30 seconds as tested below:
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(`hardware acceleration is disabled`)
}
Improvement
Improvement
Improvement
Improvement
Improvement
Bug Fixed
Feature
camera
object obtained from the getDevicesAsync()
method has a new maxFrameRate
parameter indicating the maximum frame rate supported by the camera.Improvement
Feature
isHardWareAccelerationEnable()
method to detect if Chrome has hardware acceleration enabled.Improvement
FAQs
rtc-detect
The npm package rtc-detect receives a total of 630 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.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.