detect-audio-video
TypeScript icon, indicating that this package has built-in type declarations

4.3.0 • Public • Published

detect-audio-video

NPM version NPM downloads

Detect audio and video features in browser.

Install

npm i --save-dev detect-audio-video

Features

🖥️ 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

🏊 Native streaming support

  • 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

🖼️ Image formats

  • 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

Links

MIT

Package Sidebar

Install

npm i detect-audio-video

Weekly Downloads

341

Version

4.3.0

License

MIT

Unpacked Size

76.4 kB

Total Files

63

Last publish

Collaborators

  • hcodes