UNPKG

detect-audio-video

Version:

Detect audio and video features in browser

1,080 lines (1,035 loc) 45 kB
const AAC_CONTENT_TYPE = 'audio/mp4; codecs="mp4a.40.2"'; const DOLBY_AC3_CONTENT_TYPE = 'audio/mp4; codecs="ac-3"'; const DOLBY_EC3_CONTENT_TYPE = 'audio/mp4; codecs="ec-3"'; const DOLBY_AC4_CONTENT_TYPE = 'audio/mp4; codecs="ac-4"'; const DOLBY_ATMOS_CONTENT_TYPE = 'audio/mp4; codecs="ec-3"; spatialRendering=true'; const OPUS_CONTENT_TYPE = 'audio/webm; codecs="opus"'; const VORBIS_CONTENT_TYPE = 'audio/webm; codecs="vorbis"'; const FLAC_CONTENT_TYPE = 'audio/mp4; codecs="flac"'; const ALAC_CONTENT_TYPE = 'audio/mp4; codecs="alac"'; 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"'; const MPEG_H_AUDIO_LC_PROFILE_LEVEL_2_CONTENT_TYPE = 'audio/mp4; codecs="mhm1.0x0C"'; const MPEG_H_AUDIO_LC_PROFILE_LEVEL_3_CONTENT_TYPE = 'audio/mp4; codecs="mhm1.0x0D"'; const MPEG_H_AUDIO_LC_PROFILE_LEVEL_1_MULTISTREAM_CONTENT_TYPE = 'audio/mp4; codecs="mhm2.0x0B"'; const MPEG_H_AUDIO_LC_PROFILE_LEVEL_2_MULTISTREAM_CONTENT_TYPE = 'audio/mp4; codecs="mhm2.0x0C"'; const MPEG_H_AUDIO_LC_PROFILE_LEVEL_3_MULTISTREAM_CONTENT_TYPE = 'audio/mp4; codecs="mhm2.0x0D"'; const DTS_CORE_CONTENT_TYPE = 'audio/mp4; codecs="dtsc"'; const DTS_HD_CORE_PLUS_EXTENSION_CONTENT_TYPE = 'audio/mp4; codecs="dtsh"'; const DTS_HD_LBR_CONTENT_TYPE = 'audio/mp4; codecs="dtse"'; const DTS_UHD_PROFILE_2_CONTENT_TYPE = 'audio/mp4; codecs="dtsx"'; const DTS_UHD_PROFILE_3_CONTENT_TYPE = 'audio/mp4; codecs="dtsy"'; const XHE_AAC_CONTENT_TYPE = 'audio/mp4; codecs="mp4a.40.42"'; function isSafari() { const { userAgent } = navigator; return userAgent.indexOf('Safari') > -1 && userAgent.indexOf('Chrome') === -1; } const isSsr = typeof window === 'undefined'; let defaultVideoElement; let defaultAudioElement; function resetDefaultMediaElements() { defaultVideoElement = undefined; defaultAudioElement = undefined; } function getDefaultAudioElement() { if (!defaultAudioElement) { defaultAudioElement = document.createElement('audio'); } return defaultAudioElement; } function getDefaultVideoElement() { if (!defaultVideoElement) { defaultVideoElement = document.createElement('video'); } return defaultVideoElement; } function canPlayType(type) { if (isSsr) { return ''; } let mediaElement; const mediaElementType = type.split('/')[0]; if (mediaElementType === 'audio') { mediaElement = getDefaultAudioElement(); } else { mediaElement = getDefaultVideoElement(); } return mediaElement.canPlayType ? mediaElement.canPlayType(type) : ''; } function isTypeSupported(value) { if (isSsr || !window.MediaSource) { return false; } let result = false; try { result = MediaSource.isTypeSupported(value); } catch (e) { } return result; } function isContentTypeSupported(contentType) { const canPlayTypeResult = canPlayType(contentType); const isTypeSupportedResult = isTypeSupported(contentType); let any = canPlayTypeResult !== '' || isTypeSupportedResult; let both = canPlayTypeResult !== '' && isTypeSupportedResult; // Fix for PS4, old iPad and ... if (!isTypeSupportedResult && canPlayTypeResult === 'maybe') { any = false; both = false; } return { canPlayType: canPlayTypeResult, isTypeSupported: isTypeSupportedResult, any, both, mediaElementType: contentType.split('/')[0], contentType, }; } function isContentTypeSupportedAsync(configuration) { var _a, _b, _c, _d, _e; const audioContentTypeSupported = ((_a = configuration.audio) === null || _a === void 0 ? void 0 : _a.contentType) ? isContentTypeSupported((_b = configuration.audio) === null || _b === void 0 ? void 0 : _b.contentType) : undefined; const videoContentTypeSupported = ((_c = configuration.video) === null || _c === void 0 ? void 0 : _c.contentType) ? isContentTypeSupported((_d = configuration.video) === null || _d === void 0 ? void 0 : _d.contentType) : undefined; if ((_e = navigator.mediaCapabilities) === null || _e === void 0 ? void 0 : _e.decodingInfo) { return Promise.all([ navigator.mediaCapabilities.decodingInfo(Object.assign(Object.assign({}, configuration), { type: 'file' })), navigator.mediaCapabilities.decodingInfo(Object.assign(Object.assign({}, configuration), { type: 'media-source' })), ]).then(data => { return { audio: audioContentTypeSupported, video: videoContentTypeSupported, decodingInfo: { file: data[0], 'media-source': data[1], }, }; }); } return Promise.resolve({ audio: audioContentTypeSupported, video: videoContentTypeSupported, }); } function isMp3Supported() { return isContentTypeSupported(MP3_CONTENT_TYPE); } function isMp4AudioSupported() { return isContentTypeSupported(MP4_AUDIO_CONTENT_TYPE); } function isAacSupported() { return isContentTypeSupported(AAC_CONTENT_TYPE); } function isDolbyDigitalSupported() { return isContentTypeSupported(DOLBY_AC3_CONTENT_TYPE); } function isDolbyDigitalPlusSupported() { return isContentTypeSupported(DOLBY_EC3_CONTENT_TYPE); } function isDolbyAtmosSupported() { return new Promise(resolve => { if (isSsr) { return resolve(false); } // @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 => { 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)); } else { resolve(false); } }); } function isMpegHAudioSupported() { return isContentTypeSupported(MPEG_H_AUDIO_LC_PROFILE_LEVEL_3_CONTENT_TYPE); } function isVorbisSupported() { return isContentTypeSupported(VORBIS_CONTENT_TYPE); } function isFlacSupported() { return isContentTypeSupported(FLAC_CONTENT_TYPE); } function isAlacSupported() { return isContentTypeSupported(ALAC_CONTENT_TYPE); } function isOpusSupported() { return isContentTypeSupported(OPUS_CONTENT_TYPE); } function isDtsSupported() { return isContentTypeSupported(DTS_CORE_CONTENT_TYPE); } function isDtsHdSupported() { return isContentTypeSupported(DTS_HD_CORE_PLUS_EXTENSION_CONTENT_TYPE); } function isDtsExpressSupported() { return isContentTypeSupported(DTS_HD_LBR_CONTENT_TYPE); } function isDtsXSupported() { return isContentTypeSupported(DTS_UHD_PROFILE_2_CONTENT_TYPE); } const H264_BASELINE_CONTENT_TYPE = 'video/mp4; codecs="avc1.42E01E"'; const H264_MAIN_CONTENT_TYPE = 'video/mp4; codecs="avc1.4D401E"'; const H264_HIGH_CONTENT_TYPE = 'video/mp4; codecs="avc1.64001E"'; const VP8_CONTENT_TYPE = 'video/webm; codecs="vp8"'; const VP9_CONTENT_TYPE = 'video/webm; codecs="vp9"'; // https://googlechrome.github.io/samples/media/vp9-codec-string.html const VP9_PROFILE2_LEVEL1_10BIT_CONTENT_TYPE = 'video/webm; codecs="vp09.02.10.10.01.09.16.09.01"'; const AV1_CONTENT_TYPE = 'video/mp4; codecs="av01.0.01M.08"'; // https://developer.mozilla.org/en-US/docs/Web/Media/Formats/codecs_parameter const AV1_MAIN10_CONTENT_TYPE = 'video/mp4; codecs="av01.0.15M.10"'; const HEV_MAIN_CONTENT_TYPE = 'video/mp4; codecs="hev1.1.6.L123.B0"'; const HEV_MAIN10_CONTENT_TYPE = 'video/mp4; codecs="hev1.2.4.L153.B0"'; // For iOS const HVC_MAIN_CONTENT_TYPE = 'video/mp4; codecs="hvc1.1.6.L123.B0"'; const HVC_MAIN10_CONTENT_TYPE = 'video/mp4; codecs="hvc1.2.4.L153.B0"'; const DOLBY_VISION_CONTENT_TYPE = 'video/mp4; codecs="dvhe.08.09"'; const MPEG2T_CONTENT_TYPE = 'video/mp2t'; const VVC1_MAIN10_CONTENT_TYPE = 'video/mp4; codecs="vvc1.1.L67.CQA.O0+3"'; const VVCI_MAIN10_CONTENT_TYPE = 'video/mp4; codecs="vvci.1.L67.CQA.O0+3"'; const EVC_BASELINE_CONTENT_TYPE = 'video/mp4; codecs="evc1.vprf0.vlev123"'; const EVC_MAIN_CONTENT_TYPE = 'video/mp4; codecs="evc1.vprf1.vlev153"'; function isVp8Supported() { return isContentTypeSupported(VP8_CONTENT_TYPE); } function isVp9Supported() { return isContentTypeSupported(VP9_CONTENT_TYPE); } function isVp9Profile2Level110BitSupported() { return isContentTypeSupported(VP9_PROFILE2_LEVEL1_10BIT_CONTENT_TYPE); } function isH264BaselineSupported() { return isContentTypeSupported(H264_BASELINE_CONTENT_TYPE); } function isH264MainSupported() { return isContentTypeSupported(H264_MAIN_CONTENT_TYPE); } function isH264HighSupported() { return isContentTypeSupported(H264_HIGH_CONTENT_TYPE); } function isAV1Supported() { return isContentTypeSupported(AV1_CONTENT_TYPE); } function isAV1Main10Supported() { return isContentTypeSupported(AV1_MAIN10_CONTENT_TYPE); } function isHevcMainSupported() { const result = isContentTypeSupported(HEV_MAIN_CONTENT_TYPE); if (result.any) { return result; } return isContentTypeSupported(HVC_MAIN_CONTENT_TYPE); } function isHevcMain10Supported() { const resultHev = isContentTypeSupported(HEV_MAIN10_CONTENT_TYPE); if (resultHev.any) { return resultHev; } return isContentTypeSupported(HVC_MAIN10_CONTENT_TYPE); } function isDolbyVisionSupported() { return isContentTypeSupported(DOLBY_VISION_CONTENT_TYPE); } function isMpeg2TSupported() { return isContentTypeSupported(MPEG2T_CONTENT_TYPE); } function isVvcMain10Supported() { const result = isContentTypeSupported(VVC1_MAIN10_CONTENT_TYPE); if (result.any) { return result; } return isContentTypeSupported(VVCI_MAIN10_CONTENT_TYPE); } function isEvcBaselineSupported() { return isContentTypeSupported(EVC_BASELINE_CONTENT_TYPE); } function isEvcMainSupported() { return isContentTypeSupported(EVC_MAIN_CONTENT_TYPE); } // This file is created automatically, do not edit manually. // Use "npm run smallest" // Smallest PNG image is 67 bytes. const PNG_SMALLEST_BASE64 = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAAAAAA6fptVAAAACklEQVQI12P4DwABAQEAG7buVgAAAABJRU5ErkJggg=='; // Smallest APNG image is 202 bytes. const APNG_SMALLEST_BASE64 = 'data:image/apng;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAIAAAE8ahlKAAAACXBIWXMAAA7DAAAOwwHHb6hkAAAACGFjVEwAAAABAAAAALQt6aAAAAAaZmNUTAAAAAAAAAAIAAAACAAAAAAAAAAAAAEAZAEAqRxtCQAAADBJREFUeJxi2L9/P8P///9BGMQEYlQeRAAqBhHGkMGtDIseZMUo+rFIIHOQFeGUAAAAAP//BksYVwAAAAZJREFUAwAYEqdB3PA4KAAAAABJRU5ErkJggg=='; // Smallest BMP image is 127 bytes. const BMP_SMALLEST_BASE64 = 'data:image/bmp;base64,Qk1xAAAAAAAAAHsAAABsAAAAAQAAAAEAAAABACAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/AAD/AAD/AAAAAAAA/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQ=='; // Smallest GIF image is 35 bytes. const GIF_SMALLEST_BASE64 = 'data:image/gif;base64,R0lGODdhAQABAPAAAAAAAAAAACwAAAAAAQABAAACAkQBADs='; // Smallest HEIC image is 439 bytes. const HEIC_SMALLEST_BASE64 = 'data:image/heic;base64,AAAAGGZ0eXBoZWljAAAAAG1pZjFoZWljAAABaW1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAHBpY3QAAAAAAAAAAAAAAAAAAAAADnBpdG0AAAAAAAEAAAAiaWxvYwAAAABEQAABAAEAAAAAAYkAAQAAAAAAAAAuAAAAI2lpbmYAAAAAAAEAAAAVaW5mZQIAAAAAAQAAaHZjMQAAAADpaXBycAAAAMppcGNvAAAAdmh2Y0MBA3AAAAAAAAAAAAAe8AD8/fj4AAAPAyAAAQAYQAEMAf//A3AAAAMAkAAAAwAAAwAeugJAIQABACpCAQEDcAAAAwCQAAADAAADAB6gIIEFluqumubgIaDAgAAAAwCAAAADAIQiAAEABkQBwXPBiQAAABRpc3BlAAAAAAAAAEAAAABAAAAAKGNsYXAAAAABAAAAAQAAAAEAAAAB////wQAAAAL////BAAAAAgAAABBwaXhpAAAAAAMICAgAAAAXaXBtYQAAAAAAAAABAAEEgQKDBAAAADZtZGF0AAAAKigBrwayEx2gkim3i/2Rd0CR/V6h6GbEyV3dheegYfLV9ZwraCH8nff+7w=='; // Smallest ICO image is 198 bytes. const ICO_SMALLEST_BASE64 = 'data:image/vnd.microsoft.icon;base64,AAABAAEAEBACAAEAAQCwAAAAFgAAACgAAAAQAAAAIAAAAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'; // Smallest JPG image is 160 bytes. const JPG_SMALLEST_BASE64 = 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/wAALCAABAAEBAREA/8QAFAABAAAAAAAAAAAAAAAAAAAACf/EABQQAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQEAAD8AKp//2Q=='; // Smallest JXL image is 321 bytes. const JXL_SMALLEST_BASE64 = 'data:image/jxl;base64,AAAADEpYTCANCocKAAAAFGZ0eXBqeGwgAAAAAGp4bCAAAAAUanhscAAAAAD/CgAQEBQ3AgAAADpqYnJkwQ0gCC0DAgCEgAgAAADA+D8RAAAAAPwP8AMAAAALCIDgABBKRklGAAEBAQBIAEgAAAMAAADTanhscIAAAAHgWwAQAAADDGQMZAxk/v8OAAAYAAgAAQAAAAAAgIAliUNk3qQHnmaGewCAESkosMMxRsQwIiI2OtqNwSuRFINHAGFoBpQwAQAAIDUAADABAABOADHqBaABIfwgZK7XCBXRhW0iVRh1B8DcL4IfPaIAWIkBMtQBiCJTRQGjL3A2kivYYoXAQzMq4HwBEFE/QPH1RQAQ0QMZ4iZCkQB6aFMlAPbIGHVhpTX/8xVgEwaI0MSiKDAmAIA83w0h+IhIAAAAAAAAQEkC'; // Smallest TIFF image is 231 bytes. const TIFF_SMALLEST_BASE64 = 'data:image/tiff;base64,SUkqAAoAAAD/ABAAAAEDAAEAAAABAAAAAQEDAAEAAAABAAAAAgEDAAEAAAAIAAAAAwEDAAEAAAABAAAABgEDAAEAAAABAAAAEQEEAAEAAAAIAAAAEgEDAAEAAAABAAAAFQEDAAEAAAABAAAAFgEDAAEAAACAAAAAFwEEAAEAAAABAAAAGgEFAAEAAADQAAAAGwEFAAEAAADYAAAAHAEDAAEAAAABAAAAHQECAAcAAADgAAAAKAEDAAEAAAACAAAAUwEDAAEAAAABAAAAAAAAAEgAAAABAAAASAAAAAEAAADQpNC+0L0A'; // Smallest AVIF image is 292 bytes. const AVIF_SMALLEST_BASE64 = 'data:image/avif;base64,AAAAHGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZgAAAOptZXRhAAAAAAAAACFoZGxyAAAAAAAAAABwaWN0AAAAAAAAAAAAAAAAAAAAAA5waXRtAAAAAAABAAAAImlsb2MAAAAAREAAAQABAAAAAAEOAAEAAAAAAAAAFgAAACNpaW5mAAAAAAABAAAAFWluZmUCAAAAAAEAAGF2MDEAAAAAamlwcnAAAABLaXBjbwAAABNjb2xybmNseAACAAIABoAAAAAMYXYxQ4EgAgAAAAAUaXNwZQAAAAAAAAABAAAAAQAAABBwaXhpAAAAAAMICAgAAAAXaXBtYQAAAAAAAAABAAEEAYIDBAAAAB5tZGF0EgAKBzgABhAQ0GkyCRAAAAAP+I9ngw=='; // Smallest WEBP image is 38 bytes. const WEBP_SMALLEST_BASE64 = 'data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA='; function isGifSupported() { return isImageSupported(GIF_SMALLEST_BASE64); } function isJpegSupported() { return isImageSupported(JPG_SMALLEST_BASE64); } function isJpegXlSupported() { return isImageSupported(JXL_SMALLEST_BASE64); } function isPngSupported() { return isImageSupported(PNG_SMALLEST_BASE64); } function isBmpSupported() { return isImageSupported(BMP_SMALLEST_BASE64); } function isAPngSupported() { return isImageSupported(APNG_SMALLEST_BASE64); } function isTiffSupported() { return isImageSupported(TIFF_SMALLEST_BASE64); } function isIcoSupported() { return isImageSupported(ICO_SMALLEST_BASE64); } function isWebpSupported() { return isImageSupported(WEBP_SMALLEST_BASE64); } function isHeicSupported() { return isImageSupported(HEIC_SMALLEST_BASE64); } function isAvifSupported() { return isImageSupported(AVIF_SMALLEST_BASE64); } function isImageSupported(base64) { if (isSsr) { return Promise.resolve(false); } return new Promise((resolve) => { const img = new Image(); img.onerror = img.onabort = () => { resolve(false); }; img.onload = () => { resolve(true); }; img.src = base64; }); } function isSvgSupported() { return Boolean(typeof window !== 'undefined' && document.createElementNS && document.createElementNS('http://www.w3.org/2000/svg', 'svg').createSVGRect); } function isAndroid() { return /Android/.test(navigator.userAgent); } function isIOS() { return /iPad|iPhone|iPod/.test(navigator.userAgent) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1); } // 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() { const version = getAndroidVersionAsString(); return version ? (parseFloat(version) || -1) : -1; } function getAndroidVersionAsString() { const match = navigator.userAgent.match(/Android\s([0-9.]+)/); return match ? (match[1] || '') : ''; } function isFirefox() { return /firefox/.test(navigator.userAgent.toLowerCase()); } function getFirefoxVersion() { const match = navigator.userAgent.match(/Firefox\/([0-9]+)\./); return match ? (parseFloat(match[1]) || -1) : -1; } function isChromium() { // @ts-ignore return Boolean(window.chrome); } function isPlayStation() { return /PlayStation/i.test(navigator.userAgent); } 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 GIF_CONTENT_TYPE = 'image/gif'; const JPEG_CONTENT_TYPE = 'image/jpeg'; const JPEG_XL_CONTENT_TYPE = 'image/jxl'; const PNG_CONTENT_TYPE = 'image/png'; const APNG_CONTENT_TYPE = 'image/apng'; const SVG_CONTENT_TYPE = 'image/svg+xml'; const WEBP_CONTENT_TYPE = 'image/webp'; const HEIF_CONTENT_TYPE = 'image/heif'; const HEIC_CONTENT_TYPE = 'image/heic'; const AVIF_CONTENT_TYPE = 'image/avif'; const ICO_CONTENT_TYPE = 'image/vnd.microsoft.icon'; const BMP_CONTENT_TYPE = 'image/bmp'; const TIFF_CONTENT_TYPE = 'image/tiff'; 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'; function isNativeHlsSupported() { return canPlayType(HLS_CONTENT_TYPE) !== ''; } function isNativeMpdSupported() { return canPlayType(MPD_CONTENT_TYPE) !== ''; } function isNativeMssSupported() { return canPlayType(MSS_CONTENT_TYPE) !== ''; } function isMseSupported() { return Boolean(!isSsr && window.MediaSource && typeof window.MediaSource.isTypeSupported === 'function'); } function isEmeSupported() { var _a; return Boolean(!isSsr && window.MediaKeys && ( // @ts-ignore navigator === null || navigator === void 0 ? void 0 : navigator.requestMediaKeySystemAccess) && ((_a = window.MediaKeySystemAccess) === null || _a === void 0 ? void 0 : _a.prototype.getConfiguration)); } function isMmsSupported() { return Boolean(!isSsr && window.ManagedMediaSource && typeof window.ManagedMediaSource.isTypeSupported === 'function'); } function isMseInWorkersSupported() { return Boolean(isMseSupported() && window.MediaSource.canConstructInDedicatedWorker); } function isMmsInWorkersSupported() { return Boolean(isMmsSupported() && window.ManagedMediaSource.canConstructInDedicatedWorker); } function getDevicePixelRatio() { return window.devicePixelRatio || 1; } function getScreenWidth() { return screen.width * getDevicePixelRatio(); } function getScreenHeight() { return screen.height * getDevicePixelRatio(); } // 30720×17280 const SCREEN_32K = [[30720, 17280]]; // 15360×8640 const SCREEN_16K = [[15360, 8640]]; // 7680×4320, 8192×4320, 10000×3600, 10240×4320, 10240×5760 const SCREEN_10K = [[7680, 4320], [8192, 4320], [10000, 3600], [10240, 4320], [10240, 5760]]; // 7680×2160, 7680×4320, 8192×1024, 8192×1638, 8192×4320, 8192×5120 // 8192×5464, 8192×6144, 8192×8192, 8400×3600 const SCREEN_8K = [ [7680, 2160], [7680, 4320], [8192, 1024], [8192, 1638], [8192, 4320], [8192, 5120], [8192, 5464], [8192, 6144], [8192, 8192], [8400, 3600] ]; // 5760×3240, 6016×3200, 6016×3384, 6144×3240, 6144×3456, 6400×4096 const SCREEN_6K = [[5760, 3240], [6016, 3200], [6016, 3384] /* Apple Pro Display XDR */, [6144, 3240], [6144, 3456], [6400, 4096]]; // 5120×1440, 5120×2160, 5120×2700, 5120×2880, 5120×3840, 5280×2160 const SCREEN_5K = [[5120, 1440], [5120, 2160], [5120, 2700], [5120, 2880] /* Apple 27” iMac */, [5120, 3840], [5280, 2160]]; // 4480×2520 const SCREEN_4d5K = [[4480, 2520 /* Apple iMac 24”*/]]; // 3656×2664, 3840×2160, 3996×2160, 4096×1716, 4096×2160, 4096×3072 const SCREEN_4K = [[3656, 2664], [3840, 2160], [3996, 2160], [4096, 1716], [4096, 2160], [4096, 3072]]; // 3000x2000 const SCREEN_3K = [[3000, 2000]]; // 2560×1440 const SCREEN_2d5K = [[2560, 1440]]; // 2048×1080, 1998×1080, 2048×858 const SCREEN_2K = [[1998, 1080], [2048, 1080], [2048, 858]]; // 1920×1080 const SCREEN_FULLHD = [[1920, 1080]]; // 1280×720 const SCREEN_HD = [[1280, 720]]; // SD: 854×480, 640×360, 426×240 function is32KScreenSupported(width = getScreenWidth(), height = getScreenHeight()) { return isMoreOrEqual(SCREEN_32K, width, height); } function is16KScreenSupported(width = getScreenWidth(), height = getScreenHeight()) { return isMoreOrEqual(SCREEN_16K, width, height); } function is10KScreenSupported(width = getScreenWidth(), height = getScreenHeight()) { return isMoreOrEqual(SCREEN_10K, width, height); } function is8KScreenSupported(width = getScreenWidth(), height = getScreenHeight()) { return isMoreOrEqual(SCREEN_8K, width, height); } function is6KScreenSupported(width = getScreenWidth(), height = getScreenHeight()) { return isMoreOrEqual(SCREEN_6K, width, height); } function is5KScreenSupported(width = getScreenWidth(), height = getScreenHeight()) { return isMoreOrEqual(SCREEN_5K, width, height); } function is4dot5KScreenSupported(width = getScreenWidth(), height = getScreenHeight()) { return isMoreOrEqual(SCREEN_4d5K, width, height); } function is4KScreenSupported(width = getScreenWidth(), height = getScreenHeight()) { return isMoreOrEqual(SCREEN_4K, width, height); } function is3KScreenSupported(width = getScreenWidth(), height = getScreenHeight()) { return isMoreOrEqual(SCREEN_3K, width, height); } function is2dot5KScreenSupported(width = getScreenWidth(), height = getScreenHeight()) { return isMoreOrEqual(SCREEN_2d5K, width, height); } function is2KScreenSupported(width = getScreenWidth(), height = getScreenHeight()) { return isMoreOrEqual(SCREEN_2K, width, height); } function isFullHDScreenSupported(width = getScreenWidth(), height = getScreenHeight()) { return isMoreOrEqual(SCREEN_FULLHD, width, height); } function isHDScreenSupported(width = getScreenWidth(), height = getScreenHeight()) { return isMoreOrEqual(SCREEN_HD, width, height); } function isSDScreenSupported() { return true; } function isMoreOrEqual(sizes, width, height) { return checkSize(sizes, width, height) > -1; } function checkSize(sizes, width, height) { let isLess = true; for (let i = 0; i < sizes.length; i++) { const item = sizes[i]; if (width === item[0] && height === item[1]) { return 0; } if (width >= item[0]) { isLess = false; } } if (isLess) { return -1; } return 1; } function getResolutionBadge(width = getScreenWidth(), height = getScreenHeight()) { const items = [ { sizes: [[0, 0]], title: 'SD', }, { sizes: SCREEN_HD, title: 'HD' }, { sizes: SCREEN_FULLHD, title: 'FullHD' }, { sizes: SCREEN_2K, title: '2K' }, { sizes: SCREEN_2d5K, title: '2.5K' }, { sizes: SCREEN_3K, title: '3K' }, { sizes: SCREEN_4K, title: '4K' }, { sizes: SCREEN_4d5K, title: '4.5K' }, { sizes: SCREEN_5K, title: '5K' }, { sizes: SCREEN_6K, title: '6K' }, { sizes: SCREEN_8K, title: '8K' }, { sizes: SCREEN_10K, title: '10K' }, { sizes: SCREEN_16K, title: '16K' }, { sizes: SCREEN_32K, title: '32K' }, ]; let supportedSize = items[0].title; for (const item of items) { const result = checkSize(item.sizes, width, height); if (result === 0) { supportedSize = item.title; } else if (result === -1) { break; } else { supportedSize = `>${item.title}`; } } return supportedSize; } function getScreenDepth() { return screen.colorDepth; } function isHighDynamicRangeSupported(win = window) { var _a, _b, _c; if (win.Hisense_GetSupportForHDR) { return win.Hisense_GetSupportForHDR() !== 'not support'; } // @ts-ignore const cast = win.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_HDR_SUPPORTED); } try { const isHighSupported = checkDynamicRange('high', win); const isStandardSupported = checkDynamicRange('standard', win); if (!isStandardSupported) { return undefined; } return Boolean(isStandardSupported && isHighSupported); } catch (e) { } return undefined; } function checkDynamicRange(type, win = window) { return win.matchMedia && win.matchMedia(`(dynamic-range: ${type})`).matches; } function isHighVideoDynamicRangeSupported(win = window) { try { const isHighSupported = checkVideoDynamicRange('high', win); const isStandardSupported = checkVideoDynamicRange('standard', win); if (!isStandardSupported) { return undefined; } return Boolean(isStandardSupported && isHighSupported); } catch (e) { } return undefined; } function checkVideoDynamicRange(type, win = window) { return win.matchMedia && win.matchMedia(`(video-dynamic-range: ${type})`).matches; } function isWideGamutSupported(win = window) { return isP3Supported(win) || isRec2020Supported(win); } function isSrgbSupported(win = window) { return checkColorSpace('srgb', win); } function isP3Supported(win = window) { return checkColorSpace('p3', win); } function isRec2020Supported(win = window) { return checkColorSpace('rec2020', win); } function checkColorSpace(type, win = window) { return win.matchMedia && win.matchMedia(`(color-gamut: ${type})`).matches; } function getMaxTouchPoints() { var _a; return (_a = navigator.maxTouchPoints) !== null && _a !== void 0 ? _a : // @ts-ignore navigator.msMaxTouchPoints; } function hasTouchScreen() { const maxTouchPoints = getMaxTouchPoints(); if (typeof maxTouchPoints === 'number') { return maxTouchPoints > 1; } return Boolean('ontouchstart' in window); } function getGpuVendor() { if (isSsr) { return ''; } const canvas = document.createElement('canvas'); // Less detailed GPU data // try { // const gl = canvas.getContext('webgl'); // if (gl) { // return gl.getParameter(gl.VENDOR); // } // } catch(e) {} try { const gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl'); if (gl) { // @ts-ignore const debugInfo = gl.getExtension('WEBGL_debug_renderer_info'); // @ts-ignore return gl.getParameter(debugInfo.UNMASKED_VENDOR_WEBGL); } } catch (e) { } return ''; } function getGpuRenderer() { if (isSsr) { return ''; } const canvas = document.createElement('canvas'); // Less detailed GPU data // try { // const gl = canvas.getContext('webgl'); // if (gl) { // return gl.getParameter(gl.RENDERER); // } // } catch(e) {} try { const gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl'); if (gl) { // @ts-ignore const debugInfo = gl.getExtension('WEBGL_debug_renderer_info'); // @ts-ignore return gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL); } } catch (e) { } return ''; } 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); } function isAppleSilicon() { if (isSsr) { return false; } try { const canvas = document.createElement('canvas'); const webgl = canvas.getContext('webgl2') || canvas.getContext('webgl') || canvas.getContext('experimental-webgl'); // @ts-ignore const debug = webgl.getExtension('WEBGL_debug_renderer_info'); // @ts-ignore const renderer = webgl.getParameter(debug.UNMASKED_RENDERER_WEBGL); if (renderer.match(/apple m\d/i)) { return true; } } catch (_a) { return false; } return false; } function getGpuProblems(renderer = getGpuRenderer()) { // Firefox // Examples: // - Windows: // Vendor: "Google Inc. (Microsoft)" // Renderer: "ANGLE (Microsoft, Microsoft Basic Render Driver Direct3D11 vs_5_0 ps_5_0), or similar" // // - Ubuntu: // Vendor: "Mesa" // Renderer: "llvmpipe, or similar" if (renderer.search('Microsoft Basic Render Driver') > -1 || renderer.search('Generic Renderer') > -1 || renderer === 'llvmpipe' || renderer === 'llvmpipe, or similar') { return ['no driver']; } // Chromium // Examples: // - Windows or Ubuntu // Vendor: "Google Inc. (Google)" // Renderer: "ANGLE (Google, Vulkan 1.3.0 (SwiftShader Device (Subzero) (0x0000C0DE)), SwiftShader driver)" // - Windows 7: // Vendor: "Google Inc." // Renderer: "ANGLE (Software Adapter Direct3D11 vs_4_1 ps_4_1)" if (renderer.search('SwiftShader Device \\(Subzero\\) \\(0x0000C0DE\\)') > -1 || renderer.search('Software Adapter') > -1) { return ['no driver', 'no hardware acceleration']; } return null; } const VIRTUAL_MACHINES = [ 'Apple Paravirtual device', 'Android Emulator', 'Parallels Display Adapter', 'VMware', 'VirtualBox Graphics Adapter', ]; function isVirtualMachine(renderer, vendor) { return VIRTUAL_MACHINES.some(item => (renderer + ' ' + vendor).search(item) > -1); } const encryptionSchemes = [ 'cenc', 'cbcs', 'cbcs-1-9', ]; const initDataTypes = ['cenc', 'sinf', 'skd', 'keyids']; const defaultVideoCapabilites = [ { contentType: H264_BASELINE_CONTENT_TYPE, }, { contentType: VP8_CONTENT_TYPE, }, ]; const defaultAudioCapabilites = [ { contentType: AAC_CONTENT_TYPE, }, { contentType: OPUS_CONTENT_TYPE, }, ]; function requestMediaKeySystemAccess(keySystem, supportedConfigurations) { if (typeof navigator === 'undefined' || !navigator.requestMediaKeySystemAccess) { return Promise.resolve(false); } return navigator.requestMediaKeySystemAccess(keySystem, supportedConfigurations).then(() => true).catch(() => false); } function isDrmSupported(keySystem, params = {}) { const videoCapabilities = params.videoCapabilities || defaultVideoCapabilites; return requestMediaKeySystemAccess(keySystem, [ { distinctiveIdentifier: params.distinctiveIdentifier, initDataTypes: params.initDataTypes || initDataTypes, persistentState: params.persistentState, sessionTypes: params.sessionTypes, videoCapabilities: videoCapabilities.map(item => { const data = Object.assign({}, item); if (params.encryptionScheme) { data.encryptionScheme = params.encryptionScheme; } if (params.robustness) { data.robustness = params.robustness; } return data; }), }, ]); } const FAIRPLAY_KEY_SYSTEM = 'com.apple.fps'; const FAIRPLAY_V1_KEY_SYSTEM = 'com.apple.fps.1_0'; const FAIRPLAY_V2_KEY_SYSTEM = 'com.apple.fps.2_0'; const FAIRPLAY_V3_KEY_SYSTEM = 'com.apple.fps.3_0'; const WIDEWINE_KEY_SYSTEM = 'com.widevine.alpha'; // https://github.com/shaka-project/shaka-player/blob/main/docs/tutorials/drm-config.md const PLAYREADY_KEY_SYSTEM = 'com.microsoft.playready'; const PLAYREADY_RECOMMENDATION_KEY_SYSTEM = 'com.microsoft.playready.recommendation'; const PRIMETIME_KEY_SYSTEM = 'com.adobe.primetime'; const CLEAR_KEY_SYSTEM = 'org.w3.clearkey'; function isFairPlaySupported(params) { return isDrmSupported(FAIRPLAY_KEY_SYSTEM, params); } function isFairPlayV1Supported(params) { return isDrmSupported(FAIRPLAY_V1_KEY_SYSTEM, params); } function isFairPlayV2Supported(params) { return isDrmSupported(FAIRPLAY_V2_KEY_SYSTEM, params); } function isFairPlayV3Supported(params) { return isDrmSupported(FAIRPLAY_V3_KEY_SYSTEM, params); } function isWidevineSupported(params) { return isDrmSupported(WIDEWINE_KEY_SYSTEM, params); } function isWidevineL1Supported(params = {}) { return isDrmSupported(WIDEWINE_KEY_SYSTEM, Object.assign(Object.assign({}, params), { robustness: 'HW_SECURE_DECODE' })); } function isWidevineL3Supported(params = {}) { return isDrmSupported(WIDEWINE_KEY_SYSTEM, Object.assign(Object.assign({}, params), { robustness: 'SW_SECURE_DECODE' })); } function isPlayReadySupported(params) { return isDrmSupported(PLAYREADY_RECOMMENDATION_KEY_SYSTEM, params); } function isPlayReadySL150Supported(params = {}) { return isDrmSupported(PLAYREADY_RECOMMENDATION_KEY_SYSTEM, Object.assign(Object.assign({}, params), { robustness: '150' })); } function isPlayReadySL2000Supported(params = {}) { return isDrmSupported(PLAYREADY_RECOMMENDATION_KEY_SYSTEM, Object.assign(Object.assign({}, params), { robustness: '2000' })); } function isPlayReadySL3000Supported(params = {}) { return isDrmSupported(PLAYREADY_RECOMMENDATION_KEY_SYSTEM, Object.assign(Object.assign({}, params), { robustness: '3000' })); } function isPrimetimeSupported(params) { return isDrmSupported(PRIMETIME_KEY_SYSTEM, params); } function isClearKeySupported(params) { return isDrmSupported(CLEAR_KEY_SYSTEM, params); } function isRemotePlaybackApiSupported() { var _a; if (isSsr) { return false; } const video = getDefaultVideoElement(); return Boolean( // @ts-ignore video.webkitShowPlaybackTargetPicker || // Safari ((_a = video.remote) === null || _a === void 0 ? void 0 : _a.watchAvailability)); } function isPipSupported() { if (isSsr) { return false; } if (isFirefox() && getFirefoxVersion() >= 69) { return true; } const video = getDefaultVideoElement(); return 'pictureInPictureEnabled' in document || 'webkitPresentationMode' in video; } function isDocumentPipSupported() { if (isSsr) { return false; } // https://developer.mozilla.org/en-US/docs/Web/API/DocumentPictureInPicture // @ts-ignore return Boolean(window.documentPictureInPicture); } function isCastToAirPlaySupported() { return Boolean(typeof window !== 'undefined' && // https://developer.apple.com/documentation/webkitjs/adding_an_airplay_button_to_your_safari_media_controls // @ts-ignore window.WebKitPlaybackTargetAvailabilityEvent); } function isStandalone() { return Boolean(typeof window !== 'undefined' && // @ts-ignore navigator.standalone === true || // Apple Safari // https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps/How_to/Create_a_standalone_app (window.matchMedia && window.matchMedia('(display-mode: standalone)').matches)); } // Detect if system supports WebRTC 1.0 or WebRTC 1.1. function isWebRTCSupported() { return [ 'RTCPeerConnection', 'webkitRTCPeerConnection', 'mozRTCPeerConnection', 'RTCIceGatherer' ].some(item => item in window); } function mediaFilter(codec) { return codec.mimeType.search('(CN|red|fec|rtx|telephone-event|flexfec-03)$') === -1; } // https://developer.mozilla.org/en-US/docs/Web/Media/Formats/WebRTC_codecs#supported_video_codecs function getWebRTCVideoCodecs(onlyMedia) { var _a, _b, _c, _d; const senderCodecs = ((_b = (_a = window.RTCRtpSender) === null || _a === void 0 ? void 0 : _a.getCapabilities('video')) === null || _b === void 0 ? void 0 : _b.codecs) || []; const receiverCodecs = ((_d = (_c = window.RTCRtpReceiver) === null || _c === void 0 ? void 0 : _c.getCapabilities('video')) === null || _d === void 0 ? void 0 : _d.codecs) || []; return { encoding: onlyMedia ? senderCodecs.filter(mediaFilter) : senderCodecs, decoding: onlyMedia ? receiverCodecs.filter(mediaFilter) : receiverCodecs, }; } // https://developer.mozilla.org/en-US/docs/Web/Media/Formats/WebRTC_codecs#supported_audio_codecs function getWebRTCAudioCodecs(onlyMedia) { var _a, _b, _c, _d; const senderCodecs = ((_b = (_a = window.RTCRtpSender) === null || _a === void 0 ? void 0 : _a.getCapabilities('audio')) === null || _b === void 0 ? void 0 : _b.codecs) || []; const receiverCodecs = ((_d = (_c = window.RTCRtpReceiver) === null || _c === void 0 ? void 0 : _c.getCapabilities('audio')) === null || _d === void 0 ? void 0 : _d.codecs) || []; return { encoding: onlyMedia ? senderCodecs.filter(mediaFilter) : senderCodecs, decoding: onlyMedia ? receiverCodecs.filter(mediaFilter) : receiverCodecs, }; } function parseGamepadName(originalName) { let result = originalName.match(/vendor: ([\da-f]+) product: ([\da-f]+)/i); let name = originalName.split(/ \(/)[0]; const isXInput = originalName.search(/XInput/i) !== -1 ? true : undefined; const isStandardGamepad = originalName.search(/STANDARD GAMEPAD/i) !== -1 ? true : undefined; if (!result) { result = originalName.match(/^([\da-f]+)-([\da-f]+)-/i); if (!result) { return { originalName, name: name.trim(), isXInput, isStandardGamepad, }; } const buffer = originalName.split('-'); buffer.shift(); buffer.shift(); name = buffer.join('-'); } const [_, originalVendorId, originalProductId] = result; return { originalName, name: name.trim(), originalVendorId, // hex id as string vendorId: parseInt(originalVendorId, 16), // decimal id as number originalProductId, // hex id as string productId: parseInt(originalProductId, 16), // decimal id as number isXInput, isStandardGamepad, }; } export { AAC_CONTENT_TYPE, ALAC_CONTENT_TYPE, APNG_CONTENT_TYPE, AV1_CONTENT_TYPE, AV1_MAIN10_CONTENT_TYPE, AVIF_CONTENT_TYPE, BMP_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, ICO_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, TIFF_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, getGpuProblems, getGpuRenderer, getGpuVendor, getMaxTouchPoints, getResolutionBadge, getScreenDepth, getScreenHeight, getScreenWidth, getWebRTCAudioCodecs, getWebRTCVideoCodecs, hasHardwareAcceleration, hasTouchScreen, initDataTypes, is10KScreenSupported, is16KScreenSupported, is2KScreenSupported, is2dot5KScreenSupported, is32KScreenSupported, is3KScreenSupported, is4KScreenSupported, is4dot5KScreenSupported, is5KScreenSupported, is6KScreenSupported, is8KScreenSupported, isAPngSupported, isAV1Main10Supported, isAV1Supported, isAacSupported, isAlacSupported, isAndroid, isAppleSilicon, isAvifSupported, isBmpSupported, isCastToAirPlaySupported, isChromium, isClearKeySupported, isContentTypeSupported, isContentTypeSupportedAsync, 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, isHevcMain10Supported, isHevcMainSupported, isHighDynamicRangeSupported, isHighVideoDynamicRangeSupported, isIOS, isIcoSupported, isImageSupported, isJpegSupported, isJpegXlSupported, isMmsInWorkersSupported, isMmsSupported, isMobile, isMoreOrEqual, isMp3Supported, isMp4AudioSupported, isMpeg2TSupported, isMpegHAudioSupported, isMseInWorkersSupported, isMseSupported, isNativeHlsSupported, isNativeMpdSupported, isNativeMssSupported, isOpusSupported, isP3Supported, isPipSupported, isPlayReadySL150Supported, isPlayReadySL2000Supported, isPlayReadySL3000Supported, isPlayReadySupported, isPlayStation, isPlayStation3, isPlayStation4, isPlayStation5, isPlayStation6, isPlayStationVita, isPngSupported, isPrimetimeSupported, isRec2020Supported, isRemotePlaybackApiSupported, isSDScreenSupported, isSafari, isSrgbSupported, isStandalone, isSvgSupported, isTiffSupported, isTypeSupported, isVirtualMachine, isVorbisSupported, isVp8Supported, isVp9Profile2Level110BitSupported, isVp9Supported, isVvcMain10Supported, isWebRTCSupported, isWebpSupported, isWideGamutSupported, isWidevineL1Supported, isWidevineL3Supported, isWidevineSupported, parseGamepadName, resetDefaultMediaElements };