9071ba8bc4
Changes (maybe not a complete list): - Disable virtualbgs by default - Move the virtualbg selector in video-preview to the side below the profile selection - Restore old video-preview sizes - Add a wrapper class for MediaStreams (BBBVideoStream) - Centralize virtualbg services and business logic code into BBBVideoStream - Refactor and centralize virtualbg constant fetching - Refactor and centralize virtualbg config fetching - Organize virtualbg type definitions - Remove added states in video-provider to prevent further bloat - Remove added states in video-preview to prevent further bloat - Lock virtual bg switching while video-preview itself is locked - Add proper virtualbg error surfacing via toasts - Refactor iOS availability detection to use centralized UA checker - Avoid calling gUM when toggling virtualbgs on/off - Make virtualbg video-list-item action a toggle instead of a state-aware action - Make virtualbg switching work in video-preview for cameras that are already shared. Especially useful when there are multiple source cameras, and will be important in the near future - Add Derivative Work notices in files that are partially copied from jitsi-meet - Simplify track replacing in video-provider - Split video-preview UI code for virtualbgs into a separate functional component
63 lines
1.7 KiB
JavaScript
63 lines
1.7 KiB
JavaScript
/* NOTICE: This file is a Derivative Work of the original component in Jitsi Meet
|
|
* See https://github.com/jitsi/jitsi-meet/tree/master/react/features/stream-effects/virtual-background/vendor.
|
|
* It is copied under the Apache Public License 2.0 (see https://www.apache.org/licenses/LICENSE-2.0).
|
|
*/
|
|
|
|
/**
|
|
* SET_TIMEOUT constant is used to set interval and it is set in
|
|
* the id property of the request.data property. timeMs property must
|
|
* also be set. request.data example:
|
|
*
|
|
* {
|
|
* id: SET_TIMEOUT,
|
|
* timeMs: 33
|
|
* }
|
|
*/
|
|
export const SET_TIMEOUT = 1;
|
|
|
|
/**
|
|
* CLEAR_TIMEOUT constant is used to clear the interval and it is set in
|
|
* the id property of the request.data property.
|
|
*
|
|
* {
|
|
* id: CLEAR_TIMEOUT
|
|
* }
|
|
*/
|
|
export const CLEAR_TIMEOUT = 2;
|
|
|
|
/**
|
|
* TIMEOUT_TICK constant is used as response and it is set in the id property.
|
|
*
|
|
* {
|
|
* id: TIMEOUT_TICK
|
|
* }
|
|
*/
|
|
export const TIMEOUT_TICK = 3;
|
|
|
|
/**
|
|
* The following code is needed as string to create a URL from a Blob.
|
|
* The URL is then passed to a WebWorker. Reason for this is to enable
|
|
* use of setInterval that is not throttled when tab is inactive.
|
|
*/
|
|
const code = `
|
|
var timer;
|
|
onmessage = function(request) {
|
|
switch (request.data.id) {
|
|
case ${SET_TIMEOUT}: {
|
|
timer = setTimeout(() => {
|
|
postMessage({ id: ${TIMEOUT_TICK} });
|
|
}, request.data.timeMs);
|
|
break;
|
|
}
|
|
case ${CLEAR_TIMEOUT}: {
|
|
if (timer) {
|
|
clearTimeout(timer);
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
};
|
|
`;
|
|
|
|
export const timerWorkerScript = URL.createObjectURL(new Blob([ code ], { type: 'application/javascript' }));
|