Skip to content

Commit

Permalink
🌀
Browse files Browse the repository at this point in the history
  • Loading branch information
hcodes committed Aug 29, 2024
1 parent 4ff4911 commit ab0c45f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions example/build/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,10 @@
return win.matchMedia && win.matchMedia(`(dynamic-range: ${type})`).matches;
}

const isSsr = typeof window === 'undefined';

function getGpuVendor() {
if (typeof window === 'undefined') {
if (isSsr) {
return '';
}
const canvas = document.createElement('canvas');
Expand All @@ -141,7 +143,7 @@
return '';
}
function getGpuRenderer() {
if (typeof window === 'undefined') {
if (isSsr) {
return '';
}
const canvas = document.createElement('canvas');
Expand Down Expand Up @@ -184,7 +186,7 @@
return defaultVideoElement;
}
function canPlayType(type) {
if (typeof window === 'undefined') {
if (isSsr) {
return '';
}
let mediaElement;
Expand Down Expand Up @@ -240,7 +242,7 @@
}

function isPipSupported() {
if (typeof window === 'undefined') {
if (isSsr) {
return false;
}
if (isFirefox() && getFirefoxVersion() >= 69) {
Expand All @@ -250,7 +252,7 @@
return 'pictureInPictureEnabled' in document || 'webkitPresentationMode' in video;
}
function isDocumentPipSupported() {
if (typeof window === 'undefined') {
if (isSsr) {
return false;
}
// https://developer.mozilla.org/en-US/docs/Web/API/DocumentPictureInPicture
Expand Down

0 comments on commit ab0c45f

Please sign in to comment.