Detect audio and video features in browser.
npm i --save-dev detect-audio-video
🖥️ Screen
- Size
- Device pixel ratio
- HDR support
- Wide gamut
- Color spaces
- Aspect ratio
import {
isWideGamutSupported,
isSrgbSupported,
isP3Supported,
isRec2020Supported,
getDevicePixelRatio,
getScreenWidth,
getScreenHeight,
getResolutionBadge,
isHighDynamicRangeSupported,
isHighVideoDynamicRangeSupported,
} from 'detect-audio-video';
console.log('isWideGamutSupported: ', isWideGamutSupported()); // boolean
console.log('isSrgbSupported: ', isSrgbSupported()); // boolean
console.log('isP3Supported: ', isP3Supported()); // boolean
console.log('isRec2020Supported: ', isRec2020Supported()); // boolean
console.log('getDevicePixelRatio: ', getDevicePixelRatio()); // number
// Get screen width with device pixel ratio
console.log('getScreenWidth: ', getScreenWidth()); // number
// Get screen height with device pixel ratio
console.log('getScreenHeight: ', getScreenHeight()); // number
console.log('getResolutionBadge: ', getResolutionBadge()); // string, example: "4K"
console.log('isHighDynamicRangeSupported: ', isHighDynamicRangeSupported()); // boolean
console.log('isHighVideoDynamicRangeSupported: ', isHighVideoDynamicRangeSupported()); // boolean
⚙️ GPU
- Vendor
- Renderer
import {
getGpuVendor,
getGpuRenderer,
hasHardwareAcceleration,
isAppleSilicon,
getGpuProblems,
isVirtualMachine,
} from 'detect-audio-video';
const gpuVendor = getGpuVendor();
console.log('gpuVendor: ', gpuVendor); // string, example: "Apple"
const gpuRenderer = getGpuRenderer();
console.log('gpuRenderer: ', gpuRenderer); // string, example: "Apple M1, or similar"
console.log('hasHardwareAcceleration: ', hasHardwareAcceleration()); // boolean
console.log('isAppleSilicon: ', isAppleSilicon()); // boolean
console.log('gpuProblems: ', getGpuProblems()); // null or ['no driver', ...]
console.log('isVirtualMachine: ', isVirtualMachine(gpuRenderer, gpuVendor)); // boolean
🔒 DRM
- Microsoft PlayReady SL150, SL2000, SL3000
- Google Widevine Modular L1, L3
- Apple FairPlay
- Adobe Primetime
- HDCP
- DASH
- HLS
- MSS
import {
isNativeHlsSupported,
isNativeMpdSupported,
isNativeMssSupported,
} from 'detect-audio-video';
console.log('isNativeMssSupported: ', isNativeMssSupported()); // boolean
console.log('isNativeHlsSupported: ', isNativeHlsSupported()); // boolean
console.log('isNativeMpdSupported: ', isNativeMpdSupported()); // boolean
- Media Source Extensions
- Media Source Extensions in Workers
- Encrypted Media Extensions
- Managed Media Source
- Managed Media Source in Workers
- Picture-in-picture
- Cast to AirPlay
- Remote Playback API
- H.264
- H.265 (HEVC)
- H.266 (VVC)
- Dolby Vision
- EVC
- VP8
- VP9
- AV1
- AAC
- Opus
- Vorbis
- FLAC
- ALAC
- AC-3 (Dolby Digital)
- EC-3 (Dolby Digital+)
- Dolby Atmos
- GIF
- PNG
- APNG
- JPEG
- JPEG XL
- HEIF/HEIC
- AVIF
- WEBP
- SVG
- ICO
- BMP
- TIFF
🕍 Platform
- Standalone
✨ WebRTC
- Support
- Audio and video codecs
🎮 Gamepad
- Parser for gamepad name
MIT