Removing dead code
This commit is contained in:
parent
76261de805
commit
3b278d0498
@ -1290,7 +1290,6 @@ ${escapedMessage}
|
|||||||
*/
|
*/
|
||||||
update(time: number, delta: number) : void {
|
update(time: number, delta: number) : void {
|
||||||
this.dirty = false;
|
this.dirty = false;
|
||||||
mediaManager.updateScene();
|
|
||||||
this.currentTick = time;
|
this.currentTick = time;
|
||||||
this.CurrentPlayer.moveUser(delta);
|
this.CurrentPlayer.moveUser(delta);
|
||||||
|
|
||||||
|
@ -79,10 +79,6 @@ export class MenuScene extends Phaser.Scene {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.gameReportElement = new ReportMenu(this, connectionManager.getConnexionType === GameConnexionTypes.anonymous);
|
this.gameReportElement = new ReportMenu(this, connectionManager.getConnexionType === GameConnexionTypes.anonymous);
|
||||||
mediaManager.setShowReportModalCallBacks((userId, userName) => {
|
|
||||||
this.closeAll();
|
|
||||||
this.gameReportElement.open(parseInt(userId), userName);
|
|
||||||
});
|
|
||||||
showReportScreenStore.subscribe((user) => {
|
showReportScreenStore.subscribe((user) => {
|
||||||
this.closeAll();
|
this.closeAll();
|
||||||
if (user !== null) {
|
if (user !== null) {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import {HtmlUtils} from "./HtmlUtils";
|
import {HtmlUtils} from "./HtmlUtils";
|
||||||
import type {ShowReportCallBack} from "./MediaManager";
|
|
||||||
import type {UserInputManager} from "../Phaser/UserInput/UserInputManager";
|
import type {UserInputManager} from "../Phaser/UserInput/UserInputManager";
|
||||||
import {connectionManager} from "../Connexion/ConnectionManager";
|
import {connectionManager} from "../Connexion/ConnectionManager";
|
||||||
import {GameConnexionTypes} from "../Url/UrlManager";
|
import {GameConnexionTypes} from "../Url/UrlManager";
|
||||||
import {iframeListener} from "../Api/IframeListener";
|
import {iframeListener} from "../Api/IframeListener";
|
||||||
|
import {showReportScreenStore} from "../Stores/ShowReportScreenStore";
|
||||||
|
|
||||||
export type SendMessageCallback = (message:string) => void;
|
export type SendMessageCallback = (message:string) => void;
|
||||||
|
|
||||||
@ -104,11 +104,11 @@ export class DiscussionManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public addParticipant(
|
public addParticipant(
|
||||||
userId: number|string,
|
userId: number|'me',
|
||||||
name: string|undefined,
|
name: string|undefined,
|
||||||
img?: string|undefined,
|
img?: string|undefined,
|
||||||
isMe: boolean = false,
|
isMe: boolean = false,
|
||||||
showReportCallBack?: ShowReportCallBack
|
//showReportCallBack?: ShowReportCallBack
|
||||||
) {
|
) {
|
||||||
const divParticipant: HTMLDivElement = document.createElement('div');
|
const divParticipant: HTMLDivElement = document.createElement('div');
|
||||||
divParticipant.classList.add('participant');
|
divParticipant.classList.add('participant');
|
||||||
@ -132,16 +132,13 @@ export class DiscussionManager {
|
|||||||
!isMe
|
!isMe
|
||||||
&& connectionManager.getConnexionType
|
&& connectionManager.getConnexionType
|
||||||
&& connectionManager.getConnexionType !== GameConnexionTypes.anonymous
|
&& connectionManager.getConnexionType !== GameConnexionTypes.anonymous
|
||||||
|
&& userId !== 'me'
|
||||||
) {
|
) {
|
||||||
const reportBanUserAction: HTMLButtonElement = document.createElement('button');
|
const reportBanUserAction: HTMLButtonElement = document.createElement('button');
|
||||||
reportBanUserAction.classList.add('report-btn')
|
reportBanUserAction.classList.add('report-btn')
|
||||||
reportBanUserAction.innerText = 'Report';
|
reportBanUserAction.innerText = 'Report';
|
||||||
reportBanUserAction.addEventListener('click', () => {
|
reportBanUserAction.addEventListener('click', () => {
|
||||||
if(showReportCallBack) {
|
showReportScreenStore.set({ userId: userId, userName: name ? name : ''});
|
||||||
showReportCallBack(`${userId}`, name);
|
|
||||||
}else{
|
|
||||||
console.info('report feature is not activated!');
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
divParticipant.appendChild(reportBanUserAction);
|
divParticipant.appendChild(reportBanUserAction);
|
||||||
}
|
}
|
||||||
|
@ -17,20 +17,13 @@ import {helpCameraSettingsVisibleStore} from "../Stores/HelpCameraSettingsStore"
|
|||||||
export type UpdatedLocalStreamCallback = (media: MediaStream|null) => void;
|
export type UpdatedLocalStreamCallback = (media: MediaStream|null) => void;
|
||||||
export type StartScreenSharingCallback = (media: MediaStream) => void;
|
export type StartScreenSharingCallback = (media: MediaStream) => void;
|
||||||
export type StopScreenSharingCallback = (media: MediaStream) => void;
|
export type StopScreenSharingCallback = (media: MediaStream) => void;
|
||||||
export type ReportCallback = (message: string) => void;
|
|
||||||
export type ShowReportCallBack = (userId: string, userName: string|undefined) => void;
|
|
||||||
export type HelpCameraSettingsCallBack = () => void;
|
|
||||||
|
|
||||||
import {cowebsiteCloseButtonId} from "./CoWebsiteManager";
|
import {cowebsiteCloseButtonId} from "./CoWebsiteManager";
|
||||||
import {gameOverlayVisibilityStore} from "../Stores/GameOverlayStoreVisibility";
|
import {gameOverlayVisibilityStore} from "../Stores/GameOverlayStoreVisibility";
|
||||||
|
|
||||||
export class MediaManager {
|
export class MediaManager {
|
||||||
private remoteVideo: Map<string, HTMLVideoElement> = new Map<string, HTMLVideoElement>();
|
|
||||||
//FIX ME SOUNDMETER: check stalability of sound meter calculation
|
|
||||||
//mySoundMeterElement: HTMLDivElement;
|
|
||||||
startScreenSharingCallBacks : Set<StartScreenSharingCallback> = new Set<StartScreenSharingCallback>();
|
startScreenSharingCallBacks : Set<StartScreenSharingCallback> = new Set<StartScreenSharingCallback>();
|
||||||
stopScreenSharingCallBacks : Set<StopScreenSharingCallback> = new Set<StopScreenSharingCallback>();
|
stopScreenSharingCallBacks : Set<StopScreenSharingCallback> = new Set<StopScreenSharingCallback>();
|
||||||
showReportModalCallBacks : Set<ShowReportCallBack> = new Set<ShowReportCallBack>();
|
|
||||||
|
|
||||||
private focused : boolean = true;
|
private focused : boolean = true;
|
||||||
|
|
||||||
@ -75,32 +68,7 @@ export class MediaManager {
|
|||||||
}, this.userInputManager);
|
}, this.userInputManager);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*if (result.stream !== null) {
|
|
||||||
isScreenSharing = true;
|
|
||||||
this.addScreenSharingActiveVideo('me', DivImportance.Normal);
|
|
||||||
HtmlUtils.getElementByIdOrFail<HTMLVideoElement>('screen-sharing-me').srcObject = result.stream;
|
|
||||||
} else {
|
|
||||||
if (isScreenSharing) {
|
|
||||||
isScreenSharing = false;
|
|
||||||
this.removeActiveScreenSharingVideo('me');
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/*screenSharingAvailableStore.subscribe((available) => {
|
|
||||||
if (available) {
|
|
||||||
document.querySelector('.btn-monitor')?.classList.remove('hide');
|
|
||||||
} else {
|
|
||||||
document.querySelector('.btn-monitor')?.classList.add('hide');
|
|
||||||
}
|
|
||||||
});*/
|
|
||||||
}
|
|
||||||
|
|
||||||
public updateScene(){
|
|
||||||
//FIX ME SOUNDMETER: check stability of sound meter calculation
|
|
||||||
//this.updateSoudMeter();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public showGameOverlay(): void {
|
public showGameOverlay(): void {
|
||||||
@ -135,68 +103,6 @@ export class MediaManager {
|
|||||||
gameOverlayVisibilityStore.hideGameOverlay();
|
gameOverlayVisibilityStore.hideGameOverlay();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*addActiveVideo(user: UserSimplePeerInterface, userName: string = ""){
|
|
||||||
const userId = ''+user.userId
|
|
||||||
|
|
||||||
userName = userName.toUpperCase();
|
|
||||||
const color = this.getColorByString(userName);
|
|
||||||
|
|
||||||
const html = `
|
|
||||||
<div id="div-${userId}" class="video-container">
|
|
||||||
<div class="connecting-spinner"></div>
|
|
||||||
<div class="rtc-error" style="display: none"></div>
|
|
||||||
<i id="name-${userId}" style="background-color: ${color};">${userName}</i>
|
|
||||||
<img id="microphone-${userId}" title="mute" src="resources/logos/microphone-close.svg">
|
|
||||||
<button id="report-${userId}" class="report">
|
|
||||||
<img title="report this user" src="resources/logos/report.svg">
|
|
||||||
<span>Report/Block</span>
|
|
||||||
</button>
|
|
||||||
<video id="${userId}" autoplay playsinline></video>
|
|
||||||
<img src="resources/logos/blockSign.svg" id="blocking-${userId}" class="block-logo">
|
|
||||||
<div id="soundMeter-${userId}" class="sound-progress">
|
|
||||||
<span></span>
|
|
||||||
<span></span>
|
|
||||||
<span></span>
|
|
||||||
<span></span>
|
|
||||||
<span></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
`;
|
|
||||||
|
|
||||||
layoutManager.add(DivImportance.Normal, userId, html);
|
|
||||||
|
|
||||||
this.remoteVideo.set(userId, HtmlUtils.getElementByIdOrFail<HTMLVideoElement>(userId));
|
|
||||||
|
|
||||||
//permit to create participant in discussion part
|
|
||||||
const showReportUser = () => {
|
|
||||||
for(const callBack of this.showReportModalCallBacks){
|
|
||||||
callBack(userId, userName);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
this.addNewParticipant(userId, userName, undefined, showReportUser);
|
|
||||||
|
|
||||||
const reportBanUserActionEl: HTMLImageElement = HtmlUtils.getElementByIdOrFail<HTMLImageElement>(`report-${userId}`);
|
|
||||||
reportBanUserActionEl.addEventListener('click', (e) => {
|
|
||||||
e.preventDefault();
|
|
||||||
e.stopPropagation();
|
|
||||||
showReportUser();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
addScreenSharingActiveVideo(userId: string, divImportance: DivImportance = DivImportance.Important){
|
|
||||||
|
|
||||||
userId = this.getScreenSharingId(userId);
|
|
||||||
const html = `
|
|
||||||
<div id="div-${userId}" class="video-container">
|
|
||||||
<video id="${userId}" autoplay playsinline></video>
|
|
||||||
</div>
|
|
||||||
`;
|
|
||||||
|
|
||||||
layoutManager.add(divImportance, userId, html);
|
|
||||||
|
|
||||||
this.remoteVideo.set(userId, HtmlUtils.getElementByIdOrFail<HTMLVideoElement>(userId));
|
|
||||||
}*/
|
|
||||||
|
|
||||||
private getScreenSharingId(userId: string): string {
|
private getScreenSharingId(userId: string): string {
|
||||||
return `screen-sharing-${userId}`;
|
return `screen-sharing-${userId}`;
|
||||||
}
|
}
|
||||||
@ -243,33 +149,6 @@ export class MediaManager {
|
|||||||
const blockLogoElement = HtmlUtils.getElementByIdOrFail<HTMLImageElement>('blocking-'+userId);
|
const blockLogoElement = HtmlUtils.getElementByIdOrFail<HTMLImageElement>('blocking-'+userId);
|
||||||
show ? blockLogoElement.classList.add('active') : blockLogoElement.classList.remove('active');
|
show ? blockLogoElement.classList.add('active') : blockLogoElement.classList.remove('active');
|
||||||
}
|
}
|
||||||
/*addStreamRemoteVideo(userId: string, stream : MediaStream): void {
|
|
||||||
const remoteVideo = this.remoteVideo.get(userId);
|
|
||||||
if (remoteVideo === undefined) {
|
|
||||||
throw `Unable to find video for ${userId}`;
|
|
||||||
}
|
|
||||||
remoteVideo.srcObject = stream;
|
|
||||||
}
|
|
||||||
addStreamRemoteScreenSharing(userId: string, stream : MediaStream){
|
|
||||||
// In the case of screen sharing (going both ways), we may need to create the HTML element if it does not exist yet
|
|
||||||
const remoteVideo = this.remoteVideo.get(this.getScreenSharingId(userId));
|
|
||||||
if (remoteVideo === undefined) {
|
|
||||||
this.addScreenSharingActiveVideo(userId);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.addStreamRemoteVideo(this.getScreenSharingId(userId), stream);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
removeActiveVideo(userId: string){
|
|
||||||
//layoutManager.remove(userId);
|
|
||||||
//this.remoteVideo.delete(userId);
|
|
||||||
|
|
||||||
//permit to remove user in discussion part
|
|
||||||
this.removeParticipant(userId);
|
|
||||||
}
|
|
||||||
/*removeActiveScreenSharingVideo(userId: string) {
|
|
||||||
this.removeActiveVideo(this.getScreenSharingId(userId))
|
|
||||||
}*/
|
|
||||||
|
|
||||||
isConnecting(userId: string): void {
|
isConnecting(userId: string): void {
|
||||||
const connectingSpinnerDiv = this.getSpinner(userId);
|
const connectingSpinnerDiv = this.getSpinner(userId);
|
||||||
@ -328,13 +207,6 @@ export class MediaManager {
|
|||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
|
|
||||||
public addNewParticipant(userId: number|string, name: string|undefined, img?: string, showReportUserCallBack?: ShowReportCallBack){
|
|
||||||
discussionManager.addParticipant(userId, name, img, false, showReportUserCallBack);
|
|
||||||
}
|
|
||||||
|
|
||||||
public removeParticipant(userId: number|string){
|
|
||||||
discussionManager.removeParticipant(userId);
|
|
||||||
}
|
|
||||||
public addTriggerCloseJitsiFrameButton(id: String, Function: Function){
|
public addTriggerCloseJitsiFrameButton(id: String, Function: Function){
|
||||||
this.triggerCloseJistiFrame.set(id, Function);
|
this.triggerCloseJistiFrame.set(id, Function);
|
||||||
}
|
}
|
||||||
@ -381,52 +253,6 @@ export class MediaManager {
|
|||||||
discussionManager.setUserInputManager(userInputManager);
|
discussionManager.setUserInputManager(userInputManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
public setShowReportModalCallBacks(callback: ShowReportCallBack){
|
|
||||||
this.showReportModalCallBacks.add(callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
//FIX ME SOUNDMETER: check stalability of sound meter calculation
|
|
||||||
/*updateSoudMeter(){
|
|
||||||
try{
|
|
||||||
const volume = parseInt(((this.mySoundMeter ? this.mySoundMeter.getVolume() : 0) / 10).toFixed(0));
|
|
||||||
this.setVolumeSoundMeter(volume, this.mySoundMeterElement);
|
|
||||||
|
|
||||||
for(const indexUserId of this.soundMeters.keys()){
|
|
||||||
const soundMeter = this.soundMeters.get(indexUserId);
|
|
||||||
const soundMeterElement = this.soundMeterElements.get(indexUserId);
|
|
||||||
if(!soundMeter || !soundMeterElement){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const volumeByUser = parseInt((soundMeter.getVolume() / 10).toFixed(0));
|
|
||||||
this.setVolumeSoundMeter(volumeByUser, soundMeterElement);
|
|
||||||
}
|
|
||||||
}catch(err){
|
|
||||||
//console.error(err);
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
private setVolumeSoundMeter(volume: number, element: HTMLDivElement){
|
|
||||||
if(volume <= 0 && !element.classList.contains('active')){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
element.classList.remove('active');
|
|
||||||
if(volume <= 0){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
element.classList.add('active');
|
|
||||||
element.childNodes.forEach((value: ChildNode, index) => {
|
|
||||||
const elementChildre = element.children.item(index);
|
|
||||||
if(!elementChildre){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
elementChildre.classList.remove('active');
|
|
||||||
if((index +1) > volume){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
elementChildre.classList.add('active');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public getNotification(){
|
public getNotification(){
|
||||||
//Get notification
|
//Get notification
|
||||||
if (!DISABLE_NOTIFICATIONS && window.Notification && Notification.permission !== "granted") {
|
if (!DISABLE_NOTIFICATIONS && window.Notification && Notification.permission !== "granted") {
|
||||||
|
@ -19,6 +19,7 @@ import {localStreamStore, LocalStreamStoreValue, obtainedMediaConstraintStore} f
|
|||||||
import {screenSharingLocalStreamStore} from "../Stores/ScreenSharingStore";
|
import {screenSharingLocalStreamStore} from "../Stores/ScreenSharingStore";
|
||||||
import {DivImportance, layoutManager} from "./LayoutManager";
|
import {DivImportance, layoutManager} from "./LayoutManager";
|
||||||
import {HtmlUtils} from "./HtmlUtils";
|
import {HtmlUtils} from "./HtmlUtils";
|
||||||
|
import {discussionManager} from "./DiscussionManager";
|
||||||
|
|
||||||
export interface UserSimplePeerInterface{
|
export interface UserSimplePeerInterface{
|
||||||
userId: number;
|
userId: number;
|
||||||
@ -164,7 +165,7 @@ export class SimplePeer {
|
|||||||
name = this.getName(user.userId);
|
name = this.getName(user.userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
mediaManager.removeActiveVideo("" + user.userId);
|
discussionManager.removeParticipant(user.userId);
|
||||||
|
|
||||||
//mediaManager.addActiveVideo(user, name);
|
//mediaManager.addActiveVideo(user, name);
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ import type {UserSimplePeerInterface} from "./SimplePeer";
|
|||||||
import {get, readable, Readable} from "svelte/store";
|
import {get, readable, Readable} from "svelte/store";
|
||||||
import {obtainedMediaConstraintStore} from "../Stores/MediaStore";
|
import {obtainedMediaConstraintStore} from "../Stores/MediaStore";
|
||||||
import {DivImportance} from "./LayoutManager";
|
import {DivImportance} from "./LayoutManager";
|
||||||
|
import {discussionManager} from "./DiscussionManager";
|
||||||
|
|
||||||
const Peer: SimplePeerNamespace.SimplePeer = require('simple-peer');
|
const Peer: SimplePeerNamespace.SimplePeer = require('simple-peer');
|
||||||
|
|
||||||
@ -234,7 +235,7 @@ export class VideoPeer extends Peer {
|
|||||||
}
|
}
|
||||||
this.onBlockSubscribe.unsubscribe();
|
this.onBlockSubscribe.unsubscribe();
|
||||||
this.onUnBlockSubscribe.unsubscribe();
|
this.onUnBlockSubscribe.unsubscribe();
|
||||||
mediaManager.removeActiveVideo("" + this.userId);
|
discussionManager.removeParticipant(this.userId);
|
||||||
// FIXME: I don't understand why "Closing connection with" message is displayed TWICE before "Nb users in peerConnectionArray"
|
// FIXME: I don't understand why "Closing connection with" message is displayed TWICE before "Nb users in peerConnectionArray"
|
||||||
// I do understand the method closeConnection is called twice, but I don't understand how they manage to run in parallel.
|
// I do understand the method closeConnection is called twice, but I don't understand how they manage to run in parallel.
|
||||||
super.destroy(error);
|
super.destroy(error);
|
||||||
|
Loading…
Reference in New Issue
Block a user