import { Component, ContentChild, EventEmitter, Input, OnInit, Output, TemplateRef } from '@angular/core'; @Component({ selector: 'ov-videoconference', templateUrl: './videoconference.component.html', styleUrls: ['./videoconference.component.css'] }) export class VideoconferenceComponent implements OnInit { @ContentChild('toolbar', { read: TemplateRef }) toolbarTemplate: TemplateRef; @ContentChild('layout', { read: TemplateRef }) layoutTemplate: TemplateRef; @ContentChild('panel', { read: TemplateRef }) panelTemplate: TemplateRef; @ContentChild('chatPanel', { read: TemplateRef }) chatPanelTemplate: TemplateRef; @ContentChild('participantsPanel', { read: TemplateRef }) participantsPanelTemplate: TemplateRef; @ContentChild('stream', { read: TemplateRef }) streamTemplate: TemplateRef; @Input() sessionName: string; @Input() userName: string; // @Input() openviduServerUrl: string; // @Input() openviduSecret: string; @Output() onJoinClicked = new EventEmitter(); @Output() onCloseClicked = new EventEmitter(); joinSessionClicked: boolean = false; closeClicked: boolean = false; isSessionAlive: boolean = false; _tokens: { webcam: string; screen: string }; error: boolean = false; errorMessage: string = ''; constructor() {} ngOnInit() {} @Input() set tokens(tokens: { webcam: string; screen: string }) { if (!tokens || (!tokens.webcam && !tokens.screen)) { //No tokens received // throw new Error('No tokens received'); console.warn('No tokens received'); } else { if (tokens.webcam || tokens.screen) { this._tokens = { webcam: tokens.webcam, screen: tokens.screen }; this.joinSessionClicked = true; this.isSessionAlive = true; } } } async _onJoinClicked() { this.onJoinClicked.emit(); } onLeaveSessionClicked() { this.isSessionAlive = false; this.closeClicked = true; } onMicClicked() {} onCamClicked() {} onScreenShareClicked() {} onSpeakerLayoutClicked() {} }