2022-02-11 13:18:50 +01:00
|
|
|
import { Component, ContentChild, EventEmitter, Input, OnInit, Output, TemplateRef, ViewChild } from '@angular/core';
|
|
|
|
import { StreamDirective } from '../../directives/stream/stream.directive';
|
2022-01-20 11:53:56 +01:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'ov-videoconference',
|
|
|
|
templateUrl: './videoconference.component.html',
|
|
|
|
styleUrls: ['./videoconference.component.css']
|
|
|
|
})
|
|
|
|
export class VideoconferenceComponent implements OnInit {
|
2022-02-11 13:18:50 +01:00
|
|
|
streamTemplate: TemplateRef<any>;
|
2022-02-03 17:08:23 +01:00
|
|
|
|
2022-02-11 13:18:50 +01:00
|
|
|
@ContentChild(StreamDirective)
|
|
|
|
set customStream(customStream: StreamDirective) {
|
|
|
|
if (customStream) {
|
|
|
|
this.streamTemplate = customStream.template;
|
|
|
|
}
|
|
|
|
}
|
2022-01-20 11:53:56 +01:00
|
|
|
|
2022-02-11 13:18:50 +01:00
|
|
|
@Input() sessionName: string;
|
|
|
|
@Input() userName: string;
|
2022-01-20 11:53:56 +01:00
|
|
|
|
2022-02-04 10:54:17 +01:00
|
|
|
@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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-01-20 11:53:56 +01:00
|
|
|
|
2022-02-11 13:18:50 +01:00
|
|
|
// @Input() openviduServerUrl: string;
|
|
|
|
// @Input() openviduSecret: string;
|
|
|
|
|
|
|
|
@Output() onJoinClicked = new EventEmitter<any>();
|
|
|
|
@Output() onCloseClicked = new EventEmitter<any>();
|
|
|
|
|
|
|
|
joinSessionClicked: boolean = false;
|
|
|
|
closeClicked: boolean = false;
|
|
|
|
isSessionAlive: boolean = false;
|
|
|
|
_tokens: { webcam: string; screen: string };
|
|
|
|
error: boolean = false;
|
|
|
|
errorMessage: string = '';
|
|
|
|
|
|
|
|
constructor() {}
|
|
|
|
|
|
|
|
ngOnInit() {}
|
|
|
|
|
2022-02-04 10:54:17 +01:00
|
|
|
async _onJoinClicked() {
|
|
|
|
this.onJoinClicked.emit();
|
2022-01-20 11:53:56 +01:00
|
|
|
}
|
|
|
|
onLeaveSessionClicked() {
|
|
|
|
this.isSessionAlive = false;
|
|
|
|
this.closeClicked = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
onMicClicked() {}
|
|
|
|
|
|
|
|
onCamClicked() {}
|
|
|
|
|
|
|
|
onScreenShareClicked() {}
|
|
|
|
|
|
|
|
onSpeakerLayoutClicked() {}
|
|
|
|
}
|