Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

detect-audio-video

Package Overview
Dependencies
Maintainers
1
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

detect-audio-video - npm Package Compare versions

Comparing version 1.1.2 to 1.2.0

dist/device/isChromium.d.ts

5

dist/device/index.d.ts

@@ -1,1 +0,4 @@

export * from './getIsMobile';
export * from './isMobile';
export * from './isFirefox';
export * from './getFirefoxVersion';
export * from './isChromium';

1

dist/gpu.d.ts
export declare function getGpuVendor(): any;
export declare function getGpuRenderer(): string;
export declare function hasHardwareAcceleration(): Promise<boolean | undefined>;

@@ -31,2 +31,14 @@ const AAC_CONTENT_TYPE = 'audio/mp4; codecs="mp4a.40.2"';

}
function getDefaultAudioElement() {
if (!defaultAudioElement) {
defaultAudioElement = document.createElement('audio');
}
return defaultAudioElement;
}
function getDefaultVideoElement() {
if (!defaultVideoElement) {
defaultVideoElement = document.createElement('video');
}
return defaultVideoElement;
}
function canPlayType(type) {

@@ -36,12 +48,6 @@ let mediaElement;

if (mediaElementType === 'audio') {
if (!defaultAudioElement) {
defaultAudioElement = document.createElement('video');
}
mediaElement = defaultAudioElement;
mediaElement = getDefaultAudioElement();
}
else {
if (!defaultVideoElement) {
defaultVideoElement = document.createElement('video');
}
mediaElement = defaultVideoElement;
mediaElement = getDefaultVideoElement();
}

@@ -278,6 +284,20 @@ return mediaElement.canPlayType ?

// https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_detection_using_the_user_agent#Mobile_Tablet_or_Desktop
function getIsMobile() {
function isMobile() {
return /Mobi|Android/i.test(window.navigator.userAgent);
}
function isFirefox() {
return /firefox/.test(window.navigator.userAgent.toLowerCase());
}
function getFirefoxVersion() {
const match = navigator.userAgent.match(/Firefox\/([0-9]+)\./);
return match ? (parseInt(match[1], 10) || -1) : -1;
}
function isChromium() {
// @ts-ignore
return Boolean(window.chrome);
}
const TTML_CONTENT_TYPE = 'application/ttml+xml';

@@ -582,2 +602,17 @@ const WEBVTT_CONTENT_TYPE = 'text/vtt';

}
function hasHardwareAcceleration() {
if (!isChromium() || !navigator.mediaCapabilities || !navigator.mediaCapabilities.decodingInfo) {
return Promise.resolve(undefined);
}
return navigator.mediaCapabilities.decodingInfo({
type: 'file',
video: {
contentType: H264_BASELINE_CONTENT_TYPE,
width: 800,
height: 600,
bitrate: 100000,
framerate: 30,
}
}).then(result => result.powerEfficient).catch(() => undefined);
}

@@ -768,11 +803,2 @@ const FAIRPLAY_KEY_SYSTEM = 'com.apple.fps';

function getFirefoxVersion() {
const match = navigator.userAgent.match(/Firefox\/([0-9]+)\./);
return match ? (parseInt(match[1], 10) || -1) : -1;
}
function isFirefox() {
return /firefox/.test(window.navigator.userAgent.toLowerCase());
}
function isPipSupported() {

@@ -799,2 +825,2 @@ if (isFirefox() && getFirefoxVersion() >= 69) {

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, defaultAudioElement, defaultVideoElement, getDevicePixelRatio, getGpuRenderer, getGpuVendor, getIsMobile, getResolutionBadge, getScreenDepth, getScreenHeight, getScreenWidth, is10KScreenSupported, is16KScreenSupported, is2KScreenSupported, is2dot5KScreenSupported, is32KScreenSupported, is3KScreenSupported, is4KScreenSupported, is5KScreenSupported, is6KScreenSupported, is8KScreenSupported, isAPngSupported, isAV1Main10Supported, isAV1Supported, isAacSupported, isAlacSupported, 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 };
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, defaultAudioElement, defaultVideoElement, getDefaultAudioElement, getDefaultVideoElement, getDevicePixelRatio, getFirefoxVersion, getGpuRenderer, getGpuVendor, getResolutionBadge, getScreenDepth, getScreenHeight, getScreenWidth, hasHardwareAcceleration, is10KScreenSupported, is16KScreenSupported, is2KScreenSupported, is2dot5KScreenSupported, is32KScreenSupported, is3KScreenSupported, is4KScreenSupported, is5KScreenSupported, is6KScreenSupported, is8KScreenSupported, isAPngSupported, isAV1Main10Supported, isAV1Supported, isAacSupported, isAlacSupported, isAvifSupported, isCastToAirPlaySupported, isChromium, isClearKeySupported, isContentTypeSupported, 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, isImageSupported, isJpegSupported, isJpegXlSupported, isMmsSupported, isMobile, 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 };
export declare let defaultVideoElement: HTMLVideoElement | undefined;
export declare let defaultAudioElement: HTMLAudioElement | undefined;
export declare function resetDefaultMediaElements(): void;
export declare function getDefaultAudioElement(): HTMLAudioElement;
export declare function getDefaultVideoElement(): HTMLVideoElement;
export declare function canPlayType(type: string): CanPlayTypeResult;
{
"name": "detect-audio-video",
"version": "1.1.2",
"version": "1.2.0",
"description": "Detect audio and video features in browser",

@@ -5,0 +5,0 @@ "module": "dist/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc