Merge pull request #762 from thecodingmachine/develop
Deploy 2021-02-18
This commit is contained in:
commit
3eec41a1d0
@ -29,6 +29,7 @@ export class GameMap {
|
|||||||
|
|
||||||
const newProps = this.getProperties(key);
|
const newProps = this.getProperties(key);
|
||||||
const oldProps = this.lastProperties;
|
const oldProps = this.lastProperties;
|
||||||
|
this.lastProperties = newProps;
|
||||||
|
|
||||||
// Let's compare the 2 maps:
|
// Let's compare the 2 maps:
|
||||||
// First new properties vs oldProperties
|
// First new properties vs oldProperties
|
||||||
@ -45,8 +46,6 @@ export class GameMap {
|
|||||||
this.trigger(oldPropName, oldPropValue, undefined, newProps);
|
this.trigger(oldPropName, oldPropValue, undefined, newProps);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.lastProperties = newProps;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public getCurrentProperties(): Map<string, string|boolean|number> {
|
public getCurrentProperties(): Map<string, string|boolean|number> {
|
||||||
|
@ -33,9 +33,13 @@ import {ReconnectingSceneName} from "../Reconnecting/ReconnectingScene";
|
|||||||
import {lazyLoadPlayerCharacterTextures, loadCustomTexture} from "../Entity/PlayerTexturesLoadingManager";
|
import {lazyLoadPlayerCharacterTextures, loadCustomTexture} from "../Entity/PlayerTexturesLoadingManager";
|
||||||
import {
|
import {
|
||||||
CenterListener,
|
CenterListener,
|
||||||
|
JITSI_MESSAGE_PROPERTIES,
|
||||||
layoutManager,
|
layoutManager,
|
||||||
LayoutMode,
|
LayoutMode,
|
||||||
ON_ACTION_TRIGGER_BUTTON, TRIGGER_JITSI_PROPERTIES, TRIGGER_WEBSITE_PROPERTIES
|
ON_ACTION_TRIGGER_BUTTON,
|
||||||
|
TRIGGER_JITSI_PROPERTIES,
|
||||||
|
TRIGGER_WEBSITE_PROPERTIES,
|
||||||
|
WEBSITE_MESSAGE_PROPERTIES
|
||||||
} from "../../WebRtc/LayoutManager";
|
} from "../../WebRtc/LayoutManager";
|
||||||
import Texture = Phaser.Textures.Texture;
|
import Texture = Phaser.Textures.Texture;
|
||||||
import Sprite = Phaser.GameObjects.Sprite;
|
import Sprite = Phaser.GameObjects.Sprite;
|
||||||
@ -659,7 +663,11 @@ export class GameScene extends ResizableScene implements CenterListener {
|
|||||||
|
|
||||||
const openWebsiteTriggerValue = allProps.get(TRIGGER_WEBSITE_PROPERTIES);
|
const openWebsiteTriggerValue = allProps.get(TRIGGER_WEBSITE_PROPERTIES);
|
||||||
if(openWebsiteTriggerValue && openWebsiteTriggerValue === ON_ACTION_TRIGGER_BUTTON) {
|
if(openWebsiteTriggerValue && openWebsiteTriggerValue === ON_ACTION_TRIGGER_BUTTON) {
|
||||||
layoutManager.addActionButton('openWebsite', 'Click on SPACE to open the web site', () => {
|
let message = allProps.get(WEBSITE_MESSAGE_PROPERTIES);
|
||||||
|
if(message === undefined){
|
||||||
|
message = 'Press on SPACE to open the web site';
|
||||||
|
}
|
||||||
|
layoutManager.addActionButton('openWebsite', message.toString(), () => {
|
||||||
openWebsiteFunction();
|
openWebsiteFunction();
|
||||||
}, this.userInputManager);
|
}, this.userInputManager);
|
||||||
}else{
|
}else{
|
||||||
@ -686,14 +694,18 @@ export class GameScene extends ResizableScene implements CenterListener {
|
|||||||
|
|
||||||
const jitsiTriggerValue = allProps.get(TRIGGER_JITSI_PROPERTIES);
|
const jitsiTriggerValue = allProps.get(TRIGGER_JITSI_PROPERTIES);
|
||||||
if(jitsiTriggerValue && jitsiTriggerValue === ON_ACTION_TRIGGER_BUTTON) {
|
if(jitsiTriggerValue && jitsiTriggerValue === ON_ACTION_TRIGGER_BUTTON) {
|
||||||
layoutManager.addActionButton('jitsiRoom', 'Click on SPACE to enter in jitsi meet room', () => {
|
let message = allProps.get(JITSI_MESSAGE_PROPERTIES);
|
||||||
|
if (message === undefined) {
|
||||||
|
message = 'Press on SPACE to enter in jitsi meet room';
|
||||||
|
}
|
||||||
|
layoutManager.addActionButton('jitsiRoom', message.toString(), () => {
|
||||||
openJitsiRoomFunction();
|
openJitsiRoomFunction();
|
||||||
}, this.userInputManager);
|
}, this.userInputManager);
|
||||||
}else{
|
}else{
|
||||||
openJitsiRoomFunction();
|
openJitsiRoomFunction();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
this.gameMap.onPropertyChange('silent', (newValue, oldValue) => {
|
this.gameMap.onPropertyChange('silent', (newValue, oldValue) => {
|
||||||
if (newValue === undefined || newValue === false || newValue === '') {
|
if (newValue === undefined || newValue === false || newValue === '') {
|
||||||
this.connection.setSilent(false);
|
this.connection.setSilent(false);
|
||||||
|
@ -3,7 +3,13 @@ import {mediaManager} from "./MediaManager";
|
|||||||
import {coWebsiteManager} from "./CoWebsiteManager";
|
import {coWebsiteManager} from "./CoWebsiteManager";
|
||||||
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 +17,20 @@ const getDefaultConfig = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const mergeConfig = (config?: object) => {
|
||||||
|
const currentDefaultConfig = getDefaultConfig();
|
||||||
|
if(!config){
|
||||||
|
return currentDefaultConfig;
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
...currentDefaultConfig,
|
||||||
|
...config,
|
||||||
|
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,
|
||||||
@ -51,6 +71,7 @@ class JitsiFactory {
|
|||||||
private jitsiApi: any; // eslint-disable-line @typescript-eslint/no-explicit-any
|
private jitsiApi: any; // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||||
private audioCallback = this.onAudioChange.bind(this);
|
private audioCallback = this.onAudioChange.bind(this);
|
||||||
private videoCallback = this.onVideoChange.bind(this);
|
private videoCallback = this.onVideoChange.bind(this);
|
||||||
|
private previousConfigMeet? : jitsiConfigInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Slugifies the room name and prepends the room name with the instance
|
* Slugifies the room name and prepends the room name with the instance
|
||||||
@ -60,6 +81,9 @@ class JitsiFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public start(roomName: string, playerName:string, jwt?: string, config?: object, interfaceConfig?: object): void {
|
public start(roomName: string, playerName:string, jwt?: string, config?: object, interfaceConfig?: object): void {
|
||||||
|
//save previous config
|
||||||
|
this.previousConfigMeet = getDefaultConfig();
|
||||||
|
|
||||||
coWebsiteManager.insertCoWebsite((cowebsiteDiv => {
|
coWebsiteManager.insertCoWebsite((cowebsiteDiv => {
|
||||||
// Jitsi meet external API maintains some data in local storage
|
// Jitsi meet external API maintains some data in local storage
|
||||||
// which is sent via the appData URL parameter when joining a
|
// which is sent via the appData URL parameter when joining a
|
||||||
@ -76,7 +100,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) {
|
||||||
@ -103,6 +127,19 @@ class JitsiFactory {
|
|||||||
this.jitsiApi.removeListener('audioMuteStatusChanged', this.audioCallback);
|
this.jitsiApi.removeListener('audioMuteStatusChanged', this.audioCallback);
|
||||||
this.jitsiApi.removeListener('videoMuteStatusChanged', this.videoCallback);
|
this.jitsiApi.removeListener('videoMuteStatusChanged', this.videoCallback);
|
||||||
this.jitsiApi?.dispose();
|
this.jitsiApi?.dispose();
|
||||||
|
|
||||||
|
//restore previous config
|
||||||
|
if(this.previousConfigMeet?.startWithAudioMuted){
|
||||||
|
mediaManager.disableMicrophone();
|
||||||
|
}else{
|
||||||
|
mediaManager.enableMicrophone();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this.previousConfigMeet?.startWithVideoMuted){
|
||||||
|
mediaManager.disableCamera();
|
||||||
|
}else{
|
||||||
|
mediaManager.enableCamera();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private onAudioChange({muted}: {muted: boolean}): void {
|
private onAudioChange({muted}: {muted: boolean}): void {
|
||||||
|
@ -24,9 +24,13 @@ export interface CenterListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const ON_ACTION_TRIGGER_BUTTON = 'onaction';
|
export const ON_ACTION_TRIGGER_BUTTON = 'onaction';
|
||||||
|
|
||||||
export const TRIGGER_WEBSITE_PROPERTIES = 'openWebsiteTrigger';
|
export const TRIGGER_WEBSITE_PROPERTIES = 'openWebsiteTrigger';
|
||||||
export const TRIGGER_JITSI_PROPERTIES = 'jitsiTrigger';
|
export const TRIGGER_JITSI_PROPERTIES = 'jitsiTrigger';
|
||||||
|
|
||||||
|
export const WEBSITE_MESSAGE_PROPERTIES = 'openWebsiteTriggerMessage';
|
||||||
|
export const JITSI_MESSAGE_PROPERTIES = 'jitsiTriggerMessage';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is in charge of the video-conference layout.
|
* This class is in charge of the video-conference layout.
|
||||||
* It receives positioning requests for videos and does its best to place them on the screen depending on the active layout mode.
|
* It receives positioning requests for videos and does its best to place them on the screen depending on the active layout mode.
|
||||||
|
@ -42,6 +42,8 @@ export class SimplePeer {
|
|||||||
private readonly stopLocalScreenSharingStreamCallback: StopScreenSharingCallback;
|
private readonly stopLocalScreenSharingStreamCallback: StopScreenSharingCallback;
|
||||||
private readonly peerConnectionListeners: Array<PeerConnectionListener> = new Array<PeerConnectionListener>();
|
private readonly peerConnectionListeners: Array<PeerConnectionListener> = new Array<PeerConnectionListener>();
|
||||||
private readonly userId: number;
|
private readonly userId: number;
|
||||||
|
private lastWebrtcUserName: string|undefined;
|
||||||
|
private lastWebrtcPassword: string|undefined;
|
||||||
|
|
||||||
constructor(private Connection: RoomConnection, private enableReporting: boolean, private myName: string) {
|
constructor(private Connection: RoomConnection, private enableReporting: boolean, private myName: string) {
|
||||||
// We need to go through this weird bound function pointer in order to be able to "free" this reference later.
|
// We need to go through this weird bound function pointer in order to be able to "free" this reference later.
|
||||||
@ -142,6 +144,9 @@ export class SimplePeer {
|
|||||||
|
|
||||||
mediaManager.addActiveVideo(user, name);
|
mediaManager.addActiveVideo(user, name);
|
||||||
|
|
||||||
|
this.lastWebrtcUserName = user.webRtcUser;
|
||||||
|
this.lastWebrtcPassword = user.webRtcPassword;
|
||||||
|
|
||||||
const peer = new VideoPeer(user, user.initiator ? user.initiator : false, this.Connection);
|
const peer = new VideoPeer(user, user.initiator ? user.initiator : false, this.Connection);
|
||||||
|
|
||||||
//permit to send message
|
//permit to send message
|
||||||
@ -191,6 +196,12 @@ export class SimplePeer {
|
|||||||
mediaManager.addScreenSharingActiveVideo("" + user.userId);
|
mediaManager.addScreenSharingActiveVideo("" + user.userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Enrich the user with last known credentials (if they are not set in the user object, which happens when a user triggers the screen sharing)
|
||||||
|
if (user.webRtcUser === undefined) {
|
||||||
|
user.webRtcUser = this.lastWebrtcUserName;
|
||||||
|
user.webRtcPassword = this.lastWebrtcPassword;
|
||||||
|
}
|
||||||
|
|
||||||
const peer = new ScreenSharingPeer(user, user.initiator ? user.initiator : false, this.Connection);
|
const peer = new ScreenSharingPeer(user, user.initiator ? user.initiator : false, this.Connection);
|
||||||
this.PeerScreenSharingConnectionArray.set(user.userId, peer);
|
this.PeerScreenSharingConnectionArray.set(user.userId, peer);
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
@ -34,26 +34,31 @@
|
|||||||
"y":0
|
"y":0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 34, 34, 34, 34, 0, 0, 0, 0, 0, 34, 34, 34, 34, 34, 0, 0, 0, 0, 0, 34, 34, 34, 34, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
"data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 34, 34, 34, 34, 0, 0, 0, 0, 0, 34, 34, 34, 34, 34, 0, 0, 0, 0, 0, 34, 34, 34, 34, 34, 0, 0, 0, 0, 0, 34, 34, 34, 34, 34, 0, 0, 0, 0, 0, 34, 34, 34, 34, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||||
"height":10,
|
"height":10,
|
||||||
"id":4,
|
"id":5,
|
||||||
"name":"jitsi",
|
"name":"jitsiConf",
|
||||||
"opacity":1,
|
"opacity":1,
|
||||||
"properties":[
|
"properties":[
|
||||||
{
|
{
|
||||||
"name":"jitsiConfig",
|
"name":"jitsiConfig",
|
||||||
"type":"string",
|
"type":"string",
|
||||||
"value":"{ \"startWithAudioMuted\": true }"
|
"value":"{ \"startWithAudioMuted\": true, \"startWithVideoMuted\": true } "
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name":"jitsiInterfaceConfig",
|
"name":"jitsiInterfaceConfig",
|
||||||
"type":"string",
|
"type":"string",
|
||||||
"value":"{ \"DEFAULT_BACKGROUND\": \"#77ee77\" }"
|
"value":"{\"DEFAULT_BACKGROUND\":\"#77ee77\"}"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name":"jitsiRoom",
|
"name":"jitsiRoom",
|
||||||
"type":"string",
|
"type":"string",
|
||||||
"value":"myRoom avec espace \u00e9\u00e0$&'\"_ \ud83d\ude00"
|
"value":"myRoom avec espace \u00e9\u00e0$&'\"_ \ud83d\ude00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name":"jitsiTrigger",
|
||||||
|
"type":"string",
|
||||||
|
"value":"onaction"
|
||||||
}],
|
}],
|
||||||
"type":"tilelayer",
|
"type":"tilelayer",
|
||||||
"visible":true,
|
"visible":true,
|
||||||
@ -72,11 +77,11 @@
|
|||||||
"x":0,
|
"x":0,
|
||||||
"y":0
|
"y":0
|
||||||
}],
|
}],
|
||||||
"nextlayerid":5,
|
"nextlayerid":6,
|
||||||
"nextobjectid":1,
|
"nextobjectid":1,
|
||||||
"orientation":"orthogonal",
|
"orientation":"orthogonal",
|
||||||
"renderorder":"right-down",
|
"renderorder":"right-down",
|
||||||
"tiledversion":"1.3.3",
|
"tiledversion":"1.4.3",
|
||||||
"tileheight":32,
|
"tileheight":32,
|
||||||
"tilesets":[
|
"tilesets":[
|
||||||
{
|
{
|
||||||
@ -94,6 +99,6 @@
|
|||||||
}],
|
}],
|
||||||
"tilewidth":32,
|
"tilewidth":32,
|
||||||
"type":"map",
|
"type":"map",
|
||||||
"version":1.2,
|
"version":1.4,
|
||||||
"width":10
|
"width":10
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user