mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2025-12-30 11:22:31 +00:00
When we open a custom scheme URL before the window load event has been fired it seems that GUM prompt is not displayed after this due to Chrome bug. See more details here https://issues.chromium.org/issues/41398687. The result in Jitsi Meet is the following: If the user is joining a call for first time and haven't granted A/V permissions and lands on the deeplinking page we try to open the desktop app via redirect to a custom scheme URL. If the user chooses cancel and "Launch in web" we go to the prejoin screen and proceed with the initial GUM. At this point any GUM call won't display the permission prompt due to the browser bug and will go on forever making it impossible for the user to unmute camera or microphone.
86 lines
2.8 KiB
JavaScript
86 lines
2.8 KiB
JavaScript
import React from 'react';
|
|
import ReactDOM from 'react-dom';
|
|
|
|
import { App } from './features/app/components/App.web';
|
|
import { getLogger } from './features/base/logging/functions';
|
|
import Platform from './features/base/react/Platform.web';
|
|
import { getJitsiMeetGlobalNS, getJitsiMeetGlobalNSConnectionTimes } from './features/base/util/helpers';
|
|
import DialInSummaryApp from './features/invite/components/dial-in-summary/web/DialInSummaryApp';
|
|
import PrejoinApp from './features/prejoin/components/web/PrejoinApp';
|
|
import WhiteboardApp from './features/whiteboard/components/web/WhiteboardApp';
|
|
|
|
const logger = getLogger('index.web');
|
|
|
|
// Add global loggers.
|
|
window.addEventListener('error', ev => {
|
|
logger.error(
|
|
`UnhandledError: ${ev.message}`,
|
|
`Script: ${ev.filename}`,
|
|
`Line: ${ev.lineno}`,
|
|
`Column: ${ev.colno}`,
|
|
'StackTrace: ', ev.error?.stack);
|
|
});
|
|
|
|
window.addEventListener('unhandledrejection', ev => {
|
|
logger.error(
|
|
`UnhandledPromiseRejection: ${ev.reason}`,
|
|
'StackTrace: ', ev.reason?.stack);
|
|
});
|
|
|
|
// Workaround for the issue when returning to a page with the back button and
|
|
// the page is loaded from the 'back-forward' cache on iOS which causes nothing
|
|
// to be rendered.
|
|
if (Platform.OS === 'ios') {
|
|
window.addEventListener('pageshow', event => {
|
|
// Detect pages loaded from the 'back-forward' cache
|
|
// (https://webkit.org/blog/516/webkit-page-cache-ii-the-unload-event/)
|
|
if (event.persisted) {
|
|
// Maybe there is a more graceful approach but in the moment of
|
|
// writing nothing else resolves the issue. I tried to execute our
|
|
// DOMContentLoaded handler but it seems that the 'onpageshow' event
|
|
// is triggered only when 'window.location.reload()' code exists.
|
|
window.location.reload();
|
|
}
|
|
});
|
|
}
|
|
|
|
const globalNS = getJitsiMeetGlobalNS();
|
|
const connectionTimes = getJitsiMeetGlobalNSConnectionTimes();
|
|
|
|
// Used to check if the load event has been fired.
|
|
globalNS.hasLoaded = false;
|
|
|
|
// Used for automated performance tests.
|
|
connectionTimes['index.loaded'] = window.indexLoadedTime;
|
|
|
|
window.addEventListener('load', () => {
|
|
connectionTimes['window.loaded'] = window.loadedEventTime;
|
|
globalNS.hasLoaded = true;
|
|
});
|
|
|
|
document.addEventListener('DOMContentLoaded', () => {
|
|
const now = window.performance.now();
|
|
|
|
connectionTimes['document.ready'] = now;
|
|
logger.log('(TIME) document ready:\t', now);
|
|
});
|
|
|
|
globalNS.entryPoints = {
|
|
APP: App,
|
|
PREJOIN: PrejoinApp,
|
|
DIALIN: DialInSummaryApp,
|
|
WHITEBOARD: WhiteboardApp
|
|
};
|
|
|
|
globalNS.renderEntryPoint = ({
|
|
Component,
|
|
props = {},
|
|
elementId = 'react'
|
|
}) => {
|
|
/* eslint-disable-next-line react/no-deprecated */
|
|
ReactDOM.render(
|
|
<Component { ...props } />,
|
|
document.getElementById(elementId)
|
|
);
|
|
};
|