detect-audio-video
Advanced tools
Comparing version 0.32.0 to 0.33.0
@@ -302,9 +302,9 @@ const AAC_CONTENT_TYPE = 'audio/mp4; codecs="mp4a.40.2"'; | ||
} | ||
function isHdrScreenSupported() { | ||
function isHdrScreenSupported(win = window) { | ||
var _a, _b, _c; | ||
if (window.Hisense_GetSupportForHDR) { | ||
return window.Hisense_GetSupportForHDR() !== 'not support'; | ||
if (win.Hisense_GetSupportForHDR) { | ||
return win.Hisense_GetSupportForHDR() !== 'not support'; | ||
} | ||
// @ts-ignore | ||
const cast = window.cast; | ||
const cast = win.cast; | ||
// Chromecast | ||
@@ -315,4 +315,4 @@ if (cast) { | ||
try { | ||
const isHighSupported = checkDynamicRange('high'); | ||
const isStandardSupported = checkDynamicRange('standard'); | ||
const isHighSupported = checkDynamicRange('high', win); | ||
const isStandardSupported = checkDynamicRange('standard', win); | ||
if (!isStandardSupported) { | ||
@@ -326,7 +326,7 @@ return undefined; | ||
} | ||
function checkDynamicRange(type) { | ||
return window.matchMedia(`(dynamic-range: ${type})`).matches || | ||
function checkDynamicRange(type, win = window) { | ||
return win.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; | ||
win.matchMedia(`(video-dynamic-range: ${type})`).matches; | ||
} | ||
@@ -333,0 +333,0 @@ // 30720×17280 |
@@ -10,3 +10,3 @@ declare global { | ||
export declare function getScreenDepth(): number; | ||
export declare function isHdrScreenSupported(): boolean | undefined; | ||
export declare function isHdrScreenSupported(win?: Window & typeof globalThis): boolean | undefined; | ||
export declare function is32KScreenSupported(width?: number): boolean; | ||
@@ -13,0 +13,0 @@ export declare function is16KScreenSupported(width?: number): boolean; |
{ | ||
"name": "detect-audio-video", | ||
"version": "0.32.0", | ||
"version": "0.33.0", | ||
"description": "Detect audio video features", | ||
@@ -5,0 +5,0 @@ "module": "dist/index.js", |
45812