detect-audio-video
Advanced tools
Comparing version 0.15.0 to 0.16.0
@@ -1,13 +0,84 @@ | ||
export declare function isMp3Supported(): boolean; | ||
export declare function isAacSupported(): boolean; | ||
export declare function isDolbyDigitalSupported(): boolean; | ||
export declare function isDolbyDigitalPlusSupported(): boolean; | ||
export declare function isDolbyAtmosSupported(): boolean; | ||
export declare function isMpegHAudioSupported(): boolean; | ||
export declare function isVorbisSupported(): boolean; | ||
export declare function isFlacSupported(): boolean; | ||
export declare function isOpusSupported(): boolean; | ||
export declare function isDtsSupported(): boolean; | ||
export declare function isDtsHdSupported(): boolean; | ||
export declare function isDtsExpressSupported(): boolean; | ||
export declare function isDtsXSupported(): boolean; | ||
export declare function isMp3Supported(): { | ||
file: CanPlayTypeResult; | ||
mediaSource: boolean; | ||
any: boolean | "maybe" | "probably"; | ||
both: boolean | ""; | ||
}; | ||
export declare function isMp4AudioSupported(): { | ||
file: CanPlayTypeResult; | ||
mediaSource: boolean; | ||
any: boolean | "maybe" | "probably"; | ||
both: boolean | ""; | ||
}; | ||
export declare function isAacSupported(): { | ||
file: CanPlayTypeResult; | ||
mediaSource: boolean; | ||
any: boolean | "maybe" | "probably"; | ||
both: boolean | ""; | ||
}; | ||
export declare function isDolbyDigitalSupported(): { | ||
file: CanPlayTypeResult; | ||
mediaSource: boolean; | ||
any: boolean | "maybe" | "probably"; | ||
both: boolean | ""; | ||
}; | ||
export declare function isDolbyDigitalPlusSupported(): { | ||
file: CanPlayTypeResult; | ||
mediaSource: boolean; | ||
any: boolean | "maybe" | "probably"; | ||
both: boolean | ""; | ||
}; | ||
export declare function isDolbyAtmosSupported(): { | ||
file: CanPlayTypeResult; | ||
mediaSource: boolean; | ||
any: boolean | "maybe" | "probably"; | ||
both: boolean | ""; | ||
}; | ||
export declare function isMpegHAudioSupported(): { | ||
file: CanPlayTypeResult; | ||
mediaSource: boolean; | ||
any: boolean | "maybe" | "probably"; | ||
both: boolean | ""; | ||
}; | ||
export declare function isVorbisSupported(): { | ||
file: CanPlayTypeResult; | ||
mediaSource: boolean; | ||
any: boolean | "maybe" | "probably"; | ||
both: boolean | ""; | ||
}; | ||
export declare function isFlacSupported(): { | ||
file: CanPlayTypeResult; | ||
mediaSource: boolean; | ||
any: boolean | "maybe" | "probably"; | ||
both: boolean | ""; | ||
}; | ||
export declare function isOpusSupported(): { | ||
file: CanPlayTypeResult; | ||
mediaSource: boolean; | ||
any: boolean | "maybe" | "probably"; | ||
both: boolean | ""; | ||
}; | ||
export declare function isDtsSupported(): { | ||
file: CanPlayTypeResult; | ||
mediaSource: boolean; | ||
any: boolean | "maybe" | "probably"; | ||
both: boolean | ""; | ||
}; | ||
export declare function isDtsHdSupported(): { | ||
file: CanPlayTypeResult; | ||
mediaSource: boolean; | ||
any: boolean | "maybe" | "probably"; | ||
both: boolean | ""; | ||
}; | ||
export declare function isDtsExpressSupported(): { | ||
file: CanPlayTypeResult; | ||
mediaSource: boolean; | ||
any: boolean | "maybe" | "probably"; | ||
both: boolean | ""; | ||
}; | ||
export declare function isDtsXSupported(): { | ||
file: CanPlayTypeResult; | ||
mediaSource: boolean; | ||
any: boolean | "maybe" | "probably"; | ||
both: boolean | ""; | ||
}; |
@@ -10,2 +10,3 @@ export declare const AAC_CONTENT_TYPE = "audio/mp4; codecs=\"mp4a.40.2\""; | ||
export declare const MP3_CONTENT_TYPE = "audio/mpeg"; | ||
export declare const MP4_AUDIO_CONTENT_TYPE = "audio/mp4"; | ||
export declare const MPEG_H_AUDIO_LC_PROFILE_LEVEL_1_CONTENT_TYPE = "audio/mp4; codecs=\"mhm1.0x0B\""; | ||
@@ -12,0 +13,0 @@ export declare const MPEG_H_AUDIO_LC_PROFILE_LEVEL_2_CONTENT_TYPE = "audio/mp4; codecs=\"mhm1.0x0C\""; |
@@ -10,1 +10,2 @@ export declare const H264_BASELINE_CONTENT_TYPE = "video/mp4; codecs=\"avc1.42E01E\""; | ||
export declare const DOLBY_VISION_CONTENT_TYPE = "video/mp4; codecs=\"dvhe.08.09\""; | ||
export declare const MPEG2T_CONTENT_TYPE = "video/mp2t"; |
@@ -10,2 +10,3 @@ const AAC_CONTENT_TYPE = 'audio/mp4; codecs="mp4a.40.2"'; | ||
const MP3_CONTENT_TYPE = 'audio/mpeg'; | ||
const MP4_AUDIO_CONTENT_TYPE = 'audio/mp4'; | ||
const MPEG_H_AUDIO_LC_PROFILE_LEVEL_1_CONTENT_TYPE = 'audio/mp4; codecs="mhm1.0x0B"'; | ||
@@ -24,2 +25,12 @@ const MPEG_H_AUDIO_LC_PROFILE_LEVEL_2_CONTENT_TYPE = 'audio/mp4; codecs="mhm1.0x0C"'; | ||
let defaultVideoElement; | ||
function canPlayType(type) { | ||
if (!defaultVideoElement) { | ||
defaultVideoElement = document.createElement('video'); | ||
} | ||
return defaultVideoElement.canPlayType ? | ||
defaultVideoElement.canPlayType(type) : | ||
''; | ||
} | ||
function isTypeSupported(value) { | ||
@@ -37,40 +48,54 @@ if (!window.MediaSource) { | ||
function isContentTypeSupported(contentType) { | ||
const canPlayTypeResult = canPlayType(contentType); | ||
const isTypeSupportedResult = isTypeSupported(contentType); | ||
return { | ||
file: canPlayTypeResult, | ||
mediaSource: isTypeSupportedResult, | ||
any: canPlayTypeResult || isTypeSupportedResult, | ||
both: canPlayTypeResult && isTypeSupportedResult, | ||
}; | ||
} | ||
function isMp3Supported() { | ||
return isTypeSupported(MP3_CONTENT_TYPE); | ||
return isContentTypeSupported(MP3_CONTENT_TYPE); | ||
} | ||
function isMp4AudioSupported() { | ||
return isContentTypeSupported(MP4_AUDIO_CONTENT_TYPE); | ||
} | ||
function isAacSupported() { | ||
return isTypeSupported(AAC_CONTENT_TYPE); | ||
return isContentTypeSupported(AAC_CONTENT_TYPE); | ||
} | ||
function isDolbyDigitalSupported() { | ||
return isTypeSupported(DOLBY_AC3_CONTENT_TYPE); | ||
return isContentTypeSupported(DOLBY_AC3_CONTENT_TYPE); | ||
} | ||
function isDolbyDigitalPlusSupported() { | ||
return isTypeSupported(DOLBY_EC3_CONTENT_TYPE); | ||
return isContentTypeSupported(DOLBY_EC3_CONTENT_TYPE); | ||
} | ||
function isDolbyAtmosSupported() { | ||
return isTypeSupported(DOLBY_ATMOS_CONTENT_TYPE); | ||
return isContentTypeSupported(DOLBY_ATMOS_CONTENT_TYPE); | ||
} | ||
function isMpegHAudioSupported() { | ||
return isTypeSupported(MPEG_H_AUDIO_LC_PROFILE_LEVEL_3_CONTENT_TYPE); | ||
return isContentTypeSupported(MPEG_H_AUDIO_LC_PROFILE_LEVEL_3_CONTENT_TYPE); | ||
} | ||
function isVorbisSupported() { | ||
return isTypeSupported(VORBIS_CONTENT_TYPE); | ||
return isContentTypeSupported(VORBIS_CONTENT_TYPE); | ||
} | ||
function isFlacSupported() { | ||
return isTypeSupported(FLAC_CONTENT_TYPE); | ||
return isContentTypeSupported(FLAC_CONTENT_TYPE); | ||
} | ||
function isOpusSupported() { | ||
return isTypeSupported(OPUS_CONTENT_TYPE); | ||
return isContentTypeSupported(OPUS_CONTENT_TYPE); | ||
} | ||
function isDtsSupported() { | ||
return isTypeSupported(DTS_CORE_CONTENT_TYPE); | ||
return isContentTypeSupported(DTS_CORE_CONTENT_TYPE); | ||
} | ||
function isDtsHdSupported() { | ||
return isTypeSupported(DTS_HD_CORE_PLUS_EXTENSION_CONTENT_TYPE); | ||
return isContentTypeSupported(DTS_HD_CORE_PLUS_EXTENSION_CONTENT_TYPE); | ||
} | ||
function isDtsExpressSupported() { | ||
return isTypeSupported(DTS_HD_LBR_CONTENT_TYPE); | ||
return isContentTypeSupported(DTS_HD_LBR_CONTENT_TYPE); | ||
} | ||
function isDtsXSupported() { | ||
return isTypeSupported(DTS_UHD_PROFILE_2_CONTENT_TYPE); | ||
return isContentTypeSupported(DTS_UHD_PROFILE_2_CONTENT_TYPE); | ||
} | ||
@@ -87,30 +112,34 @@ | ||
const DOLBY_VISION_CONTENT_TYPE = 'video/mp4; codecs="dvhe.08.09"'; | ||
const MPEG2T_CONTENT_TYPE = 'video/mp2t'; | ||
function isVp8Supported() { | ||
return isTypeSupported(VP8_CONTENT_TYPE); | ||
return isContentTypeSupported(VP8_CONTENT_TYPE); | ||
} | ||
function isVp9Supported() { | ||
return isTypeSupported(VP9_CONTENT_TYPE); | ||
return isContentTypeSupported(VP9_CONTENT_TYPE); | ||
} | ||
function isH264BaselineSupported() { | ||
return isTypeSupported(H264_BASELINE_CONTENT_TYPE); | ||
return isContentTypeSupported(H264_BASELINE_CONTENT_TYPE); | ||
} | ||
function isH264MainSupported() { | ||
return isTypeSupported(H264_MAIN_CONTENT_TYPE); | ||
return isContentTypeSupported(H264_MAIN_CONTENT_TYPE); | ||
} | ||
function isH264HighSupported() { | ||
return isTypeSupported(H264_HIGH_CONTENT_TYPE); | ||
return isContentTypeSupported(H264_HIGH_CONTENT_TYPE); | ||
} | ||
function isAV1Supported() { | ||
return isTypeSupported(AV1_CONTENT_TYPE); | ||
return isContentTypeSupported(AV1_CONTENT_TYPE); | ||
} | ||
function isHevcMainSupported() { | ||
return isTypeSupported(HEVC_MAIN_CONTENT_TYPE); | ||
return isContentTypeSupported(HEVC_MAIN_CONTENT_TYPE); | ||
} | ||
function isHevcMain10Supported() { | ||
return isTypeSupported(HEVC_MAIN10_CONTENT_TYPE); | ||
return isContentTypeSupported(HEVC_MAIN10_CONTENT_TYPE); | ||
} | ||
function isDolbyVisionSupported() { | ||
return isTypeSupported(DOLBY_VISION_CONTENT_TYPE); | ||
return isContentTypeSupported(DOLBY_VISION_CONTENT_TYPE); | ||
} | ||
function isMpeg2TSupported() { | ||
return isContentTypeSupported(MPEG2T_CONTENT_TYPE); | ||
} | ||
@@ -124,12 +153,2 @@ const TTML_CONTENT_TYPE = 'application/ttml+xml'; | ||
let defaultVideoElement; | ||
function canPlayType(type) { | ||
if (!defaultVideoElement) { | ||
defaultVideoElement = document.createElement('video'); | ||
} | ||
return defaultVideoElement.canPlayType ? | ||
defaultVideoElement.canPlayType(type) : | ||
''; | ||
} | ||
function isNativeHlsSupported() { | ||
@@ -563,2 +582,2 @@ return canPlayType(HLS_CONTENT_TYPE) !== ''; | ||
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, 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, 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, HEVC_MAIN10_CONTENT_TYPE, HEVC_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, isDolbyVisionSupported, isDtsExpressSupported, isDtsHdSupported, isDtsSupported, isDtsXSupported, isEmeSupported, isFairPlaySupported, isFairPlayV1Supported, isFairPlayV2Supported, isFairPlayV3Supported, isFlacSupported, isFullHDScreenSupported, isH264BaselineSupported, isH264HighSupported, isH264MainSupported, isHDScreenSupported, isHdrScreenSupported, isHevcMain10Supported, isHevcMainSupported, 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, 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, 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, HEVC_MAIN10_CONTENT_TYPE, HEVC_MAIN_CONTENT_TYPE, HLS_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, 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, isContentTypeSupported, isDolbyAtmosSupported, isDolbyDigitalPlusSupported, isDolbyDigitalSupported, isDolbyVisionSupported, isDtsExpressSupported, isDtsHdSupported, isDtsSupported, isDtsXSupported, isEmeSupported, isFairPlaySupported, isFairPlayV1Supported, isFairPlayV2Supported, isFairPlayV3Supported, isFlacSupported, isFullHDScreenSupported, isH264BaselineSupported, isH264HighSupported, isH264MainSupported, isHDScreenSupported, isHdrScreenSupported, isHevcMain10Supported, isHevcMainSupported, isMmsSupported, isMp3Supported, isMp4AudioSupported, isMpeg2TSupported, isMpegHAudioSupported, isMseSupported, isNativeHlsSupported, isNativeMpdSupported, isNativeMssSupported, isOpusSupported, isPlayReadySL150Supported, isPlayReadySL2000Supported, isPlayReadySL3000Supported, isPlayReadySupported, isPrimetimeSupported, isSDScreenSupported, isTypeSupported, isVorbisSupported, isVp8Supported, isVp9Supported, isWidevineL1Supported, isWidevineL3Supported, isWidevineSupported }; |
export * from './canPlayType'; | ||
export * from './isTypeSupported'; | ||
export * from './isContentTypeSupported'; |
@@ -1,9 +0,60 @@ | ||
export declare function isVp8Supported(): boolean; | ||
export declare function isVp9Supported(): boolean; | ||
export declare function isH264BaselineSupported(): boolean; | ||
export declare function isH264MainSupported(): boolean; | ||
export declare function isH264HighSupported(): boolean; | ||
export declare function isAV1Supported(): boolean; | ||
export declare function isHevcMainSupported(): boolean; | ||
export declare function isHevcMain10Supported(): boolean; | ||
export declare function isDolbyVisionSupported(): boolean; | ||
export declare function isVp8Supported(): { | ||
file: CanPlayTypeResult; | ||
mediaSource: boolean; | ||
any: boolean | "maybe" | "probably"; | ||
both: boolean | ""; | ||
}; | ||
export declare function isVp9Supported(): { | ||
file: CanPlayTypeResult; | ||
mediaSource: boolean; | ||
any: boolean | "maybe" | "probably"; | ||
both: boolean | ""; | ||
}; | ||
export declare function isH264BaselineSupported(): { | ||
file: CanPlayTypeResult; | ||
mediaSource: boolean; | ||
any: boolean | "maybe" | "probably"; | ||
both: boolean | ""; | ||
}; | ||
export declare function isH264MainSupported(): { | ||
file: CanPlayTypeResult; | ||
mediaSource: boolean; | ||
any: boolean | "maybe" | "probably"; | ||
both: boolean | ""; | ||
}; | ||
export declare function isH264HighSupported(): { | ||
file: CanPlayTypeResult; | ||
mediaSource: boolean; | ||
any: boolean | "maybe" | "probably"; | ||
both: boolean | ""; | ||
}; | ||
export declare function isAV1Supported(): { | ||
file: CanPlayTypeResult; | ||
mediaSource: boolean; | ||
any: boolean | "maybe" | "probably"; | ||
both: boolean | ""; | ||
}; | ||
export declare function isHevcMainSupported(): { | ||
file: CanPlayTypeResult; | ||
mediaSource: boolean; | ||
any: boolean | "maybe" | "probably"; | ||
both: boolean | ""; | ||
}; | ||
export declare function isHevcMain10Supported(): { | ||
file: CanPlayTypeResult; | ||
mediaSource: boolean; | ||
any: boolean | "maybe" | "probably"; | ||
both: boolean | ""; | ||
}; | ||
export declare function isDolbyVisionSupported(): { | ||
file: CanPlayTypeResult; | ||
mediaSource: boolean; | ||
any: boolean | "maybe" | "probably"; | ||
both: boolean | ""; | ||
}; | ||
export declare function isMpeg2TSupported(): { | ||
file: CanPlayTypeResult; | ||
mediaSource: boolean; | ||
any: boolean | "maybe" | "probably"; | ||
both: boolean | ""; | ||
}; |
{ | ||
"name": "detect-audio-video", | ||
"version": "0.15.0", | ||
"version": "0.16.0", | ||
"description": "Detect audio video features", | ||
@@ -5,0 +5,0 @@ "module": "dist/index.js", |
34826
28
832