detect-audio-video
Advanced tools
Comparing version 3.0.0 to 3.1.0
@@ -10,1 +10,2 @@ export * from './isAndroid'; | ||
export * from './isChromium'; | ||
export * from './isPlayStation'; |
@@ -144,3 +144,11 @@ const AAC_CONTENT_TYPE = 'audio/mp4; codecs="mp4a.40.2"'; | ||
} | ||
}).then(data => resolve(data.supported)).catch(() => resolve(false)); | ||
}).then(data => { | ||
var _a, _b; | ||
const supported = Boolean(data.supported && | ||
( | ||
// Fix for old Safari without Dolby Atmos | ||
// @ts-ignore | ||
(_b = (_a = data.supportedConfiguration) === null || _a === void 0 ? void 0 : _a.audio) === null || _b === void 0 ? void 0 : _b.spatialRendering)); | ||
resolve(supported); | ||
}).catch(() => resolve(false)); | ||
} | ||
@@ -362,2 +370,18 @@ else { | ||
function isPlayStationVita() { | ||
return /PlayStation Vita/i.test(navigator.userAgent); | ||
} | ||
function isPlayStation3() { | ||
return /PlayStation 3/i.test(navigator.userAgent); | ||
} | ||
function isPlayStation4() { | ||
return /PlayStation 4/i.test(navigator.userAgent); | ||
} | ||
function isPlayStation5() { | ||
return /PlayStation 5/i.test(navigator.userAgent); | ||
} | ||
function isPlayStation6() { | ||
return /PlayStation 6/i.test(navigator.userAgent); | ||
} | ||
const TTML_CONTENT_TYPE = 'application/ttml+xml'; | ||
@@ -935,2 +959,2 @@ const WEBVTT_CONTENT_TYPE = 'text/vtt'; | ||
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 }; | ||
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, isPlayStation3, isPlayStation4, isPlayStation5, isPlayStation6, isPlayStationVita, isPngSupported, isPrimetimeSupported, isRec2020Supported, isRemotePlaybackApiSupported, isSDScreenSupported, isSafari, isSrgbSupported, isStandalone, isSvgSupported, isTypeSupported, isVorbisSupported, isVp8Supported, isVp9Profile2Level110BitSupported, isVp9Supported, isVvcMain10Supported, isWebRTCSupported, isWebpSupported, isWideGamutSupported, isWidevineL1Supported, isWidevineL3Supported, isWidevineSupported, parseGamepadName, resetDefaultMediaElements }; |
{ | ||
"name": "detect-audio-video", | ||
"version": "3.0.0", | ||
"version": "3.1.0", | ||
"description": "Detect audio and video features in browser", | ||
@@ -14,4 +14,4 @@ "module": "dist/index.js", | ||
"scripts": { | ||
"clean": "del dist/*; del example/build/*", | ||
"test": "npm run typecheck && jest ", | ||
"clean": "del dist/*", | ||
"test": "npm run typecheck && jest", | ||
"typecheck": "tsc --noEmit", | ||
@@ -59,3 +59,6 @@ "build": "npm run clean; rollup -c", | ||
"hdr", | ||
"dolby" | ||
"dolby", | ||
"wide gamut", | ||
"gpu", | ||
"codec" | ||
], | ||
@@ -62,0 +65,0 @@ "files": [ |
@@ -10,5 +10,8 @@ # detect-audio-video | ||
## Install | ||
`npm i --save-dev detect-audio-video` | ||
## Features | ||
### 🖥️ Screen | ||
### 🖥️ [Screen](https://checkdevice.online/en/screen/) | ||
- Size | ||
@@ -21,7 +24,21 @@ - Device pixel ratio | ||
### ⚙️ GPU | ||
### ⚙️ [GPU](https://checkdevice.online/en/gpu/) | ||
- Vendor | ||
- Renderer | ||
### 🔒 DRM | ||
```js | ||
import { | ||
getGpuVendor, | ||
getGpuRenderer, | ||
hasHardwareAcceleration, | ||
isAppleSilicon, | ||
} from 'detect-audio-video'; | ||
console.log('getGpuVendor: ', getGpuVendor()); // string, example: "Apple" | ||
console.log('getGpuRenderer: ', getGpuRenderer()); // string, example: "Apple M1, or similar" | ||
console.log('hasHardwareAcceleration: ', hasHardwareAcceleration()); // boolean | ||
console.log('isAppleSilicon: ', isAppleSilicon()); // boolean | ||
``` | ||
### 🔒 [DRM](https://checkdevice.online/en/video/) | ||
- Microsoft PlayReady SL150, SL2000, SL3000 | ||
@@ -38,3 +55,15 @@ - Google Widevine Modular L1, L3 | ||
### ⏯ HTMLVideoElement features | ||
```js | ||
import { | ||
isNativeHlsSupported, | ||
isNativeMpdSupported, | ||
isNativeMssSupported, | ||
} from 'detect-audio-video'; | ||
console.log('isNativeMssSupported: ', isNativeMssSupported()); // boolean | ||
console.log('isNativeHlsSupported: ', isNativeHlsSupported()); // boolean | ||
console.log('isNativeMpdSupported: ', isNativeMpdSupported()); // boolean | ||
``` | ||
### ⏯ [HTMLVideoElement features](https://checkdevice.online/en/video/) | ||
- Media Source Extensions | ||
@@ -49,3 +78,3 @@ - Media Source Extensions in Workers | ||
### 📹 Video codecs | ||
### 📹 [Video codecs](https://checkdevice.online/en/video/) | ||
- H.264 | ||
@@ -60,3 +89,3 @@ - H.265 (HEVC) | ||
### 🔊 Audio codecs | ||
### 🔊 [Audio codecs](https://checkdevice.online/en/audio/) | ||
- AAC | ||
@@ -71,3 +100,3 @@ - Opus | ||
### 🖼️ Image formats | ||
### 🖼️ [Image formats](https://checkdevice.online/en/video/) | ||
- GIF | ||
@@ -83,22 +112,12 @@ - PNG | ||
### 🕍 Platform | ||
### 🕍 [Platform](https://checkdevice.online/en/platform/) | ||
- Standalone | ||
### ✨ WebRTC | ||
### ✨ [WebRTC](https://checkdevice.online/en/webrtc/) | ||
- Support | ||
- Audio and video codecs | ||
### 🎮 Gamepad | ||
### 🎮 [Gamepad](https://checkdevice.online/en/gamepad/) | ||
- Parser for gamepad name | ||
## Install | ||
`npm i --save-dev detect-audio-video` | ||
## Using | ||
```js | ||
import { isAacSupported } from 'detect-audio-video'; | ||
console.log('AAC supported', isAacSupported()); | ||
``` | ||
## Links | ||
@@ -105,0 +124,0 @@ - [Check device online](https://checkdevice.online/en/video/) |
Sorry, the diff of this file is not supported yet
64394
60
1457
123