detect-audio-video
Advanced tools
Comparing version 0.4.0 to 0.5.0
@@ -196,7 +196,10 @@ const H264_BASELINE_CONTENT_TYPE = 'video/mp4; codecs="avc1.42E01E"'; | ||
function getDevicePixelRatio() { | ||
return window.devicePixelRatio || 1; | ||
} | ||
function getScreenWidth() { | ||
return screen.width * (window.devicePixelRatio || 1); | ||
return screen.width * getDevicePixelRatio(); | ||
} | ||
function getScreenHeight() { | ||
return screen.height * (window.devicePixelRatio || 1); | ||
return screen.height * getDevicePixelRatio(); | ||
} | ||
@@ -206,5 +209,9 @@ function getScreenDepth() { | ||
} | ||
const MIN_HDR_COLOR_DEPTH = 30; | ||
function isHDRScreenSupported(depth = getScreenDepth()) { | ||
return depth >= MIN_HDR_COLOR_DEPTH; | ||
function isHDRScreenSupported() { | ||
let result = false; | ||
try { | ||
result = window.matchMedia('(dynamic-range: high)').matches; | ||
} | ||
catch (e) { } | ||
return result; | ||
} | ||
@@ -368,2 +375,2 @@ // 15360×8640 | ||
export { AC3_CONTENT_TYPE, ACC_CONTENT_TYPE, CLEAR_KEY_SYSTEM, DOLBY_ATMOS_CONTENT_TYPE, EC3_CONTENT_TYPE, FAIRPLAY_KEY_SYSTEM, FAIRPLAY_V1_KEY_SYSTEM, FAIRPLAY_V2_KEY_SYSTEM, FAIRPLAY_V3_KEY_SYSTEM, FLAC_CONTENT_TYPE, H264_BASELINE_CONTENT_TYPE, H264_HIGH_CONTENT_TYPE, H264_MAIN_CONTENT_TYPE, MPEGH_AUDIO_CONTENT_TYPE, OPUS_CONTENT_TYPE, PLAYREADY_KEY_SYSTEM, PRIMETIME_KEY_SYSTEM, VORBIS_CONTENT_TYPE, WIDEWINE_KEY_SYSTEM, getGpuRenderer, getGpuVendor, getScreenBadge, getScreenDepth, getScreenHeight, getScreenWidth, is10KScreenSupported, is16KScreenSupported, is2KScreenSupported, is2dot5KScreenSupported, is4KScreenSupported, is5KScreenSupported, is6KScreenSupported, is8KScreenSupported, isACCSupported, isClearKeySupported, isDolbyAtmosSupported, isDolbyDigitalPlusSupported, isDolbyDigitalSupported, isFairPlaySupported, isFlacSupported, isFullHDScreenSupported, isHDRScreenSupported, isHDScreenSupported, isMpegHAudioSupported, isOpusSupported, isPlayReadySL150Supported, isPlayReadySL2000Supported, isPlayReadySL3000Supported, isPlayReadySupported, isPrimetimeSupported, isSDScreenSupported, isTypeSupported, isVorbisSupported, isWidevineL1Supported, isWidevineL3Supported, isWidevineSupported }; | ||
export { AC3_CONTENT_TYPE, ACC_CONTENT_TYPE, CLEAR_KEY_SYSTEM, DOLBY_ATMOS_CONTENT_TYPE, EC3_CONTENT_TYPE, FAIRPLAY_KEY_SYSTEM, FAIRPLAY_V1_KEY_SYSTEM, FAIRPLAY_V2_KEY_SYSTEM, FAIRPLAY_V3_KEY_SYSTEM, FLAC_CONTENT_TYPE, H264_BASELINE_CONTENT_TYPE, H264_HIGH_CONTENT_TYPE, H264_MAIN_CONTENT_TYPE, MPEGH_AUDIO_CONTENT_TYPE, OPUS_CONTENT_TYPE, PLAYREADY_KEY_SYSTEM, PRIMETIME_KEY_SYSTEM, VORBIS_CONTENT_TYPE, WIDEWINE_KEY_SYSTEM, getDevicePixelRatio, getGpuRenderer, getGpuVendor, getScreenBadge, getScreenDepth, getScreenHeight, getScreenWidth, is10KScreenSupported, is16KScreenSupported, is2KScreenSupported, is2dot5KScreenSupported, is4KScreenSupported, is5KScreenSupported, is6KScreenSupported, is8KScreenSupported, isACCSupported, isClearKeySupported, isDolbyAtmosSupported, isDolbyDigitalPlusSupported, isDolbyDigitalSupported, isFairPlaySupported, isFlacSupported, isFullHDScreenSupported, isHDRScreenSupported, isHDScreenSupported, isMpegHAudioSupported, isOpusSupported, isPlayReadySL150Supported, isPlayReadySL2000Supported, isPlayReadySL3000Supported, isPlayReadySupported, isPrimetimeSupported, isSDScreenSupported, isTypeSupported, isVorbisSupported, isWidevineL1Supported, isWidevineL3Supported, isWidevineSupported }; |
@@ -0,5 +1,6 @@ | ||
export declare function getDevicePixelRatio(): number; | ||
export declare function getScreenWidth(): number; | ||
export declare function getScreenHeight(): number; | ||
export declare function getScreenDepth(): number; | ||
export declare function isHDRScreenSupported(depth?: number): boolean; | ||
export declare function isHDRScreenSupported(): boolean; | ||
export declare function is16KScreenSupported(width?: number): boolean; | ||
@@ -6,0 +7,0 @@ export declare function is10KScreenSupported(width?: number): boolean; |
{ | ||
"name": "detect-audio-video", | ||
"version": "0.4.0", | ||
"version": "0.5.0", | ||
"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
18340
435