detect-audio-video
Advanced tools
Comparing version 2.9.1 to 3.0.0
@@ -46,3 +46,3 @@ declare global { | ||
}; | ||
export declare function isDolbyAtmosSupported(): boolean; | ||
export declare function isDolbyAtmosSupported(): Promise<boolean>; | ||
export declare function isMpegHAudioSupported(): { | ||
@@ -49,0 +49,0 @@ canPlayType: CanPlayTypeResult; |
export * from './isAndroid'; | ||
export * from './isIOS'; | ||
export * from './isSafari'; | ||
export * from './isDesktopSafari'; | ||
export * from './getAndroidVersion'; | ||
@@ -4,0 +6,0 @@ export * from './isMobile'; |
@@ -25,2 +25,7 @@ const AAC_CONTENT_TYPE = 'audio/mp4; codecs="mp4a.40.2"'; | ||
function isSafari() { | ||
const { userAgent } = navigator; | ||
return userAgent.indexOf('Safari') > -1 && userAgent.indexOf('Chrome') === -1; | ||
} | ||
const isSsr = typeof window === 'undefined'; | ||
@@ -110,23 +115,38 @@ | ||
} | ||
// audio/mp4; codecs="ec-3"; spatialRendering=true - no support | ||
function isDolbyAtmosSupported() { | ||
var _a, _b, _c; | ||
if (isSsr) { | ||
return false; | ||
} | ||
// @ts-ignore | ||
const cast = window.cast; | ||
// Chromecast | ||
if (cast) { | ||
return Boolean((_c = (_b = (_a = cast.framework) === null || _a === void 0 ? void 0 : _a.system) === null || _b === void 0 ? void 0 : _b.DeviceCapabilities) === null || _c === void 0 ? void 0 : _c.IS_DOLBY_ATMOS_SUPPORTED); | ||
} | ||
let result = false; | ||
// Hisense VIDAA | ||
if (window.Hisense_GetSupportForDolbyAtmos) { | ||
try { | ||
result = window.Hisense_GetSupportForDolbyAtmos(); | ||
return new Promise(resolve => { | ||
if (isSsr) { | ||
return resolve(false); | ||
} | ||
catch (e) { } | ||
} | ||
return result; | ||
// @ts-ignore | ||
const cast = window.cast; | ||
// Chromecast | ||
if (cast) { | ||
// 'audio/mp4; codecs="ec-3"; spatialRendering=true' - support only on Chromecast | ||
return resolve(MediaSource.isTypeSupported(DOLBY_ATMOS_CONTENT_TYPE)); | ||
} | ||
// Hisense VIDAA | ||
if (window.Hisense_GetSupportForDolbyAtmos) { | ||
let result = false; | ||
try { | ||
result = window.Hisense_GetSupportForDolbyAtmos(); | ||
} | ||
catch (e) { } | ||
return resolve(result); | ||
} | ||
// https://webapi.streaming.dolby.com/v0_9/help_files/topics/checking_immersive_capability.html | ||
if (isSafari() && navigator.mediaCapabilities) { | ||
navigator.mediaCapabilities.decodingInfo({ | ||
type: 'media-source', | ||
audio: { | ||
contentType: DOLBY_EC3_CONTENT_TYPE, | ||
channels: '16', | ||
spatialRendering: true | ||
} | ||
}).then(data => resolve(data.supported)).catch(() => resolve(false)); | ||
} | ||
else { | ||
resolve(false); | ||
} | ||
}); | ||
} | ||
@@ -311,2 +331,11 @@ function isMpegHAudioSupported() { | ||
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_detection_using_the_user_agent#Mobile_Tablet_or_Desktop | ||
function isMobile() { | ||
return /Mobi|Android/i.test(navigator.userAgent); | ||
} | ||
function isDesktopSafari() { | ||
return isSafari() && !isMobile(); | ||
} | ||
function getAndroidVersion() { | ||
@@ -321,7 +350,2 @@ const version = getAndroidVersionAsString(); | ||
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_detection_using_the_user_agent#Mobile_Tablet_or_Desktop | ||
function isMobile() { | ||
return /Mobi|Android/i.test(navigator.userAgent); | ||
} | ||
function isFirefox() { | ||
@@ -913,2 +937,2 @@ return /firefox/.test(navigator.userAgent.toLowerCase()); | ||
export { AAC_CONTENT_TYPE, ALAC_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, defaultAudioCapabilites, defaultAudioElement, defaultVideoCapabilites, defaultVideoElement, encryptionSchemes, getAndroidVersion, getAndroidVersionAsString, getDefaultAudioElement, getDefaultVideoElement, getDevicePixelRatio, getFirefoxVersion, getGpuRenderer, getGpuVendor, getResolutionBadge, getScreenDepth, getScreenHeight, getScreenWidth, getWebRTCAudioCodecs, getWebRTCVideoCodecs, hasHardwareAcceleration, initDataTypes, is10KScreenSupported, is16KScreenSupported, is2KScreenSupported, is2dot5KScreenSupported, is32KScreenSupported, is3KScreenSupported, is4KScreenSupported, is4dot5KScreenSupported, is5KScreenSupported, is6KScreenSupported, is8KScreenSupported, isAPngSupported, isAV1Main10Supported, isAV1Supported, isAacSupported, isAlacSupported, isAndroid, isAppleSilicon, isAvifSupported, isCastToAirPlaySupported, isChromium, isClearKeySupported, isContentTypeSupported, isDocumentPipSupported, isDolbyAtmosSupported, isDolbyDigitalPlusSupported, isDolbyDigitalSupported, isDolbyVisionSupported, isDtsExpressSupported, isDtsHdSupported, isDtsSupported, isDtsXSupported, isEmeSupported, isEvcBaselineSupported, isEvcMainSupported, isFairPlaySupported, isFairPlayV1Supported, isFairPlayV2Supported, isFairPlayV3Supported, isFirefox, isFlacSupported, isFullHDScreenSupported, isGifSupported, isH264BaselineSupported, isH264HighSupported, isH264MainSupported, isHDScreenSupported, isHeicSupported, isHeifSupported, isHevcMain10Supported, isHevcMainSupported, isHighDynamicRangeSupported, isHighVideoDynamicRangeSupported, isIOS, isImageSupported, isJpegSupported, isJpegXlSupported, isMmsInWorkersSupported, isMmsSupported, isMobile, isMoreOrEqual, isMp3Supported, isMp4AudioSupported, isMpeg2TSupported, isMpegHAudioSupported, isMseInWorkersSupported, isMseSupported, isNativeHlsSupported, isNativeMpdSupported, isNativeMssSupported, isOpusSupported, isP3Supported, isPipSupported, isPlayReadySL150Supported, isPlayReadySL2000Supported, isPlayReadySL3000Supported, isPlayReadySupported, isPngSupported, isPrimetimeSupported, isRec2020Supported, isRemotePlaybackApiSupported, isSDScreenSupported, isSrgbSupported, isStandalone, isSvgSupported, isTypeSupported, isVorbisSupported, isVp8Supported, isVp9Profile2Level110BitSupported, isVp9Supported, isVvcMain10Supported, isWebRTCSupported, isWebpSupported, isWideGamutSupported, isWidevineL1Supported, isWidevineL3Supported, isWidevineSupported, parseGamepadName, resetDefaultMediaElements }; | ||
export { AAC_CONTENT_TYPE, ALAC_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, defaultAudioCapabilites, defaultAudioElement, defaultVideoCapabilites, defaultVideoElement, encryptionSchemes, getAndroidVersion, getAndroidVersionAsString, getDefaultAudioElement, getDefaultVideoElement, getDevicePixelRatio, getFirefoxVersion, getGpuRenderer, getGpuVendor, getResolutionBadge, getScreenDepth, getScreenHeight, getScreenWidth, getWebRTCAudioCodecs, getWebRTCVideoCodecs, hasHardwareAcceleration, initDataTypes, is10KScreenSupported, is16KScreenSupported, is2KScreenSupported, is2dot5KScreenSupported, is32KScreenSupported, is3KScreenSupported, is4KScreenSupported, is4dot5KScreenSupported, is5KScreenSupported, is6KScreenSupported, is8KScreenSupported, isAPngSupported, isAV1Main10Supported, isAV1Supported, isAacSupported, isAlacSupported, isAndroid, isAppleSilicon, isAvifSupported, isCastToAirPlaySupported, isChromium, isClearKeySupported, isContentTypeSupported, isDesktopSafari, isDocumentPipSupported, isDolbyAtmosSupported, isDolbyDigitalPlusSupported, isDolbyDigitalSupported, isDolbyVisionSupported, isDtsExpressSupported, isDtsHdSupported, isDtsSupported, isDtsXSupported, isEmeSupported, isEvcBaselineSupported, isEvcMainSupported, isFairPlaySupported, isFairPlayV1Supported, isFairPlayV2Supported, isFairPlayV3Supported, isFirefox, isFlacSupported, isFullHDScreenSupported, isGifSupported, isH264BaselineSupported, isH264HighSupported, isH264MainSupported, isHDScreenSupported, isHeicSupported, isHeifSupported, isHevcMain10Supported, isHevcMainSupported, isHighDynamicRangeSupported, isHighVideoDynamicRangeSupported, isIOS, isImageSupported, isJpegSupported, isJpegXlSupported, isMmsInWorkersSupported, isMmsSupported, isMobile, isMoreOrEqual, isMp3Supported, isMp4AudioSupported, isMpeg2TSupported, isMpegHAudioSupported, isMseInWorkersSupported, isMseSupported, isNativeHlsSupported, isNativeMpdSupported, isNativeMssSupported, isOpusSupported, isP3Supported, isPipSupported, isPlayReadySL150Supported, isPlayReadySL2000Supported, isPlayReadySL3000Supported, isPlayReadySupported, isPngSupported, isPrimetimeSupported, isRec2020Supported, isRemotePlaybackApiSupported, isSDScreenSupported, isSafari, isSrgbSupported, isStandalone, isSvgSupported, isTypeSupported, isVorbisSupported, isVp8Supported, isVp9Profile2Level110BitSupported, isVp9Supported, isVvcMain10Supported, isWebRTCSupported, isWebpSupported, isWideGamutSupported, isWidevineL1Supported, isWidevineL3Supported, isWidevineSupported, parseGamepadName, resetDefaultMediaElements }; |
@@ -19,3 +19,3 @@ export declare function getDevicePixelRatio(): number; | ||
export declare function isMoreOrEqual(sizes: number[][], width: number, height: number): boolean; | ||
export declare function checkSize(sizes: number[][], width: number, height: number): 0 | 1 | -1; | ||
export declare function checkSize(sizes: number[][], width: number, height: number): 1 | -1 | 0; | ||
export declare function getResolutionBadge(width?: number, height?: number): string; |
{ | ||
"name": "detect-audio-video", | ||
"version": "2.9.1", | ||
"version": "3.0.0", | ||
"description": "Detect audio and video features in browser", | ||
@@ -27,3 +27,3 @@ "module": "dist/index.js", | ||
"devDependencies": { | ||
"@rollup/plugin-node-resolve": "^15.3.0", | ||
"@rollup/plugin-node-resolve": "^16.0.0", | ||
"@rollup/plugin-typescript": "^12.1.2", | ||
@@ -34,3 +34,3 @@ "@types/jest": "^29.5.14", | ||
"jest-environment-jsdom": "^29.7.0", | ||
"rollup": "^4.28.1", | ||
"rollup": "^4.29.1", | ||
"ts-jest": "^29.2.5", | ||
@@ -37,0 +37,0 @@ "tslib": "^2.8.1", |
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
62096
59
1428