Détail du package

detect-audio-video

vvideo1.3kMIT4.5.0

Detect audio and video features in browser

audio, video, widevine, playready

readme

detect-audio-video

NPM version NPM downloads

Detect audio and video features in browser.

Demo

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

HTMLVideoElement features

  • 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

📹 Video codecs

  • H.264
  • H.265 (HEVC)
  • H.266 (VVC)
  • Dolby Vision
  • EVC
  • VP8
  • VP9
  • AV1

🔊 Audio codecs

  • 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

License

MIT

changelog

4.5.0

Added content types for Apple ProRes:

  • ProRes 422, ProRes 422 HQ, ProRes 422 LT, ProRes 422 Proxy
  • ProRes 4444, ProRes 4444 XQ
  • ProRes RAW, ProRes RAQ HQ

4.4.0

  • Added getMacScreenInches() and getMacbookScreenInches().

4.3.0

  • Improvements for getGpuProblems().
  • Added isVirtualMachine().

4.2.1

Improvements for getGpuProblems().

4.2.0

Added getGpuProblems() to detect if GPU driver is not installed.

4.1.0

Added isContentTypeSupportedAsync() with mediaCapabilities.decodingInfo.

4.0.0

Add helpers:

  • hasTouchScreen()
  • getMaxTouchPoints()
  • isPlayStation()

The result of functions getWebRTCAudioCodecs() and getWebRTCVideoCodecs() is extended. Before: getWebRTCAudioCodecs(onlyMedia?: boolean): RTCRtpCodec[] After: getWebRTCAudioCodecs(onlyMedia?: boolean): { encoding: RTCRtpCodec[]; decoding: RTCRtpCodec[]; }

3.2.1

Small fixes for smallest images.

3.2.0

  • Fixes for image format support detection.
  • Added image formats:
    • BMP
    • ICO
    • TIFF

3.1.0

  • Fix for detection of Dolby Atmos for old Safari.
  • Added PlayStation helpers:
    • isPlayStationVita()
    • isPlayStation3()
    • isPlayStation4()
    • isPlayStation5()
    • isPlayStation6()

3.0.0

Added helpers:

  • isSafari()
  • isDesktopSafari()

Added detection of Dolby Atmos for Safari. Before: isDolbyAtmosSupported(): boolean After: isDolbyAtmosSupported(): Promise<boolean>

2.9.1

Fixed typo for isWideGamutSupported().

2.9.0

Added isIOS() helper.

2.8.0

Added helpers:

  • isAndroid()
  • getAndroidVersion()
  • getAndroidVersionAsString()

2.7.2

Fixed detection of codecs for old iPad, PS4 and ...

2.7.1

Fix parser for PS5 and Firefox.

2.7.0

Add parser for gamepad names.

2.6.1

Fix for WebRTC media filter.

2.6.0

Added 4.5K resolution.

2.5.0

Added media filter for getWebRTCAudioCodecs(onlyMedia?: boolean).

2.4.2

Fix typos.

2.4.1

Fix for isWebRTCSupported.

2.4.0

  • Detect if system supports WebRTC.
  • Helpers for get audio and video codes for WebRTC.

2.3.1

Small fix for isRemotePlaybackApiSupported(), added support for Safari.

2.3.0

Added helpers:

  • isRemotePlaybackApiSupported()
  • isMseInWorkersSupported()
  • isMmsInWorkersSupported()

2.2.2

Fixed TypeScript typings.

2.2.1

Fixed TypeScript typings.

2.2.0

Added isAppleSilicon() helper.

2.1.0

Added isDocumentPipSupported() helper.

2.0.1

Fixed initDataTypes for DRM functions.

2.0.0

Changed params for DRM functions.

  • isPlayReadySupported
  • isWidevineSupported
  • ...

1.3.0

Fixes for SSR.

1.2.1

  • Fix title for SD resolution.

1.2.0

  • Added hasHardwareAcceleration helper.
  • Added isChromium helper.
  • Renamed getIsMobileisMobile helper.

1.1.2

Fix for more detailed GPU data.

1.1.1

MSE support fix.

1.1.0

Added 3K resolution.

1.0.0

Public release.