openvidu-components: Fixed full screen status

pull/809/head
Carlos Santos 2023-05-30 13:08:17 +02:00
parent 6f691e8bb1
commit 0bd8a6f38d
1 changed files with 7 additions and 1 deletions

View File

@ -462,6 +462,7 @@ export class ToolbarComponent implements OnInit, OnDestroy, AfterViewInit {
this.menuTrigger?.menuOpened.subscribe(() => {
this.isSessionCreator = this.participantService.amIModerator();
});
this.subscribeToFullscreenChanged();
}
ngOnDestroy(): void {
@ -485,6 +486,7 @@ export class ToolbarComponent implements OnInit, OnDestroy, AfterViewInit {
if (this.screenSizeSub) this.screenSizeSub.unsubscribe();
if (this.settingsButtonSub) this.settingsButtonSub.unsubscribe();
if (this.captionsSubs) this.captionsSubs.unsubscribe();
document.removeEventListener('fullscreenchange', () => this.isFullscreenActive = false);
}
/**
@ -638,7 +640,6 @@ export class ToolbarComponent implements OnInit, OnDestroy, AfterViewInit {
* @ignore
*/
toggleFullscreen() {
this.isFullscreenActive = !this.isFullscreenActive;
this.documentService.toggleFullscreen('session-container');
this.onFullscreenButtonClicked.emit();
}
@ -659,6 +660,11 @@ export class ToolbarComponent implements OnInit, OnDestroy, AfterViewInit {
this.isConnectionLost = false;
});
}
private subscribeToFullscreenChanged() {
document.addEventListener("fullscreenchange", (event) => this.isFullscreenActive = Boolean(document.fullscreenElement));
}
protected subscribeToMenuToggling() {
this.panelTogglingSubscription = this.panelService.panelOpenedObs.subscribe((ev: PanelEvent) => {
this.isChatOpened = ev.opened && ev.type === PanelType.CHAT;