detect-audio-video
Advanced tools
Comparing version 0.8.1 to 0.9.0
export * from './audio'; | ||
export * from './video'; | ||
export * from './stream'; | ||
export * from './screen'; | ||
@@ -4,0 +5,0 @@ export * from './gpu'; |
@@ -93,2 +93,29 @@ const AAC_CONTENT_TYPE = 'audio/mp4; codecs="mp4a.40.2"'; | ||
const TTML_CONTENT_TYPE = 'application/ttml+xml'; | ||
const WEBVTT_CONTENT_TYPE = 'text/vtt'; | ||
const MPD_CONTENT_TYPE = 'application/dash+xml'; | ||
const HLS_CONTENT_TYPE = 'application/vnd.apple.mpegurl'; | ||
const MSS_CONTENT_TYPE = 'application/vnd.ms-sstr+xml'; | ||
let defaultVideoElement; | ||
function canPlayType(type) { | ||
if (!defaultVideoElement) { | ||
defaultVideoElement = document.createElement('video'); | ||
} | ||
return defaultVideoElement.canPlayType ? | ||
defaultVideoElement.canPlayType(type) : | ||
''; | ||
} | ||
function isNativeHlsSupported() { | ||
return canPlayType(HLS_CONTENT_TYPE) !== ''; | ||
} | ||
function isNativeMpdSupported() { | ||
return canPlayType(MPD_CONTENT_TYPE) !== ''; | ||
} | ||
function isNativeMssSupported() { | ||
return canPlayType(MSS_CONTENT_TYPE) !== ''; | ||
} | ||
function getDevicePixelRatio() { | ||
@@ -172,3 +199,3 @@ return window.devicePixelRatio || 1; | ||
} | ||
function getScreenBadge(width = getScreenWidth()) { | ||
function getResolutionBadge(width = getScreenWidth()) { | ||
const sizes = [ | ||
@@ -231,2 +258,27 @@ { | ||
} | ||
function getResolutionMode(height = getScreenHeight()) { | ||
const heights = [ | ||
240, | ||
360, | ||
480, | ||
576, | ||
720, | ||
768, | ||
1080, | ||
1440, | ||
2160, | ||
4320, | ||
8640, | ||
]; | ||
let result = heights[0]; | ||
for (const item of heights) { | ||
if (height >= item) { | ||
result = item; | ||
} | ||
else { | ||
break; | ||
} | ||
} | ||
return `${result}p`; | ||
} | ||
@@ -458,19 +510,2 @@ function getGpuVendor() { | ||
const TTML_CONTENT_TYPE = 'application/ttml+xml'; | ||
const WEBVTT_CONTENT_TYPE = 'text/vtt'; | ||
const MPD_CONTENT_TYPE = 'application/dash+xml'; | ||
const HLS_CONTENT_TYPE = 'application/vnd.apple.mpegurl'; | ||
const MSS_CONTENT_TYPE = 'application/vnd.ms-sstr+xml'; | ||
let defaultVideoElement; | ||
function canPlayType(type) { | ||
if (!defaultVideoElement) { | ||
defaultVideoElement = document.createElement('video'); | ||
} | ||
return defaultVideoElement.canPlayType ? | ||
defaultVideoElement.canPlayType(type) : | ||
''; | ||
} | ||
export { AAC_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, 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, getScreenBadge, getScreenDepth, getScreenHeight, getScreenWidth, is10KScreenSupported, is16KScreenSupported, is2KScreenSupported, is2dot5KScreenSupported, is4KScreenSupported, is5KScreenSupported, is6KScreenSupported, is8KScreenSupported, isAacSupported, isClearKeySupported, isDolbyAtmosSupported, isDolbyDigitalPlusSupported, isDolbyDigitalSupported, isDtsExpressSupported, isDtsHdSupported, isDtsSupported, isDtsXSupported, isFairPlaySupported, isFairPlayV1Supported, isFairPlayV2Supported, isFairPlayV3Supported, isFlacSupported, isFullHDScreenSupported, isH264BaselineSupported, isH264HighSupported, isH264MainSupported, isHDScreenSupported, isHdrScreenSupported, isMpegHAudioSupported, isOpusSupported, isPlayReadySL150Supported, isPlayReadySL2000Supported, isPlayReadySL3000Supported, isPlayReadySupported, isPrimetimeSupported, isSDScreenSupported, isTypeSupported, isVorbisSupported, isVp8Supported, isVp9Supported, isWidevineL1Supported, isWidevineL3Supported, isWidevineSupported }; | ||
export { AAC_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, 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, isAacSupported, isClearKeySupported, isDolbyAtmosSupported, isDolbyDigitalPlusSupported, isDolbyDigitalSupported, isDtsExpressSupported, isDtsHdSupported, isDtsSupported, isDtsXSupported, isFairPlaySupported, isFairPlayV1Supported, isFairPlayV2Supported, isFairPlayV3Supported, isFlacSupported, isFullHDScreenSupported, isH264BaselineSupported, isH264HighSupported, isH264MainSupported, isHDScreenSupported, isHdrScreenSupported, isMpegHAudioSupported, isNativeHlsSupported, isNativeMpdSupported, isNativeMssSupported, isOpusSupported, isPlayReadySL150Supported, isPlayReadySL2000Supported, isPlayReadySL3000Supported, isPlayReadySupported, isPrimetimeSupported, isSDScreenSupported, isTypeSupported, isVorbisSupported, isVp8Supported, isVp9Supported, isWidevineL1Supported, isWidevineL3Supported, isWidevineSupported }; |
@@ -17,2 +17,3 @@ export declare function getDevicePixelRatio(): number; | ||
export declare function isSDScreenSupported(): boolean; | ||
export declare function getScreenBadge(width?: number): string | undefined; | ||
export declare function getResolutionBadge(width?: number): string | undefined; | ||
export declare function getResolutionMode(height?: number): string; |
{ | ||
"name": "detect-audio-video", | ||
"version": "0.8.1", | ||
"version": "0.9.0", | ||
"description": "Detect audio video features", | ||
@@ -5,0 +5,0 @@ "module": "dist/index.js", |
@@ -12,5 +12,14 @@ # detect-audio-video | ||
- Support for media formats | ||
- Availability of HDR support | ||
- Screen size | ||
- DRM types | ||
- Screen | ||
+ Name | ||
+ Size | ||
+ Aspect ratio | ||
+ HDR support | ||
+ Device pixel ratio | ||
+ [ScreenDetails](https://developer.mozilla.org/en-US/docs/Web/API/ScreenDetails): primary, internal and etc. | ||
- DRM | ||
+ Microsoft PlayReady | ||
+ Google Widevine Modular | ||
+ Apple FairPlay | ||
+ Adobe Primetime | ||
@@ -17,0 +26,0 @@ ## Install |
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
27264
26
612
37