detect-audio-video
Advanced tools
Comparing version 0.37.0 to 0.38.0
@@ -11,2 +11,3 @@ declare global { | ||
both: boolean; | ||
mediaElementType: "audio" | "video"; | ||
contentType: string; | ||
@@ -19,2 +20,3 @@ }; | ||
both: boolean; | ||
mediaElementType: "audio" | "video"; | ||
contentType: string; | ||
@@ -27,2 +29,3 @@ }; | ||
both: boolean; | ||
mediaElementType: "audio" | "video"; | ||
contentType: string; | ||
@@ -35,2 +38,3 @@ }; | ||
both: boolean; | ||
mediaElementType: "audio" | "video"; | ||
contentType: string; | ||
@@ -43,2 +47,3 @@ }; | ||
both: boolean; | ||
mediaElementType: "audio" | "video"; | ||
contentType: string; | ||
@@ -52,2 +57,3 @@ }; | ||
both: boolean; | ||
mediaElementType: "audio" | "video"; | ||
contentType: string; | ||
@@ -60,2 +66,3 @@ }; | ||
both: boolean; | ||
mediaElementType: "audio" | "video"; | ||
contentType: string; | ||
@@ -68,2 +75,3 @@ }; | ||
both: boolean; | ||
mediaElementType: "audio" | "video"; | ||
contentType: string; | ||
@@ -76,2 +84,3 @@ }; | ||
both: boolean; | ||
mediaElementType: "audio" | "video"; | ||
contentType: string; | ||
@@ -84,2 +93,3 @@ }; | ||
both: boolean; | ||
mediaElementType: "audio" | "video"; | ||
contentType: string; | ||
@@ -92,2 +102,3 @@ }; | ||
both: boolean; | ||
mediaElementType: "audio" | "video"; | ||
contentType: string; | ||
@@ -100,2 +111,3 @@ }; | ||
both: boolean; | ||
mediaElementType: "audio" | "video"; | ||
contentType: string; | ||
@@ -108,3 +120,4 @@ }; | ||
both: boolean; | ||
mediaElementType: "audio" | "video"; | ||
contentType: string; | ||
}; |
@@ -25,8 +25,23 @@ const AAC_CONTENT_TYPE = 'audio/mp4; codecs="mp4a.40.2"'; | ||
let defaultVideoElement; | ||
function canPlayType(type) { | ||
if (!defaultVideoElement) { | ||
defaultVideoElement = document.createElement('video'); | ||
let defaultAudioElement; | ||
function resetDefaultMediaElements() { | ||
defaultVideoElement = undefined; | ||
defaultAudioElement = undefined; | ||
} | ||
function canPlayType(type, mediaElementType = 'video') { | ||
let mediaElement; | ||
if (mediaElementType === 'audio') { | ||
if (!defaultAudioElement) { | ||
defaultAudioElement = document.createElement('video'); | ||
} | ||
mediaElement = defaultAudioElement; | ||
} | ||
return defaultVideoElement.canPlayType ? | ||
defaultVideoElement.canPlayType(type) : | ||
else { | ||
if (!defaultVideoElement) { | ||
defaultVideoElement = document.createElement('video'); | ||
} | ||
mediaElement = defaultVideoElement; | ||
} | ||
return mediaElement.canPlayType ? | ||
mediaElement.canPlayType(type) : | ||
''; | ||
@@ -47,4 +62,4 @@ } | ||
function isContentTypeSupported(contentType) { | ||
const canPlayTypeResult = canPlayType(contentType); | ||
function isContentTypeSupported(contentType, mediaElementType = 'video') { | ||
const canPlayTypeResult = canPlayType(contentType, mediaElementType); | ||
const isTypeSupportedResult = isTypeSupported(contentType); | ||
@@ -56,2 +71,3 @@ return { | ||
both: canPlayTypeResult !== '' && isTypeSupportedResult, | ||
mediaElementType, | ||
contentType, | ||
@@ -62,15 +78,15 @@ }; | ||
function isMp3Supported() { | ||
return isContentTypeSupported(MP3_CONTENT_TYPE); | ||
return isContentTypeSupported(MP3_CONTENT_TYPE, 'audio'); | ||
} | ||
function isMp4AudioSupported() { | ||
return isContentTypeSupported(MP4_AUDIO_CONTENT_TYPE); | ||
return isContentTypeSupported(MP4_AUDIO_CONTENT_TYPE, 'audio'); | ||
} | ||
function isAacSupported() { | ||
return isContentTypeSupported(AAC_CONTENT_TYPE); | ||
return isContentTypeSupported(AAC_CONTENT_TYPE, 'audio'); | ||
} | ||
function isDolbyDigitalSupported() { | ||
return isContentTypeSupported(DOLBY_AC3_CONTENT_TYPE); | ||
return isContentTypeSupported(DOLBY_AC3_CONTENT_TYPE, 'audio'); | ||
} | ||
function isDolbyDigitalPlusSupported() { | ||
return isContentTypeSupported(DOLBY_EC3_CONTENT_TYPE); | ||
return isContentTypeSupported(DOLBY_EC3_CONTENT_TYPE, 'audio'); | ||
} | ||
@@ -97,24 +113,24 @@ // audio/mp4; codecs="ec-3"; spatialRendering=true - no support | ||
function isMpegHAudioSupported() { | ||
return isContentTypeSupported(MPEG_H_AUDIO_LC_PROFILE_LEVEL_3_CONTENT_TYPE); | ||
return isContentTypeSupported(MPEG_H_AUDIO_LC_PROFILE_LEVEL_3_CONTENT_TYPE, 'audio'); | ||
} | ||
function isVorbisSupported() { | ||
return isContentTypeSupported(VORBIS_CONTENT_TYPE); | ||
return isContentTypeSupported(VORBIS_CONTENT_TYPE, 'audio'); | ||
} | ||
function isFlacSupported() { | ||
return isContentTypeSupported(FLAC_CONTENT_TYPE); | ||
return isContentTypeSupported(FLAC_CONTENT_TYPE, 'audio'); | ||
} | ||
function isOpusSupported() { | ||
return isContentTypeSupported(OPUS_CONTENT_TYPE); | ||
return isContentTypeSupported(OPUS_CONTENT_TYPE, 'audio'); | ||
} | ||
function isDtsSupported() { | ||
return isContentTypeSupported(DTS_CORE_CONTENT_TYPE); | ||
return isContentTypeSupported(DTS_CORE_CONTENT_TYPE, 'audio'); | ||
} | ||
function isDtsHdSupported() { | ||
return isContentTypeSupported(DTS_HD_CORE_PLUS_EXTENSION_CONTENT_TYPE); | ||
return isContentTypeSupported(DTS_HD_CORE_PLUS_EXTENSION_CONTENT_TYPE, 'audio'); | ||
} | ||
function isDtsExpressSupported() { | ||
return isContentTypeSupported(DTS_HD_LBR_CONTENT_TYPE); | ||
return isContentTypeSupported(DTS_HD_LBR_CONTENT_TYPE, 'audio'); | ||
} | ||
function isDtsXSupported() { | ||
return isContentTypeSupported(DTS_UHD_PROFILE_2_CONTENT_TYPE); | ||
return isContentTypeSupported(DTS_UHD_PROFILE_2_CONTENT_TYPE, 'audio'); | ||
} | ||
@@ -768,2 +784,2 @@ | ||
export { AAC_CONTENT_TYPE, APNG_CONTENT_TYPE, AV1_CONTENT_TYPE, AV1_MAIN10_CONTENT_TYPE, AVIF_CONTENT_TYPE, CLEAR_KEY_SYSTEM, DOLBY_AC3_CONTENT_TYPE, DOLBY_AC4_CONTENT_TYPE, DOLBY_ATMOS_CONTENT_TYPE, DOLBY_EC3_CONTENT_TYPE, DOLBY_VISION_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, EVC_BASELINE_CONTENT_TYPE, EVC_MAIN_CONTENT_TYPE, FAIRPLAY_KEY_SYSTEM, FAIRPLAY_V1_KEY_SYSTEM, FAIRPLAY_V2_KEY_SYSTEM, FAIRPLAY_V3_KEY_SYSTEM, FLAC_CONTENT_TYPE, GIF_CONTENT_TYPE, H264_BASELINE_CONTENT_TYPE, H264_HIGH_CONTENT_TYPE, H264_MAIN_CONTENT_TYPE, HEIC_CONTENT_TYPE, HEIF_CONTENT_TYPE, HEV_MAIN10_CONTENT_TYPE, HEV_MAIN_CONTENT_TYPE, HLS_CONTENT_TYPE, HVC_MAIN10_CONTENT_TYPE, HVC_MAIN_CONTENT_TYPE, JPEG_CONTENT_TYPE, JPEG_XL_CONTENT_TYPE, MP3_CONTENT_TYPE, MP4_AUDIO_CONTENT_TYPE, MPD_CONTENT_TYPE, MPEG2T_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, PLAYREADY_RECOMMENDATION_KEY_SYSTEM, PNG_CONTENT_TYPE, PRIMETIME_KEY_SYSTEM, SVG_CONTENT_TYPE, TTML_CONTENT_TYPE, VORBIS_CONTENT_TYPE, VP8_CONTENT_TYPE, VP9_CONTENT_TYPE, VP9_PROFILE2_LEVEL1_10BIT_CONTENT_TYPE, VVC1_MAIN10_CONTENT_TYPE, VVCI_MAIN10_CONTENT_TYPE, WEBP_CONTENT_TYPE, WEBVTT_CONTENT_TYPE, WIDEWINE_KEY_SYSTEM, XHE_AAC_CONTENT_TYPE, canPlayType, checkSize, defaultVideoElement, getDevicePixelRatio, getGpuRenderer, getGpuVendor, getIsMobile, getResolutionBadge, getScreenDepth, getScreenHeight, getScreenWidth, is10KScreenSupported, is16KScreenSupported, is2KScreenSupported, is2dot5KScreenSupported, is32KScreenSupported, is4KScreenSupported, is5KScreenSupported, is6KScreenSupported, is8KScreenSupported, isAPngSupported, isAV1Main10Supported, isAV1Supported, isAacSupported, isAvifSupported, isCastToAirPlaySupported, isClearKeySupported, isContentTypeSupported, isDolbyAtmosSupported, isDolbyDigitalPlusSupported, isDolbyDigitalSupported, isDolbyVisionSupported, isDtsExpressSupported, isDtsHdSupported, isDtsSupported, isDtsXSupported, isEmeSupported, isEvcBaselineSupported, isEvcMainSupported, isFairPlaySupported, isFairPlayV1Supported, isFairPlayV2Supported, isFairPlayV3Supported, isFlacSupported, isFullHDScreenSupported, isGifSupported, isH264BaselineSupported, isH264HighSupported, isH264MainSupported, isHDScreenSupported, isHeicSupported, isHeifSupported, isHevcMain10Supported, isHevcMainSupported, isHighDynamicRangeSupported, isHighVideoDynamicRangeSupported, isImageSupported, isJpegSupported, isJpegXlSupported, isMmsSupported, isMoreOrEqual, isMp3Supported, isMp4AudioSupported, isMpeg2TSupported, isMpegHAudioSupported, isMseSupported, isNativeHlsSupported, isNativeMpdSupported, isNativeMssSupported, isOpusSupported, isP3Supported, isPipSupported, isPlayReadySL150Supported, isPlayReadySL2000Supported, isPlayReadySL3000Supported, isPlayReadySupported, isPngSupported, isPrimetimeSupported, isRec2020Supported, isSDScreenSupported, isSrgbSupported, isStandalone, isSvgSupported, isTypeSupported, isVorbisSupported, isVp8Supported, isVp9Profile2Level110BitSupported, isVp9Supported, isVvcMain10Supported, isWebpSupported, isWideGamutSupported, isWidevineL1Supported, isWidevineL3Supported, isWidevineSupported }; | ||
export { AAC_CONTENT_TYPE, APNG_CONTENT_TYPE, AV1_CONTENT_TYPE, AV1_MAIN10_CONTENT_TYPE, AVIF_CONTENT_TYPE, CLEAR_KEY_SYSTEM, DOLBY_AC3_CONTENT_TYPE, DOLBY_AC4_CONTENT_TYPE, DOLBY_ATMOS_CONTENT_TYPE, DOLBY_EC3_CONTENT_TYPE, DOLBY_VISION_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, EVC_BASELINE_CONTENT_TYPE, EVC_MAIN_CONTENT_TYPE, FAIRPLAY_KEY_SYSTEM, FAIRPLAY_V1_KEY_SYSTEM, FAIRPLAY_V2_KEY_SYSTEM, FAIRPLAY_V3_KEY_SYSTEM, FLAC_CONTENT_TYPE, GIF_CONTENT_TYPE, H264_BASELINE_CONTENT_TYPE, H264_HIGH_CONTENT_TYPE, H264_MAIN_CONTENT_TYPE, HEIC_CONTENT_TYPE, HEIF_CONTENT_TYPE, HEV_MAIN10_CONTENT_TYPE, HEV_MAIN_CONTENT_TYPE, HLS_CONTENT_TYPE, HVC_MAIN10_CONTENT_TYPE, HVC_MAIN_CONTENT_TYPE, JPEG_CONTENT_TYPE, JPEG_XL_CONTENT_TYPE, MP3_CONTENT_TYPE, MP4_AUDIO_CONTENT_TYPE, MPD_CONTENT_TYPE, MPEG2T_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, PLAYREADY_RECOMMENDATION_KEY_SYSTEM, PNG_CONTENT_TYPE, PRIMETIME_KEY_SYSTEM, SVG_CONTENT_TYPE, TTML_CONTENT_TYPE, VORBIS_CONTENT_TYPE, VP8_CONTENT_TYPE, VP9_CONTENT_TYPE, VP9_PROFILE2_LEVEL1_10BIT_CONTENT_TYPE, VVC1_MAIN10_CONTENT_TYPE, VVCI_MAIN10_CONTENT_TYPE, WEBP_CONTENT_TYPE, WEBVTT_CONTENT_TYPE, WIDEWINE_KEY_SYSTEM, XHE_AAC_CONTENT_TYPE, canPlayType, checkSize, defaultAudioElement, defaultVideoElement, getDevicePixelRatio, getGpuRenderer, getGpuVendor, getIsMobile, getResolutionBadge, getScreenDepth, getScreenHeight, getScreenWidth, is10KScreenSupported, is16KScreenSupported, is2KScreenSupported, is2dot5KScreenSupported, is32KScreenSupported, is4KScreenSupported, is5KScreenSupported, is6KScreenSupported, is8KScreenSupported, isAPngSupported, isAV1Main10Supported, isAV1Supported, isAacSupported, isAvifSupported, isCastToAirPlaySupported, isClearKeySupported, isContentTypeSupported, isDolbyAtmosSupported, isDolbyDigitalPlusSupported, isDolbyDigitalSupported, isDolbyVisionSupported, isDtsExpressSupported, isDtsHdSupported, isDtsSupported, isDtsXSupported, isEmeSupported, isEvcBaselineSupported, isEvcMainSupported, isFairPlaySupported, isFairPlayV1Supported, isFairPlayV2Supported, isFairPlayV3Supported, isFlacSupported, isFullHDScreenSupported, isGifSupported, isH264BaselineSupported, isH264HighSupported, isH264MainSupported, isHDScreenSupported, isHeicSupported, isHeifSupported, isHevcMain10Supported, isHevcMainSupported, isHighDynamicRangeSupported, isHighVideoDynamicRangeSupported, isImageSupported, isJpegSupported, isJpegXlSupported, isMmsSupported, isMoreOrEqual, isMp3Supported, isMp4AudioSupported, isMpeg2TSupported, isMpegHAudioSupported, isMseSupported, isNativeHlsSupported, isNativeMpdSupported, isNativeMssSupported, isOpusSupported, isP3Supported, isPipSupported, isPlayReadySL150Supported, isPlayReadySL2000Supported, isPlayReadySL3000Supported, isPlayReadySupported, isPngSupported, isPrimetimeSupported, isRec2020Supported, isSDScreenSupported, isSrgbSupported, isStandalone, isSvgSupported, isTypeSupported, isVorbisSupported, isVp8Supported, isVp9Profile2Level110BitSupported, isVp9Supported, isVvcMain10Supported, isWebpSupported, isWideGamutSupported, isWidevineL1Supported, isWidevineL3Supported, isWidevineSupported, resetDefaultMediaElements }; |
@@ -1,2 +0,4 @@ | ||
export declare let defaultVideoElement: HTMLVideoElement; | ||
export declare function canPlayType(type: string): CanPlayTypeResult; | ||
export declare let defaultVideoElement: HTMLVideoElement | undefined; | ||
export declare let defaultAudioElement: HTMLAudioElement | undefined; | ||
export declare function resetDefaultMediaElements(): void; | ||
export declare function canPlayType(type: string, mediaElementType?: 'audio' | 'video'): CanPlayTypeResult; |
@@ -1,2 +0,2 @@ | ||
export declare function isContentTypeSupported(contentType: string): { | ||
export declare function isContentTypeSupported(contentType: string, mediaElementType?: 'audio' | 'video'): { | ||
canPlayType: CanPlayTypeResult; | ||
@@ -6,3 +6,4 @@ isTypeSupported: boolean; | ||
both: boolean; | ||
mediaElementType: "audio" | "video"; | ||
contentType: string; | ||
}; |
@@ -6,2 +6,3 @@ export declare function isVp8Supported(): { | ||
both: boolean; | ||
mediaElementType: "audio" | "video"; | ||
contentType: string; | ||
@@ -14,2 +15,3 @@ }; | ||
both: boolean; | ||
mediaElementType: "audio" | "video"; | ||
contentType: string; | ||
@@ -22,2 +24,3 @@ }; | ||
both: boolean; | ||
mediaElementType: "audio" | "video"; | ||
contentType: string; | ||
@@ -30,2 +33,3 @@ }; | ||
both: boolean; | ||
mediaElementType: "audio" | "video"; | ||
contentType: string; | ||
@@ -38,2 +42,3 @@ }; | ||
both: boolean; | ||
mediaElementType: "audio" | "video"; | ||
contentType: string; | ||
@@ -46,2 +51,3 @@ }; | ||
both: boolean; | ||
mediaElementType: "audio" | "video"; | ||
contentType: string; | ||
@@ -54,2 +60,3 @@ }; | ||
both: boolean; | ||
mediaElementType: "audio" | "video"; | ||
contentType: string; | ||
@@ -62,2 +69,3 @@ }; | ||
both: boolean; | ||
mediaElementType: "audio" | "video"; | ||
contentType: string; | ||
@@ -70,2 +78,3 @@ }; | ||
both: boolean; | ||
mediaElementType: "audio" | "video"; | ||
contentType: string; | ||
@@ -78,2 +87,3 @@ }; | ||
both: boolean; | ||
mediaElementType: "audio" | "video"; | ||
contentType: string; | ||
@@ -86,2 +96,3 @@ }; | ||
both: boolean; | ||
mediaElementType: "audio" | "video"; | ||
contentType: string; | ||
@@ -94,2 +105,3 @@ }; | ||
both: boolean; | ||
mediaElementType: "audio" | "video"; | ||
contentType: string; | ||
@@ -102,2 +114,3 @@ }; | ||
both: boolean; | ||
mediaElementType: "audio" | "video"; | ||
contentType: string; | ||
@@ -110,2 +123,3 @@ }; | ||
both: boolean; | ||
mediaElementType: "audio" | "video"; | ||
contentType: string; | ||
@@ -118,3 +132,4 @@ }; | ||
both: boolean; | ||
mediaElementType: "audio" | "video"; | ||
contentType: string; | ||
}; |
{ | ||
"name": "detect-audio-video", | ||
"version": "0.37.0", | ||
"version": "0.38.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
51290
1174