2022-02-24 10:16:23 +01:00
|
|
|
import {
|
2022-02-24 10:20:32 +01:00
|
|
|
ChangeDetectionStrategy,
|
|
|
|
ChangeDetectorRef,
|
2022-02-24 10:16:23 +01:00
|
|
|
Component,
|
|
|
|
ContentChild,
|
|
|
|
EventEmitter,
|
|
|
|
HostListener,
|
|
|
|
OnDestroy,
|
|
|
|
OnInit,
|
|
|
|
Output,
|
|
|
|
TemplateRef
|
|
|
|
} from '@angular/core';
|
2022-01-19 17:24:11 +01:00
|
|
|
import { skip, Subscription } from 'rxjs';
|
|
|
|
import { TokenService } from '../../services/token/token.service';
|
|
|
|
import { ChatService } from '../../services/chat/chat.service';
|
2022-04-05 15:40:43 +02:00
|
|
|
import { PanelService } from '../../services/panel/panel.service';
|
2022-01-19 17:24:11 +01:00
|
|
|
import { DocumentService } from '../../services/document/document.service';
|
|
|
|
|
2022-02-15 15:52:59 +01:00
|
|
|
import { OpenViduService } from '../../services/openvidu/openvidu.service';
|
2022-01-19 17:24:11 +01:00
|
|
|
import { LoggerService } from '../../services/logger/logger.service';
|
|
|
|
import { ILogger } from '../../models/logger.model';
|
2022-03-31 12:25:02 +02:00
|
|
|
import { Session } from 'openvidu-browser';
|
2022-01-19 17:24:11 +01:00
|
|
|
import { ActionService } from '../../services/action/action.service';
|
|
|
|
import { DeviceService } from '../../services/device/device.service';
|
|
|
|
import { ChatMessage } from '../../models/chat.model';
|
|
|
|
import { ParticipantService } from '../../services/participant/participant.service';
|
|
|
|
import { MenuType } from '../../models/menu.model';
|
2022-03-07 15:50:27 +01:00
|
|
|
import { OpenViduAngularConfigService } from '../../services/config/openvidu-angular.config.service';
|
2022-03-10 11:42:48 +01:00
|
|
|
import { ToolbarAdditionalButtonsDirective } from '../../directives/template/openvidu-angular.directive';
|
2022-03-30 11:58:35 +02:00
|
|
|
import { ParticipantAbstractModel } from '../../models/participant.model';
|
2022-01-19 17:24:11 +01:00
|
|
|
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* The **ToolbarComponent** is hosted inside of the {@link VideoconferenceComponent}.
|
|
|
|
* It is in charge of displaying the participants controlls for handling the media, panels and more videoconference features.
|
|
|
|
*
|
|
|
|
* <div class="custom-table-container">
|
|
|
|
* <div>
|
|
|
|
* <h3>API Directives</h3>
|
|
|
|
*
|
|
|
|
* This component allows us to show or hide certain HTML elements with the following {@link https://angular.io/guide/attribute-directives Angular attribute directives}
|
|
|
|
* with the aim of fully customizing the ToolbarComponent.
|
|
|
|
*
|
|
|
|
* | **Name** | **Type** | **Reference** |
|
|
|
|
* | :----------------------------: | :-------: | :---------------------------------------------: |
|
|
|
|
* | **screenshareButton** | `boolean` | {@link ToolbarScreenshareButtonDirective} |
|
|
|
|
* | **fullscreenButton** | `boolean` | {@link ToolbarFullscreenButtonDirective} |
|
|
|
|
* | **leaveButton** | `boolean` | {@link ToolbarLeaveButtonDirective} |
|
|
|
|
* | **chatPanelButton** | `boolean` | {@link ToolbarChatPanelButtonDirective} |
|
|
|
|
* | **participantsPanelButton** | `boolean` | {@link ToolbarParticipantsPanelButtonDirective} |
|
|
|
|
* | **displayLogo** | `boolean` | {@link ToolbarDisplayLogoDirective} |
|
|
|
|
* | **displaySessionName** | `boolean` | {@link ToolbarDisplaySessionNameDirective} |
|
|
|
|
*
|
|
|
|
* <p class="component-link-text">
|
|
|
|
* <span class="italic">See all {@link ApiDirectiveModule API Directives}</span>
|
|
|
|
* </p>
|
|
|
|
*
|
|
|
|
* </div>
|
|
|
|
* <div>
|
|
|
|
*
|
|
|
|
* <h3>OpenVidu Angular Directives</h3>
|
|
|
|
*
|
|
|
|
* The ToolbarComponent can be replaced with a custom component. It provides us the following {@link https://angular.io/guide/structural-directives Angular structural directives}
|
|
|
|
* for doing this.
|
|
|
|
*
|
|
|
|
* | **Directive** | **Reference** |
|
|
|
|
* |:----------------------------------:|:---------------------------------------------:|
|
|
|
|
* | ***ovToolbar** | {@link ToolbarDirective} |
|
|
|
|
*
|
|
|
|
* </br>
|
|
|
|
*
|
|
|
|
* It is also providing us a way to **add additional buttons** to the default toolbar.
|
|
|
|
* It will recognise the following directive in a child element.
|
|
|
|
*
|
|
|
|
* | **Directive** | **Reference** |
|
|
|
|
* |:----------------------------------:|:---------------------------------------------:|
|
|
|
|
* | ***ovToolbarAdditionalButtons** | {@link ToolbarAdditionalButtonsDirective} |
|
|
|
|
*
|
|
|
|
* <p class="component-link-text">
|
|
|
|
* <span class="italic">See all {@link OpenViduAngularDirectiveModule OpenVidu Angular Directives}</span>
|
|
|
|
* </p>
|
|
|
|
* </div>
|
|
|
|
* </div>
|
|
|
|
*/
|
|
|
|
|
2022-01-19 17:24:11 +01:00
|
|
|
@Component({
|
|
|
|
selector: 'ov-toolbar',
|
|
|
|
templateUrl: './toolbar.component.html',
|
2022-02-24 10:20:32 +01:00
|
|
|
styleUrls: ['./toolbar.component.css'],
|
|
|
|
changeDetection: ChangeDetectionStrategy.OnPush
|
2022-01-19 17:24:11 +01:00
|
|
|
})
|
|
|
|
export class ToolbarComponent implements OnInit, OnDestroy {
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
2022-03-10 11:42:48 +01:00
|
|
|
@ContentChild('toolbarAdditionalButtons', { read: TemplateRef }) toolbarAdditionalButtonsTemplate: TemplateRef<any>;
|
|
|
|
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
2022-03-10 11:42:48 +01:00
|
|
|
@ContentChild(ToolbarAdditionalButtonsDirective)
|
|
|
|
set externalAdditionalButtons(externalAdditionalButtons: ToolbarAdditionalButtonsDirective) {
|
|
|
|
// This directive will has value only when ADDITIONAL BUTTONS component tagget with '*ovToolbarAdditionalButtons' directive
|
|
|
|
// is inside of the TOOLBAR component tagged with '*ovToolbar' directive
|
|
|
|
if (externalAdditionalButtons) {
|
|
|
|
this.toolbarAdditionalButtonsTemplate = externalAdditionalButtons.template;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-09 15:31:21 +01:00
|
|
|
@Output() onLeaveButtonClicked = new EventEmitter<any>();
|
|
|
|
@Output() onCameraButtonClicked = new EventEmitter<any>();
|
|
|
|
@Output() onMicrophoneButtonClicked = new EventEmitter<any>();
|
|
|
|
@Output() onFullscreenButtonClicked = new EventEmitter<any>();
|
|
|
|
@Output() onScreenshareButtonClicked = new EventEmitter<any>();
|
|
|
|
@Output() onParticipantsPanelButtonClicked = new EventEmitter<any>();
|
|
|
|
@Output() onChatPanelButtonClicked = new EventEmitter<any>();
|
2022-01-19 17:24:11 +01:00
|
|
|
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
2022-01-19 17:24:11 +01:00
|
|
|
session: Session;
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
2022-01-19 17:24:11 +01:00
|
|
|
unreadMessages: number = 0;
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
2022-01-19 17:24:11 +01:00
|
|
|
messageList: ChatMessage[] = [];
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
2022-02-24 10:16:23 +01:00
|
|
|
isScreenShareActive: boolean;
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
2022-02-24 10:16:23 +01:00
|
|
|
isWebcamVideoActive: boolean;
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
2022-03-30 11:58:35 +02:00
|
|
|
isAudioActive: boolean;
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
2022-01-19 17:24:11 +01:00
|
|
|
isConnectionLost: boolean;
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
2022-01-19 17:24:11 +01:00
|
|
|
hasVideoDevices: boolean;
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
2022-01-19 17:24:11 +01:00
|
|
|
hasAudioDevices: boolean;
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
2022-02-24 10:16:23 +01:00
|
|
|
isFullscreenActive: boolean = false;
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
2022-01-19 17:24:11 +01:00
|
|
|
isChatOpened: boolean = false;
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
2022-01-19 17:24:11 +01:00
|
|
|
isParticipantsOpened: boolean = false;
|
|
|
|
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
2022-03-07 15:50:27 +01:00
|
|
|
isMinimal: boolean = false;
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
2022-03-07 15:50:27 +01:00
|
|
|
showScreenshareButton = true;
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
2022-03-07 15:50:27 +01:00
|
|
|
showFullscreenButton: boolean = true;
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
2022-03-07 15:50:27 +01:00
|
|
|
showLeaveButton: boolean = true;
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
2022-03-07 15:50:27 +01:00
|
|
|
showParticipantsPanelButton: boolean = true;
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
2022-03-07 15:50:27 +01:00
|
|
|
showChatPanelButton: boolean = true;
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
2022-03-07 15:50:27 +01:00
|
|
|
showLogo: boolean = true;
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
2022-03-07 15:50:27 +01:00
|
|
|
showSessionName: boolean = true;
|
2022-01-19 17:24:11 +01:00
|
|
|
|
2022-03-07 15:50:27 +01:00
|
|
|
private log: ILogger;
|
|
|
|
private minimalSub: Subscription;
|
|
|
|
private menuTogglingSubscription: Subscription;
|
|
|
|
private chatMessagesSubscription: Subscription;
|
|
|
|
private localParticipantSubscription: Subscription;
|
|
|
|
private screenshareButtonSub: Subscription;
|
|
|
|
private fullscreenButtonSub: Subscription;
|
|
|
|
private leaveButtonSub: Subscription;
|
|
|
|
private participantsPanelButtonSub: Subscription;
|
|
|
|
private chatPanelButtonSub: Subscription;
|
|
|
|
private displayLogoSub: Subscription;
|
|
|
|
private displaySessionNameSub: Subscription;
|
|
|
|
private currentWindowHeight = window.innerHeight;
|
2022-01-19 17:24:11 +01:00
|
|
|
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
|
|
|
constructor(
|
|
|
|
protected documentService: DocumentService,
|
|
|
|
protected chatService: ChatService,
|
2022-04-05 15:40:43 +02:00
|
|
|
protected panelService: PanelService,
|
2022-03-23 13:48:17 +01:00
|
|
|
protected tokenService: TokenService,
|
|
|
|
protected participantService: ParticipantService,
|
|
|
|
protected openviduService: OpenViduService,
|
|
|
|
protected oVDevicesService: DeviceService,
|
|
|
|
protected actionService: ActionService,
|
|
|
|
protected loggerSrv: LoggerService,
|
|
|
|
private cd: ChangeDetectorRef,
|
|
|
|
private libService: OpenViduAngularConfigService
|
|
|
|
) {
|
|
|
|
this.log = this.loggerSrv.get('ToolbarComponent');
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
2022-01-19 17:24:11 +01:00
|
|
|
@HostListener('window:resize', ['$event'])
|
|
|
|
sizeChange(event) {
|
2022-03-07 15:50:27 +01:00
|
|
|
if (this.currentWindowHeight >= window.innerHeight) {
|
2022-02-24 10:16:23 +01:00
|
|
|
// The user has exit the fullscreen mode
|
|
|
|
this.isFullscreenActive = false;
|
|
|
|
this.currentWindowHeight = window.innerHeight;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
2022-02-24 10:16:23 +01:00
|
|
|
@HostListener('document:keydown', ['$event'])
|
|
|
|
keyDown(event: KeyboardEvent) {
|
2022-03-07 15:50:27 +01:00
|
|
|
if (event.key === 'F11') {
|
2022-02-24 10:16:23 +01:00
|
|
|
event.preventDefault();
|
|
|
|
this.toggleFullscreen();
|
|
|
|
this.currentWindowHeight = window.innerHeight;
|
|
|
|
return false;
|
|
|
|
}
|
2022-01-19 17:24:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
async ngOnInit() {
|
2022-03-07 15:50:27 +01:00
|
|
|
this.subscribeToToolbarDirectives();
|
|
|
|
|
2022-01-19 17:24:11 +01:00
|
|
|
await this.oVDevicesService.initializeDevices();
|
|
|
|
this.hasVideoDevices = this.oVDevicesService.hasVideoDeviceAvailable();
|
|
|
|
this.hasAudioDevices = this.oVDevicesService.hasAudioDeviceAvailable();
|
2022-02-15 15:52:59 +01:00
|
|
|
this.session = this.openviduService.getWebcamSession();
|
2022-01-19 17:24:11 +01:00
|
|
|
|
|
|
|
this.subscribeToUserMediaProperties();
|
|
|
|
this.subscribeToReconnection();
|
2022-02-14 14:12:58 +01:00
|
|
|
this.subscribeToMenuToggling();
|
|
|
|
this.subscribeToChatMessages();
|
2022-01-19 17:24:11 +01:00
|
|
|
}
|
|
|
|
|
2022-03-07 15:50:27 +01:00
|
|
|
ngOnDestroy(): void {
|
|
|
|
if (this.menuTogglingSubscription) this.menuTogglingSubscription.unsubscribe();
|
|
|
|
if (this.chatMessagesSubscription) this.chatMessagesSubscription.unsubscribe();
|
|
|
|
if (this.localParticipantSubscription) this.localParticipantSubscription.unsubscribe();
|
|
|
|
if (this.screenshareButtonSub) this.screenshareButtonSub.unsubscribe();
|
|
|
|
if (this.fullscreenButtonSub) this.fullscreenButtonSub.unsubscribe();
|
|
|
|
if (this.leaveButtonSub) this.leaveButtonSub.unsubscribe();
|
|
|
|
if (this.participantsPanelButtonSub) this.participantsPanelButtonSub.unsubscribe();
|
|
|
|
if (this.chatPanelButtonSub) this.chatPanelButtonSub.unsubscribe();
|
|
|
|
if (this.displayLogoSub) this.displayLogoSub.unsubscribe();
|
|
|
|
if (this.displaySessionNameSub) this.displaySessionNameSub.unsubscribe();
|
2022-03-23 13:48:17 +01:00
|
|
|
if (this.minimalSub) this.minimalSub.unsubscribe();
|
2022-03-07 15:50:27 +01:00
|
|
|
}
|
|
|
|
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
2022-03-31 12:25:02 +02:00
|
|
|
async toggleMicrophone() {
|
2022-03-09 15:31:21 +01:00
|
|
|
this.onMicrophoneButtonClicked.emit();
|
2022-03-31 12:25:02 +02:00
|
|
|
try {
|
2022-04-01 13:24:56 +02:00
|
|
|
await this.openviduService.publishAudio(!this.isAudioActive);
|
2022-03-31 12:25:02 +02:00
|
|
|
} catch (error) {
|
|
|
|
this.log.e('There was an error toggling microphone:', error.code, error.message);
|
|
|
|
this.actionService.openDialog('There was an error toggling camera', error?.error || error?.message);
|
2022-01-19 17:24:11 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
2022-01-19 17:24:11 +01:00
|
|
|
async toggleCamera() {
|
2022-03-09 15:31:21 +01:00
|
|
|
this.onCameraButtonClicked.emit();
|
2022-01-19 17:24:11 +01:00
|
|
|
|
|
|
|
try {
|
2022-04-05 15:40:43 +02:00
|
|
|
const publishVideo = !this.participantService.isMyVideoActive();
|
2022-04-01 13:24:56 +02:00
|
|
|
await this.openviduService.publishVideo(publishVideo);
|
2022-01-19 17:24:11 +01:00
|
|
|
} catch (error) {
|
|
|
|
this.log.e('There was an error toggling camera:', error.code, error.message);
|
2022-03-31 12:25:02 +02:00
|
|
|
this.actionService.openDialog('There was an error toggling camera', error?.error || error?.message);
|
2022-01-19 17:24:11 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
2022-01-19 17:24:11 +01:00
|
|
|
async toggleScreenShare() {
|
2022-03-09 15:31:21 +01:00
|
|
|
this.onScreenshareButtonClicked.emit();
|
2022-01-19 17:24:11 +01:00
|
|
|
|
|
|
|
try {
|
2022-03-31 12:25:02 +02:00
|
|
|
await this.openviduService.toggleScreenshare();
|
2022-01-19 17:24:11 +01:00
|
|
|
} catch (error) {
|
2022-03-31 12:25:02 +02:00
|
|
|
this.log.e('There was an error toggling screen share', error.code, error.message);
|
|
|
|
if (error && error.name === 'SCREEN_SHARING_NOT_SUPPORTED') {
|
|
|
|
this.actionService.openDialog('Error sharing screen', 'Your browser does not support screen sharing');
|
|
|
|
}
|
2022-01-19 17:24:11 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
2022-01-19 17:24:11 +01:00
|
|
|
leaveSession() {
|
|
|
|
this.log.d('Leaving session...');
|
2022-02-15 15:52:59 +01:00
|
|
|
this.openviduService.disconnect();
|
2022-03-09 15:31:21 +01:00
|
|
|
this.onLeaveButtonClicked.emit();
|
|
|
|
}
|
|
|
|
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
2022-03-09 15:31:21 +01:00
|
|
|
toggleParticipantsPanel() {
|
|
|
|
this.onParticipantsPanelButtonClicked.emit();
|
2022-04-05 15:40:43 +02:00
|
|
|
this.panelService.toggleMenu(MenuType.PARTICIPANTS);
|
2022-01-19 17:24:11 +01:00
|
|
|
}
|
|
|
|
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
2022-03-09 15:31:21 +01:00
|
|
|
toggleChatPanel() {
|
|
|
|
this.onChatPanelButtonClicked.emit();
|
2022-04-05 15:40:43 +02:00
|
|
|
this.panelService.toggleMenu(MenuType.CHAT);
|
2022-01-19 17:24:11 +01:00
|
|
|
}
|
|
|
|
|
2022-03-23 13:48:17 +01:00
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
2022-01-19 17:24:11 +01:00
|
|
|
toggleFullscreen() {
|
2022-02-24 10:16:23 +01:00
|
|
|
this.isFullscreenActive = !this.isFullscreenActive;
|
2022-02-22 16:59:24 +01:00
|
|
|
this.documentService.toggleFullscreen('session-container');
|
2022-03-09 15:31:21 +01:00
|
|
|
this.onFullscreenButtonClicked.emit();
|
2022-01-19 17:24:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
protected subscribeToReconnection() {
|
|
|
|
this.session.on('reconnecting', () => {
|
2022-04-05 15:40:43 +02:00
|
|
|
if (this.panelService.isMenuOpened()) {
|
|
|
|
this.panelService.closeMenu();
|
2022-01-19 17:24:11 +01:00
|
|
|
}
|
|
|
|
this.isConnectionLost = true;
|
|
|
|
});
|
|
|
|
this.session.on('reconnected', () => {
|
|
|
|
this.isConnectionLost = false;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
protected subscribeToMenuToggling() {
|
2022-04-05 15:40:43 +02:00
|
|
|
this.menuTogglingSubscription = this.panelService.menuOpenedObs.subscribe((ev: { opened: boolean; type?: MenuType }) => {
|
2022-01-19 17:24:11 +01:00
|
|
|
this.isChatOpened = ev.opened && ev.type === MenuType.CHAT;
|
|
|
|
this.isParticipantsOpened = ev.opened && ev.type === MenuType.PARTICIPANTS;
|
|
|
|
if (this.isChatOpened) {
|
|
|
|
this.unreadMessages = 0;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
protected subscribeToChatMessages() {
|
|
|
|
this.chatMessagesSubscription = this.chatService.messagesObs.pipe(skip(1)).subscribe((messages) => {
|
2022-04-05 15:40:43 +02:00
|
|
|
if (!this.panelService.isMenuOpened()) {
|
2022-01-19 17:24:11 +01:00
|
|
|
this.unreadMessages++;
|
|
|
|
}
|
|
|
|
this.messageList = messages;
|
2022-02-24 10:20:32 +01:00
|
|
|
this.cd.markForCheck();
|
2022-01-19 17:24:11 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
protected subscribeToUserMediaProperties() {
|
2022-03-30 11:58:35 +02:00
|
|
|
this.localParticipantSubscription = this.participantService.localParticipantObs.subscribe((p: ParticipantAbstractModel) => {
|
2022-03-23 13:45:30 +01:00
|
|
|
if (p) {
|
2022-03-10 14:12:43 +01:00
|
|
|
this.isWebcamVideoActive = p.isCameraVideoActive();
|
2022-03-30 11:58:35 +02:00
|
|
|
this.isAudioActive = p.isCameraAudioActive() || p.isScreenAudioActive();
|
2022-03-10 14:12:43 +01:00
|
|
|
this.isScreenShareActive = p.isScreenActive();
|
|
|
|
this.cd.markForCheck();
|
|
|
|
}
|
2022-01-19 17:24:11 +01:00
|
|
|
});
|
|
|
|
}
|
2022-03-07 15:50:27 +01:00
|
|
|
|
|
|
|
private subscribeToToolbarDirectives() {
|
|
|
|
this.minimalSub = this.libService.minimalObs.subscribe((value: boolean) => {
|
|
|
|
this.isMinimal = value;
|
|
|
|
this.cd.markForCheck();
|
|
|
|
});
|
|
|
|
this.screenshareButtonSub = this.libService.screenshareButtonObs.subscribe((value: boolean) => {
|
|
|
|
this.showScreenshareButton = value;
|
|
|
|
this.cd.markForCheck();
|
|
|
|
});
|
|
|
|
this.fullscreenButtonSub = this.libService.fullscreenButtonObs.subscribe((value: boolean) => {
|
|
|
|
this.showFullscreenButton = value;
|
|
|
|
this.cd.markForCheck();
|
|
|
|
});
|
|
|
|
this.leaveButtonSub = this.libService.leaveButtonObs.subscribe((value: boolean) => {
|
|
|
|
this.showLeaveButton = value;
|
|
|
|
this.cd.markForCheck();
|
|
|
|
});
|
|
|
|
this.chatPanelButtonSub = this.libService.chatPanelButtonObs.subscribe((value: boolean) => {
|
|
|
|
this.showChatPanelButton = value;
|
|
|
|
this.cd.markForCheck();
|
|
|
|
});
|
|
|
|
this.participantsPanelButtonSub = this.libService.participantsPanelButtonObs.subscribe((value: boolean) => {
|
|
|
|
this.showParticipantsPanelButton = value;
|
|
|
|
this.cd.markForCheck();
|
|
|
|
});
|
|
|
|
this.displayLogoSub = this.libService.displayLogoObs.subscribe((value: boolean) => {
|
|
|
|
this.showLogo = value;
|
|
|
|
this.cd.markForCheck();
|
|
|
|
});
|
|
|
|
this.displaySessionNameSub = this.libService.displaySessionNameObs.subscribe((value: boolean) => {
|
|
|
|
this.showSessionName = value;
|
|
|
|
this.cd.markForCheck();
|
|
|
|
});
|
|
|
|
}
|
2022-01-19 17:24:11 +01:00
|
|
|
}
|