detect-audio-video
Advanced tools
Comparing version 0.12.1 to 0.13.0
@@ -0,3 +1,8 @@ | ||
declare global { | ||
interface Window { | ||
ManagedMediaSource: typeof MediaSource; | ||
} | ||
} | ||
export declare function isMseSupported(): boolean; | ||
export declare function isEmeSupported(): boolean; | ||
export declare function isMmsSupported(): boolean; |
@@ -138,6 +138,3 @@ const AAC_CONTENT_TYPE = 'audio/mp4; codecs="mp4a.40.2"'; | ||
function isMmsSupported() { | ||
return Boolean( | ||
// @ts-ignore | ||
window.ManagedMediaSource && | ||
// @ts-ignore | ||
return Boolean(window.ManagedMediaSource && | ||
window.ManagedMediaSource.isTypeSupported); | ||
@@ -176,2 +173,4 @@ } | ||
} | ||
// 30720×17280 | ||
const SCREEN_WIDTH_32K = 30720; | ||
// 15360×8640 | ||
@@ -199,2 +198,5 @@ const SCREEN_WIDTH_16K = 15360; | ||
// SD: 854x480, 640x360, 426x240 | ||
function is32KScreenSupported(width = getScreenWidth()) { | ||
return width >= SCREEN_WIDTH_32K; | ||
} | ||
function is16KScreenSupported(width = getScreenWidth()) { | ||
@@ -236,56 +238,60 @@ return width >= SCREEN_WIDTH_16K; | ||
{ | ||
handler: isSDScreenSupported, | ||
badge: 'SD' | ||
badge: 'SD', | ||
width: 0, | ||
}, | ||
{ | ||
handler: isHDScreenSupported, | ||
width: SCREEN_WIDTH_HD, | ||
title: 'HD' | ||
}, | ||
{ | ||
handler: isFullHDScreenSupported, | ||
width: SCREEN_WIDTH_FULLHD, | ||
title: 'FullHD' | ||
}, | ||
{ | ||
handler: is2KScreenSupported, | ||
width: SCREEN_WIDTH_2K, | ||
title: '2K' | ||
}, | ||
{ | ||
handler: is2dot5KScreenSupported, | ||
width: SCREEN_WIDTH_2d5K, | ||
title: '2.5K' | ||
}, | ||
{ | ||
handler: is4KScreenSupported, | ||
width: SCREEN_WIDTH_4K, | ||
title: '4K' | ||
}, | ||
{ | ||
handler: is5KScreenSupported, | ||
width: SCREEN_WIDTH_5K, | ||
title: '5K' | ||
}, | ||
{ | ||
handler: is6KScreenSupported, | ||
width: SCREEN_WIDTH_6K, | ||
title: '6K' | ||
}, | ||
{ | ||
handler: is8KScreenSupported, | ||
width: SCREEN_WIDTH_8K, | ||
title: '8K' | ||
}, | ||
{ | ||
handler: is10KScreenSupported, | ||
width: SCREEN_WIDTH_10K, | ||
title: '10K' | ||
}, | ||
{ | ||
handler: is16KScreenSupported, | ||
width: SCREEN_WIDTH_16K, | ||
title: '16K' | ||
}, | ||
]; | ||
let supportedSize = sizes[0]; | ||
for (let i = 0; i < sizes.length; i++) { | ||
if (sizes[i].handler(width)) { | ||
supportedSize = sizes[i]; | ||
let supportedSize = sizes[0].title; | ||
for (const item of sizes) { | ||
if (item.width === width) { | ||
supportedSize = item.title; | ||
break; | ||
} | ||
else { | ||
if (item.width > width) { | ||
break; | ||
} | ||
else { | ||
supportedSize = `>${item.title}`; | ||
} | ||
} | ||
return supportedSize.title; | ||
return supportedSize; | ||
} | ||
@@ -544,2 +550,2 @@ function getResolutionMode(height = getScreenHeight()) { | ||
export { AAC_CONTENT_TYPE, AV1_CONTENT_TYPE, CLEAR_KEY_SYSTEM, DOLBY_AC3_CONTENT_TYPE, DOLBY_AC4_CONTENT_TYPE, DOLBY_ATMOS_CONTENT_TYPE, DOLBY_EC3_CONTENT_TYPE, DTS_CORE_CONTENT_TYPE, DTS_HD_CORE_PLUS_EXTENSION_CONTENT_TYPE, DTS_HD_LBR_CONTENT_TYPE, DTS_UHD_PROFILE_2_CONTENT_TYPE, DTS_UHD_PROFILE_3_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, HLS_CONTENT_TYPE, MP3_CONTENT_TYPE, MPD_CONTENT_TYPE, MPEG_H_AUDIO_LC_PROFILE_LEVEL_1_CONTENT_TYPE, MPEG_H_AUDIO_LC_PROFILE_LEVEL_1_MULTISTREAM_CONTENT_TYPE, MPEG_H_AUDIO_LC_PROFILE_LEVEL_2_CONTENT_TYPE, MPEG_H_AUDIO_LC_PROFILE_LEVEL_2_MULTISTREAM_CONTENT_TYPE, MPEG_H_AUDIO_LC_PROFILE_LEVEL_3_CONTENT_TYPE, MPEG_H_AUDIO_LC_PROFILE_LEVEL_3_MULTISTREAM_CONTENT_TYPE, MSS_CONTENT_TYPE, OPUS_CONTENT_TYPE, PLAYREADY_KEY_SYSTEM, PRIMETIME_KEY_SYSTEM, TTML_CONTENT_TYPE, VORBIS_CONTENT_TYPE, VP8_CONTENT_TYPE, VP9_CONTENT_TYPE, WEBVTT_CONTENT_TYPE, WIDEWINE_KEY_SYSTEM, XHE_AAC_CONTENT_TYPE, canPlayType, defaultVideoElement, getDevicePixelRatio, getGpuRenderer, getGpuVendor, getResolutionBadge, getResolutionMode, getScreenDepth, getScreenHeight, getScreenWidth, is10KScreenSupported, is16KScreenSupported, is2KScreenSupported, is2dot5KScreenSupported, is4KScreenSupported, is5KScreenSupported, is6KScreenSupported, is8KScreenSupported, isAV1Supported, isAacSupported, isClearKeySupported, isDolbyAtmosSupported, isDolbyDigitalPlusSupported, isDolbyDigitalSupported, isDtsExpressSupported, isDtsHdSupported, isDtsSupported, isDtsXSupported, isEmeSupported, isFairPlaySupported, isFairPlayV1Supported, isFairPlayV2Supported, isFairPlayV3Supported, isFlacSupported, isFullHDScreenSupported, isH264BaselineSupported, isH264HighSupported, isH264MainSupported, isHDScreenSupported, isHdrScreenSupported, isMmsSupported, isMp3Supported, isMpegHAudioSupported, isMseSupported, isNativeHlsSupported, isNativeMpdSupported, isNativeMssSupported, isOpusSupported, isPlayReadySL150Supported, isPlayReadySL2000Supported, isPlayReadySL3000Supported, isPlayReadySupported, isPrimetimeSupported, isSDScreenSupported, isTypeSupported, isVorbisSupported, isVp8Supported, isVp9Supported, isWidevineL1Supported, isWidevineL3Supported, isWidevineSupported }; | ||
export { AAC_CONTENT_TYPE, AV1_CONTENT_TYPE, CLEAR_KEY_SYSTEM, DOLBY_AC3_CONTENT_TYPE, DOLBY_AC4_CONTENT_TYPE, DOLBY_ATMOS_CONTENT_TYPE, DOLBY_EC3_CONTENT_TYPE, DTS_CORE_CONTENT_TYPE, DTS_HD_CORE_PLUS_EXTENSION_CONTENT_TYPE, DTS_HD_LBR_CONTENT_TYPE, DTS_UHD_PROFILE_2_CONTENT_TYPE, DTS_UHD_PROFILE_3_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, HLS_CONTENT_TYPE, MP3_CONTENT_TYPE, MPD_CONTENT_TYPE, MPEG_H_AUDIO_LC_PROFILE_LEVEL_1_CONTENT_TYPE, MPEG_H_AUDIO_LC_PROFILE_LEVEL_1_MULTISTREAM_CONTENT_TYPE, MPEG_H_AUDIO_LC_PROFILE_LEVEL_2_CONTENT_TYPE, MPEG_H_AUDIO_LC_PROFILE_LEVEL_2_MULTISTREAM_CONTENT_TYPE, MPEG_H_AUDIO_LC_PROFILE_LEVEL_3_CONTENT_TYPE, MPEG_H_AUDIO_LC_PROFILE_LEVEL_3_MULTISTREAM_CONTENT_TYPE, MSS_CONTENT_TYPE, OPUS_CONTENT_TYPE, PLAYREADY_KEY_SYSTEM, PRIMETIME_KEY_SYSTEM, TTML_CONTENT_TYPE, VORBIS_CONTENT_TYPE, VP8_CONTENT_TYPE, VP9_CONTENT_TYPE, WEBVTT_CONTENT_TYPE, WIDEWINE_KEY_SYSTEM, XHE_AAC_CONTENT_TYPE, canPlayType, defaultVideoElement, getDevicePixelRatio, getGpuRenderer, getGpuVendor, getResolutionBadge, getResolutionMode, getScreenDepth, getScreenHeight, getScreenWidth, is10KScreenSupported, is16KScreenSupported, is2KScreenSupported, is2dot5KScreenSupported, is32KScreenSupported, is4KScreenSupported, is5KScreenSupported, is6KScreenSupported, is8KScreenSupported, isAV1Supported, isAacSupported, isClearKeySupported, isDolbyAtmosSupported, isDolbyDigitalPlusSupported, isDolbyDigitalSupported, isDtsExpressSupported, isDtsHdSupported, isDtsSupported, isDtsXSupported, isEmeSupported, isFairPlaySupported, isFairPlayV1Supported, isFairPlayV2Supported, isFairPlayV3Supported, isFlacSupported, isFullHDScreenSupported, isH264BaselineSupported, isH264HighSupported, isH264MainSupported, isHDScreenSupported, isHdrScreenSupported, isMmsSupported, isMp3Supported, isMpegHAudioSupported, isMseSupported, isNativeHlsSupported, isNativeMpdSupported, isNativeMssSupported, isOpusSupported, isPlayReadySL150Supported, isPlayReadySL2000Supported, isPlayReadySL3000Supported, isPlayReadySupported, isPrimetimeSupported, isSDScreenSupported, isTypeSupported, isVorbisSupported, isVp8Supported, isVp9Supported, isWidevineL1Supported, isWidevineL3Supported, isWidevineSupported }; |
@@ -6,2 +6,3 @@ export declare function getDevicePixelRatio(): number; | ||
export declare function isHdrScreenSupported(): boolean | undefined; | ||
export declare function is32KScreenSupported(width?: number): boolean; | ||
export declare function is16KScreenSupported(width?: number): boolean; | ||
@@ -8,0 +9,0 @@ export declare function is10KScreenSupported(width?: number): boolean; |
{ | ||
"name": "detect-audio-video", | ||
"version": "0.12.1", | ||
"version": "0.13.0", | ||
"description": "Detect audio video features", | ||
@@ -5,0 +5,0 @@ "module": "dist/index.js", |
29295
664