Merge remote-tracking branch 'github.com/develop' into windows-focus-blur-camera
# Conflicts: # front/src/WebRtc/MediaManager.ts
This commit is contained in:
commit
855f42a12e
10 changed files with 151 additions and 14 deletions
|
@ -2,6 +2,7 @@ import {HtmlUtils} from "../WebRtc/HtmlUtils";
|
|||
import {UserInputManager} from "../Phaser/UserInput/UserInputManager";
|
||||
import {RoomConnection} from "../Connexion/RoomConnection";
|
||||
import {PlayGlobalMessageInterface} from "../Connexion/ConnexionModels";
|
||||
import {ADMIN_URL} from "../Enum/EnvironmentVariable";
|
||||
|
||||
export const CLASS_CONSOLE_MESSAGE = 'main-console';
|
||||
export const INPUT_CONSOLE_MESSAGE = 'input-send-text';
|
||||
|
@ -17,8 +18,10 @@ interface EventTargetFiles extends EventTarget {
|
|||
|
||||
export class ConsoleGlobalMessageManager {
|
||||
|
||||
private divMainConsole: HTMLDivElement;
|
||||
private buttonMainConsole: HTMLDivElement;
|
||||
private readonly divMainConsole: HTMLDivElement;
|
||||
private readonly buttonMainConsole: HTMLDivElement;
|
||||
private readonly buttonSendMainConsole: HTMLImageElement;
|
||||
private readonly buttonSettingsMainConsole: HTMLImageElement;
|
||||
private activeConsole: boolean = false;
|
||||
private userInputManager!: UserInputManager;
|
||||
private static cssLoaded: boolean = false;
|
||||
|
@ -27,6 +30,8 @@ export class ConsoleGlobalMessageManager {
|
|||
this.buttonMainConsole = document.createElement('div');
|
||||
this.buttonMainConsole.classList.add('console');
|
||||
this.divMainConsole = document.createElement('div');
|
||||
this.buttonSendMainConsole = document.createElement('img');
|
||||
this.buttonSettingsMainConsole = document.createElement('img');
|
||||
this.userInputManager = userInputManager;
|
||||
this.initialise();
|
||||
}
|
||||
|
@ -75,17 +80,26 @@ export class ConsoleGlobalMessageManager {
|
|||
menu.appendChild(textAudio);
|
||||
this.divMainConsole.appendChild(menu);
|
||||
|
||||
const buttonText = document.createElement('p');
|
||||
buttonText.innerText = 'Console';
|
||||
|
||||
this.buttonMainConsole.appendChild(buttonText);
|
||||
this.buttonMainConsole.addEventListener('click', () => {
|
||||
this.buttonSendMainConsole.src = 'resources/logos/send-yellow.svg';
|
||||
this.buttonSendMainConsole.addEventListener('click', () => {
|
||||
if(this.activeConsole){
|
||||
this.disabled();
|
||||
}else{
|
||||
this.buttonSendMainConsole.classList.add('active');
|
||||
this.active();
|
||||
}
|
||||
});
|
||||
this.buttonMainConsole.appendChild(this.buttonSendMainConsole);
|
||||
|
||||
this.buttonSettingsMainConsole.src = 'resources/logos/setting-yellow.svg';
|
||||
this.buttonSettingsMainConsole.addEventListener('click', () => {
|
||||
window.open(ADMIN_URL, '_blank');
|
||||
});
|
||||
this.buttonMainConsole.appendChild(this.buttonSettingsMainConsole);
|
||||
|
||||
/*const buttonText = document.createElement('p');
|
||||
buttonText.innerText = 'Console';
|
||||
this.buttonMainConsole.appendChild(buttonText);*/
|
||||
|
||||
this.divMainConsole.className = CLASS_CONSOLE_MESSAGE;
|
||||
this.divMainConsole.appendChild(this.buttonMainConsole);
|
||||
|
@ -293,17 +307,18 @@ export class ConsoleGlobalMessageManager {
|
|||
this.Connection.emitGlobalMessage(GlobalMessage);
|
||||
}
|
||||
|
||||
|
||||
active(){
|
||||
this.userInputManager.clearAllInputKeyboard();
|
||||
this.activeConsole = true;
|
||||
this.divMainConsole.style.top = '0';
|
||||
this.buttonSendMainConsole.classList.add('active');
|
||||
}
|
||||
|
||||
disabled(){
|
||||
this.userInputManager.initKeyBoardEvent();
|
||||
this.activeConsole = false;
|
||||
this.divMainConsole.style.top = '-80%';
|
||||
this.buttonSendMainConsole.classList.remove('active');
|
||||
}
|
||||
|
||||
private getSectionId(id: string) : string {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
const DEBUG_MODE: boolean = process.env.DEBUG_MODE == "true";
|
||||
const API_URL = (process.env.API_PROTOCOL || (typeof(window) !== 'undefined' ? window.location.protocol : 'http:')) + '//' + (process.env.API_URL || "api.workadventure.localhost");
|
||||
const ADMIN_URL = API_URL.replace('api', 'admin');
|
||||
const TURN_SERVER: string = process.env.TURN_SERVER || "turn:numb.viagenie.ca";
|
||||
const TURN_USER: string = process.env.TURN_USER || 'g.parant@thecodingmachine.com';
|
||||
const TURN_PASSWORD: string = process.env.TURN_PASSWORD || 'itcugcOHxle9Acqi$';
|
||||
|
@ -13,6 +14,7 @@ const MAX_EXTRAPOLATION_TIME = 100; // Extrapolate a maximum of 250ms if no new
|
|||
export {
|
||||
DEBUG_MODE,
|
||||
API_URL,
|
||||
ADMIN_URL,
|
||||
RESOLUTION,
|
||||
ZOOM_LEVEL,
|
||||
POSITION_DELAY,
|
||||
|
|
|
@ -27,6 +27,9 @@ const interfaceConfig = {
|
|||
|
||||
class JitsiFactory {
|
||||
private jitsiApi: any; // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||
private audioCallback = this.onAudioChange.bind(this);
|
||||
private videoCallback = this.onVideoChange.bind(this);
|
||||
|
||||
public start(roomName: string, playerName:string, jwt?: string): void {
|
||||
CoWebsiteManager.insertCoWebsite((cowebsiteDiv => {
|
||||
const domain = JITSI_URL;
|
||||
|
@ -48,13 +51,35 @@ class JitsiFactory {
|
|||
}
|
||||
this.jitsiApi = new window.JitsiMeetExternalAPI(domain, options);
|
||||
this.jitsiApi.executeCommand('displayName', playerName);
|
||||
|
||||
this.jitsiApi.addListener('audioMuteStatusChanged', this.audioCallback);
|
||||
this.jitsiApi.addListener('videoMuteStatusChanged', this.videoCallback);
|
||||
}));
|
||||
}
|
||||
|
||||
public stop(): void {
|
||||
this.jitsiApi.removeListener('audioMuteStatusChanged', this.audioCallback);
|
||||
this.jitsiApi.removeListener('videoMuteStatusChanged', this.videoCallback);
|
||||
this.jitsiApi?.dispose();
|
||||
CoWebsiteManager.closeCoWebsite();
|
||||
}
|
||||
|
||||
private onAudioChange({muted}: {muted: boolean}): void {
|
||||
if (muted && mediaManager.constraintsMedia.audio === true) {
|
||||
mediaManager.disableMicrophone();
|
||||
} else if(!muted && mediaManager.constraintsMedia.audio === false) {
|
||||
mediaManager.enableMicrophone();
|
||||
}
|
||||
}
|
||||
|
||||
private onVideoChange({muted}: {muted: boolean}): void {
|
||||
if (muted && mediaManager.constraintsMedia.video !== false) {
|
||||
mediaManager.disableCamera();
|
||||
} else if(!muted && mediaManager.constraintsMedia.video === false) {
|
||||
mediaManager.enableCamera();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export const jitsiFactory = new JitsiFactory();
|
Loading…
Add table
Add a link
Reference in a new issue