detect-audio-video
Advanced tools
Comparing version 0.12.0 to 0.12.1
@@ -158,12 +158,19 @@ const AAC_CONTENT_TYPE = 'audio/mp4; codecs="mp4a.40.2"'; | ||
function isHdrScreenSupported() { | ||
let result = false; | ||
try { | ||
result = window.matchMedia('(dynamic-range: high)').matches || | ||
// https://developer.mozilla.org/en-US/docs/Web/CSS/@media/video-dynamic-range | ||
// For Firefox users on macOS 11+ (with HDR-compatible screens) | ||
window.matchMedia('(video-dynamic-range: high)').matches; | ||
const isHighSupported = checkDynamicRange('high'); | ||
const isStandardSupported = checkDynamicRange('standard'); | ||
if (!isStandardSupported) { | ||
return undefined; | ||
} | ||
return Boolean(isStandardSupported && isHighSupported); | ||
} | ||
catch (e) { } | ||
return result; | ||
return undefined; | ||
} | ||
function checkDynamicRange(type) { | ||
return window.matchMedia(`(dynamic-range: ${type})`).matches || | ||
// https://developer.mozilla.org/en-US/docs/Web/CSS/@media/video-dynamic-range | ||
// For Firefox users on macOS 11+ (with HDR-compatible screens) | ||
window.matchMedia(`(video-dynamic-range: ${type})`).matches; | ||
} | ||
// 15360×8640 | ||
@@ -170,0 +177,0 @@ const SCREEN_WIDTH_16K = 15360; |
@@ -5,3 +5,3 @@ export declare function getDevicePixelRatio(): number; | ||
export declare function getScreenDepth(): number; | ||
export declare function isHdrScreenSupported(): boolean; | ||
export declare function isHdrScreenSupported(): boolean | undefined; | ||
export declare function is16KScreenSupported(width?: number): boolean; | ||
@@ -8,0 +8,0 @@ export declare function is10KScreenSupported(width?: number): boolean; |
{ | ||
"name": "detect-audio-video", | ||
"version": "0.12.0", | ||
"version": "0.12.1", | ||
"description": "Detect audio video features", | ||
@@ -5,0 +5,0 @@ "module": "dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
28991
652