Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(PressureObserver) adapt to API changes

Saúl Ibarra Corretgéf28bd67ff493
diff --git a/react/features/base/app/middleware.web.ts b/react/features/base/app/middleware.web.ts
index a91492b467..8475d206bd 100644
--- a/react/features/base/app/middleware.web.ts
+++ b/react/features/base/app/middleware.web.ts
@@ -24,20 +24,17 @@ MiddlewareRegistry.register(() => (next: Function) => (action: AnyAction) => {
case APP_WILL_MOUNT: {
// Disable it inside an iframe until Google fixes the origin trial for 3rd party sources:
// https://bugs.chromium.org/p/chromium/issues/detail?id=1504167
- if (!isEmbedded() && 'PressureObserver' in globalThis) {
+ if (!isEmbedded() && 'PressureObserver' in window) {
pressureObserver = new window.PressureObserver(
(records: typeof window.PressureRecord) => {
logger.info('Compute pressure state changed:', JSON.stringify(records));
- if (typeof APP !== 'undefined') {
- APP.API.notifyComputePressureChanged(records);
- }
- },
- { sampleRate: 1 }
+ APP.API.notifyComputePressureChanged(records);
+ }
);
try {
pressureObserver
- .observe('cpu')
+ .observe('cpu', { sampleInterval: 30_000 })
.catch((e: any) => logger.error('CPU pressure observer failed to start', e));
} catch (e: any) {
logger.error('CPU pressure observer failed to start', e);