Merge pull request #430 from thecodingmachine/firefox-error-jitsi
Add close button jitsi frame
This commit is contained in:
commit
d1f181cc0c
6
front/dist/index.html
vendored
6
front/dist/index.html
vendored
@ -72,7 +72,11 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="cowebsite" class="cowebsite hidden"></div>
|
<div id="cowebsite" class="cowebsite hidden">
|
||||||
|
<button class="close-btn" id="cowebsite-close">
|
||||||
|
<img src="resources/logos/close.svg"/>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
<div class="audio-playing">
|
<div class="audio-playing">
|
||||||
<img src="/resources/logos/megaphone.svg"/>
|
<img src="/resources/logos/megaphone.svg"/>
|
||||||
</div>
|
</div>
|
||||||
|
17
front/dist/resources/style/style.css
vendored
17
front/dist/resources/style/style.css
vendored
@ -284,6 +284,23 @@ body {
|
|||||||
#cowebsite.hidden {
|
#cowebsite.hidden {
|
||||||
transform: translateX(100%);
|
transform: translateX(100%);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#cowebsite .close-btn{
|
||||||
|
position: absolute;
|
||||||
|
top: 10px;
|
||||||
|
right: -100px;
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
cursor: pointer;
|
||||||
|
animation: right .2s ease;
|
||||||
|
}
|
||||||
|
#cowebsite .close-btn img{
|
||||||
|
height: 15px;
|
||||||
|
right: 15px;
|
||||||
|
}
|
||||||
|
#cowebsite:hover .close-btn{
|
||||||
|
right: 10px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@media (max-aspect-ratio: 1/1) {
|
@media (max-aspect-ratio: 1/1) {
|
||||||
.game-overlay {
|
.game-overlay {
|
||||||
|
@ -1202,12 +1202,19 @@ export class GameScene extends ResizableScene implements CenterListener {
|
|||||||
jitsiFactory.start(roomName, gameManager.getPlayerName(), jwt);
|
jitsiFactory.start(roomName, gameManager.getPlayerName(), jwt);
|
||||||
this.connection.setSilent(true);
|
this.connection.setSilent(true);
|
||||||
mediaManager.hideGameOverlay();
|
mediaManager.hideGameOverlay();
|
||||||
|
|
||||||
|
//permit to stop jitsi when user close iframe
|
||||||
|
mediaManager.addTriggerCloseJitsiFrameButton('close-jisi',() => {
|
||||||
|
this.stopJitsi();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public stopJitsi(): void {
|
public stopJitsi(): void {
|
||||||
this.connection.setSilent(false);
|
this.connection.setSilent(false);
|
||||||
jitsiFactory.stop();
|
jitsiFactory.stop();
|
||||||
mediaManager.showGameOverlay();
|
mediaManager.showGameOverlay();
|
||||||
|
|
||||||
|
mediaManager.removeTriggerCloseJitsiFrameButton('close-jisi');
|
||||||
}
|
}
|
||||||
|
|
||||||
private loadSpritesheet(name: string, url: string): Promise<void> {
|
private loadSpritesheet(name: string, url: string): Promise<void> {
|
||||||
|
@ -44,7 +44,9 @@ class CoWebsiteManager {
|
|||||||
|
|
||||||
public loadCoWebsite(url: string): void {
|
public loadCoWebsite(url: string): void {
|
||||||
this.load();
|
this.load();
|
||||||
this.cowebsiteDiv.innerHTML = '';
|
this.cowebsiteDiv.innerHTML = `<button class="close-btn" id="cowebsite-close">
|
||||||
|
<img src="resources/logos/close.svg">
|
||||||
|
</button>`;
|
||||||
|
|
||||||
const iframe = document.createElement('iframe');
|
const iframe = document.createElement('iframe');
|
||||||
iframe.id = 'cowebsite-iframe';
|
iframe.id = 'cowebsite-iframe';
|
||||||
@ -83,7 +85,9 @@ class CoWebsiteManager {
|
|||||||
this.close();
|
this.close();
|
||||||
this.fire();
|
this.fire();
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.cowebsiteDiv.innerHTML = '';
|
this.cowebsiteDiv.innerHTML = `<button class="close-btn" id="cowebsite-close">
|
||||||
|
<img src="resources/logos/close.svg">
|
||||||
|
</button>`;
|
||||||
resolve();
|
resolve();
|
||||||
}, animationTime)
|
}, animationTime)
|
||||||
}));
|
}));
|
||||||
|
@ -52,6 +52,8 @@ export class MediaManager {
|
|||||||
|
|
||||||
private hasCamera = true;
|
private hasCamera = true;
|
||||||
|
|
||||||
|
private triggerCloseJistiFrame : Map<String, Function> = new Map<String, Function>();
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
|
|
||||||
this.myCamVideo = HtmlUtils.getElementByIdOrFail<HTMLVideoElement>('myCamVideo');
|
this.myCamVideo = HtmlUtils.getElementByIdOrFail<HTMLVideoElement>('myCamVideo');
|
||||||
@ -170,11 +172,23 @@ export class MediaManager {
|
|||||||
public showGameOverlay(){
|
public showGameOverlay(){
|
||||||
const gameOverlay = HtmlUtils.getElementByIdOrFail('game-overlay');
|
const gameOverlay = HtmlUtils.getElementByIdOrFail('game-overlay');
|
||||||
gameOverlay.classList.add('active');
|
gameOverlay.classList.add('active');
|
||||||
|
|
||||||
|
const buttonCloseFrame = HtmlUtils.getElementByIdOrFail('cowebsite-close');
|
||||||
|
const functionTrigger = () => {
|
||||||
|
this.triggerCloseJitsiFrameButton();
|
||||||
|
}
|
||||||
|
buttonCloseFrame.removeEventListener('click', functionTrigger);
|
||||||
}
|
}
|
||||||
|
|
||||||
public hideGameOverlay(){
|
public hideGameOverlay(){
|
||||||
const gameOverlay = HtmlUtils.getElementByIdOrFail('game-overlay');
|
const gameOverlay = HtmlUtils.getElementByIdOrFail('game-overlay');
|
||||||
gameOverlay.classList.remove('active');
|
gameOverlay.classList.remove('active');
|
||||||
|
|
||||||
|
const buttonCloseFrame = HtmlUtils.getElementByIdOrFail('cowebsite-close');
|
||||||
|
const functionTrigger = () => {
|
||||||
|
this.triggerCloseJitsiFrameButton();
|
||||||
|
}
|
||||||
|
buttonCloseFrame.addEventListener('click', functionTrigger);
|
||||||
}
|
}
|
||||||
|
|
||||||
public enableCamera() {
|
public enableCamera() {
|
||||||
@ -654,6 +668,19 @@ export class MediaManager {
|
|||||||
public removeParticipant(userId: number|string){
|
public removeParticipant(userId: number|string){
|
||||||
this.discussionManager.removeParticipant(userId);
|
this.discussionManager.removeParticipant(userId);
|
||||||
}
|
}
|
||||||
|
public addTriggerCloseJitsiFrameButton(id: String, Function: Function){
|
||||||
|
this.triggerCloseJistiFrame.set(id, Function);
|
||||||
|
}
|
||||||
|
|
||||||
|
public removeTriggerCloseJitsiFrameButton(id: String){
|
||||||
|
this.triggerCloseJistiFrame.delete(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
private triggerCloseJitsiFrameButton(): void {
|
||||||
|
for (const callback of this.triggerCloseJistiFrame.values()) {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* For some reasons, the microphone muted icon or the stream is not always up to date.
|
* For some reasons, the microphone muted icon or the stream is not always up to date.
|
||||||
* Here, every 30 seconds, we are "reseting" the streams and sending again the constraints to the other peers via the data channel again (see SimplePeer::pushVideoToRemoteUser)
|
* Here, every 30 seconds, we are "reseting" the streams and sending again the constraints to the other peers via the data channel again (see SimplePeer::pushVideoToRemoteUser)
|
||||||
|
Loading…
Reference in New Issue
Block a user