detect-audio-video
Advanced tools
Comparing version 1.2.1 to 1.3.0
@@ -44,2 +44,5 @@ const AAC_CONTENT_TYPE = 'audio/mp4; codecs="mp4a.40.2"'; | ||
function canPlayType(type) { | ||
if (typeof window === 'undefined') { | ||
return ''; | ||
} | ||
let mediaElement; | ||
@@ -59,3 +62,3 @@ const mediaElementType = type.split('/')[0]; | ||
function isTypeSupported(value) { | ||
if (!window.MediaSource) { | ||
if (typeof window === 'undefined' || !window.MediaSource) { | ||
return false; | ||
@@ -102,2 +105,5 @@ } | ||
var _a, _b, _c; | ||
if (typeof window === 'undefined') { | ||
return false; | ||
} | ||
// @ts-ignore | ||
@@ -254,3 +260,4 @@ const cast = window.cast; | ||
function isSvgSupported() { | ||
return Boolean(document.createElementNS && | ||
return Boolean(typeof window !== 'undefined' && | ||
document.createElementNS && | ||
document.createElementNS('http://www.w3.org/2000/svg', 'svg').createSVGRect); | ||
@@ -271,2 +278,5 @@ } | ||
function isImageSupported(type) { | ||
if (typeof window === 'undefined') { | ||
return Promise.resolve(false); | ||
} | ||
return new Promise((resolve) => { | ||
@@ -323,3 +333,4 @@ const picture = document.createElement('picture'); | ||
function isMseSupported() { | ||
return Boolean(window.MediaSource && | ||
return Boolean(typeof window !== 'undefined' && | ||
window.MediaSource && | ||
typeof window.MediaSource.isTypeSupported === 'function'); | ||
@@ -329,8 +340,12 @@ } | ||
var _a, _b; | ||
return Boolean(window.MediaKeys) && | ||
Boolean((_a = window.navigator) === null || _a === void 0 ? void 0 : _a.requestMediaKeySystemAccess) && | ||
Boolean((_b = window.MediaKeySystemAccess) === null || _b === void 0 ? void 0 : _b.prototype.getConfiguration); | ||
return Boolean(typeof window !== 'undefined' && | ||
window.MediaKeys && | ||
( | ||
// @ts-ignore | ||
(_a = window.navigator) === null || _a === void 0 ? void 0 : _a.requestMediaKeySystemAccess) && | ||
((_b = window.MediaKeySystemAccess) === null || _b === void 0 ? void 0 : _b.prototype.getConfiguration)); | ||
} | ||
function isMmsSupported() { | ||
return Boolean(window.ManagedMediaSource && | ||
return Boolean(typeof window !== 'undefined' && | ||
window.ManagedMediaSource && | ||
typeof window.ManagedMediaSource.isTypeSupported === 'function'); | ||
@@ -565,2 +580,5 @@ } | ||
function getGpuVendor() { | ||
if (typeof window === 'undefined') { | ||
return ''; | ||
} | ||
const canvas = document.createElement('canvas'); | ||
@@ -587,2 +605,5 @@ // Less detailed GPU data | ||
function getGpuRenderer() { | ||
if (typeof window === 'undefined') { | ||
return ''; | ||
} | ||
const canvas = document.createElement('canvas'); | ||
@@ -636,3 +657,3 @@ // Less detailed GPU data | ||
function requestMediaKeySystemAccess(keySystem, supportedConfigurations) { | ||
if (!navigator.requestMediaKeySystemAccess) { | ||
if (typeof navigator === 'undefined' || !navigator.requestMediaKeySystemAccess) { | ||
return Promise.resolve(false); | ||
@@ -810,2 +831,5 @@ } | ||
function isPipSupported() { | ||
if (typeof window === 'undefined') { | ||
return false; | ||
} | ||
if (isFirefox() && getFirefoxVersion() >= 69) { | ||
@@ -818,11 +842,12 @@ return true; | ||
function isCastToAirPlaySupported() { | ||
// https://developer.apple.com/documentation/webkitjs/adding_an_airplay_button_to_your_safari_media_controls | ||
// @ts-ignore | ||
return Boolean(window.WebKitPlaybackTargetAvailabilityEvent); | ||
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( | ||
// @ts-ignore | ||
window.navigator.standalone === true || // Apple Safari | ||
return Boolean(typeof window !== 'undefined' && | ||
// @ts-ignore | ||
window.navigator.standalone === true || // Apple Safari | ||
// https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps/How_to/Create_a_standalone_app | ||
@@ -829,0 +854,0 @@ (window.matchMedia && window.matchMedia('(display-mode: standalone)').matches)); |
{ | ||
"name": "detect-audio-video", | ||
"version": "1.2.1", | ||
"version": "1.3.0", | ||
"description": "Detect audio and video features in browser", | ||
@@ -28,6 +28,6 @@ "module": "dist/index.js", | ||
"jest-environment-jsdom": "^29.7.0", | ||
"rollup": "^4.18.0", | ||
"ts-jest": "^29.1.3", | ||
"tslib": "^2.6.2", | ||
"typescript": "^5.4.5" | ||
"rollup": "^4.19.0", | ||
"ts-jest": "^29.2.3", | ||
"tslib": "^2.6.3", | ||
"typescript": "^5.5.4" | ||
}, | ||
@@ -34,0 +34,0 @@ "keywords": [ |
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
54164
1257