Merge Jitsi config
This commit is contained in:
parent
ae1d00c828
commit
e8b1b286a3
@ -1,9 +1,16 @@
|
|||||||
import {JITSI_URL} from "../Enum/EnvironmentVariable";
|
import {JITSI_URL} from "../Enum/EnvironmentVariable";
|
||||||
import {mediaManager} from "./MediaManager";
|
import {mediaManager} from "./MediaManager";
|
||||||
import {coWebsiteManager} from "./CoWebsiteManager";
|
import {coWebsiteManager} from "./CoWebsiteManager";
|
||||||
|
import {AddPlayerInterface} from "../Phaser/Game/AddPlayerInterface";
|
||||||
declare const window:any; // eslint-disable-line @typescript-eslint/no-explicit-any
|
declare const window:any; // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||||
|
|
||||||
const getDefaultConfig = () => {
|
interface jitsiConfigInterface {
|
||||||
|
startWithAudioMuted: boolean
|
||||||
|
startWithVideoMuted: boolean
|
||||||
|
prejoinPageEnabled: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
const getDefaultConfig = () : jitsiConfigInterface => {
|
||||||
return {
|
return {
|
||||||
startWithAudioMuted: !mediaManager.constraintsMedia.audio,
|
startWithAudioMuted: !mediaManager.constraintsMedia.audio,
|
||||||
startWithVideoMuted: mediaManager.constraintsMedia.video === false,
|
startWithVideoMuted: mediaManager.constraintsMedia.video === false,
|
||||||
@ -11,6 +18,18 @@ const getDefaultConfig = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const mergeConfig = (config?: object) => {
|
||||||
|
const currentDefaultConfig = getDefaultConfig();
|
||||||
|
if(!config){
|
||||||
|
return currentDefaultConfig;
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
startWithAudioMuted: (config as jitsiConfigInterface).startWithAudioMuted ? true : currentDefaultConfig.startWithAudioMuted,
|
||||||
|
startWithVideoMuted: (config as jitsiConfigInterface).startWithVideoMuted ? true : currentDefaultConfig.startWithVideoMuted,
|
||||||
|
prejoinPageEnabled: (config as jitsiConfigInterface).prejoinPageEnabled ? true : currentDefaultConfig.prejoinPageEnabled
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const defaultInterfaceConfig = {
|
const defaultInterfaceConfig = {
|
||||||
SHOW_CHROME_EXTENSION_BANNER: false,
|
SHOW_CHROME_EXTENSION_BANNER: false,
|
||||||
MOBILE_APP_PROMO: false,
|
MOBILE_APP_PROMO: false,
|
||||||
@ -76,7 +95,7 @@ class JitsiFactory {
|
|||||||
width: "100%",
|
width: "100%",
|
||||||
height: "100%",
|
height: "100%",
|
||||||
parentNode: cowebsiteDiv,
|
parentNode: cowebsiteDiv,
|
||||||
configOverwrite: {...config, ...getDefaultConfig()},
|
configOverwrite: mergeConfig(config),
|
||||||
interfaceConfigOverwrite: {...defaultInterfaceConfig, ...interfaceConfig}
|
interfaceConfigOverwrite: {...defaultInterfaceConfig, ...interfaceConfig}
|
||||||
};
|
};
|
||||||
if (!options.jwt) {
|
if (!options.jwt) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user