2022-06-02 10:57:47 +02:00
|
|
|
import { Component, OnInit, Output, EventEmitter, ChangeDetectionStrategy, ChangeDetectorRef } from '@angular/core';
|
|
|
|
import { Subscription } from 'rxjs';
|
2022-04-25 16:17:32 +02:00
|
|
|
import { PanelType } from '../../../models/panel.model';
|
2022-06-02 10:57:47 +02:00
|
|
|
import { OpenViduAngularConfigService } from '../../../services/config/openvidu-angular.config.service';
|
2022-04-25 16:17:32 +02:00
|
|
|
import { PanelService } from '../../../services/panel/panel.service';
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'ov-activities-panel',
|
|
|
|
templateUrl: './activities-panel.component.html',
|
2022-06-02 10:57:47 +02:00
|
|
|
styleUrls: ['../panel.component.css', './activities-panel.component.css'],
|
|
|
|
changeDetection: ChangeDetectionStrategy.OnPush
|
2022-04-25 16:17:32 +02:00
|
|
|
})
|
|
|
|
export class ActivitiesPanelComponent implements OnInit {
|
2022-06-02 10:57:47 +02:00
|
|
|
/**
|
|
|
|
* Provides event notifications that fire when start recording button has been clicked.
|
|
|
|
* The recording should be stated using the OpenVidu REST API.
|
|
|
|
*/
|
|
|
|
@Output() onStartRecordingClicked: EventEmitter<void> = new EventEmitter<void>();
|
2022-04-25 16:17:32 +02:00
|
|
|
|
2022-06-02 10:57:47 +02:00
|
|
|
/**
|
|
|
|
* Provides event notifications that fire when stop recording button has been clicked.
|
|
|
|
* The recording should be stopped using the OpenVidu REST API.
|
|
|
|
*/
|
|
|
|
@Output() onStopRecordingClicked: EventEmitter<void> = new EventEmitter<void>();
|
2022-04-25 16:17:32 +02:00
|
|
|
|
2022-06-02 10:57:47 +02:00
|
|
|
/**
|
|
|
|
* Provides event notifications that fire when download recording button has been clicked.
|
|
|
|
* The recording should be downloaded using the OpenVidu REST API.
|
|
|
|
*/
|
|
|
|
@Output() onDownloadRecordingClicked: EventEmitter<string> = new EventEmitter<string>();
|
|
|
|
/**
|
|
|
|
* Provides event notifications that fire when delete recording button has been clicked.
|
|
|
|
* The recording should be deleted using the OpenVidu REST API.
|
|
|
|
*/
|
|
|
|
@Output() onDeleteRecordingClicked: EventEmitter<string> = new EventEmitter<string>();
|
|
|
|
/**
|
|
|
|
* Provides event notifications that fire when play recording button has been clicked.
|
|
|
|
*/
|
|
|
|
@Output() onPlayRecordingClicked: EventEmitter<string> = new EventEmitter<string>();
|
2022-04-25 16:17:32 +02:00
|
|
|
|
2022-06-02 10:57:47 +02:00
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
*/
|
|
|
|
expandedPanel: string = '';
|
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
*/
|
|
|
|
showRecordingActivity: boolean = true;
|
|
|
|
private panelSubscription: Subscription;
|
|
|
|
private recordingActivitySub: Subscription;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
*/
|
|
|
|
constructor(private panelService: PanelService, private libService: OpenViduAngularConfigService, private cd: ChangeDetectorRef) {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
*/
|
|
|
|
ngOnInit(): void {
|
|
|
|
this.subscribeToPanelToggling();
|
|
|
|
this.subscribeToActivitiesPanelDirective();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
*/
|
|
|
|
ngOnDestroy() {
|
|
|
|
if (this.panelSubscription) this.panelSubscription.unsubscribe();
|
|
|
|
if (this.recordingActivitySub) this.recordingActivitySub.unsubscribe();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
*/
|
2022-04-25 16:17:32 +02:00
|
|
|
close() {
|
|
|
|
this.panelService.togglePanel(PanelType.ACTIVITIES);
|
|
|
|
}
|
2022-06-02 10:57:47 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
*/
|
|
|
|
_onStartRecordingClicked() {
|
|
|
|
this.onStartRecordingClicked.emit();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
*/
|
|
|
|
_onStopRecordingClicked() {
|
|
|
|
this.onStopRecordingClicked.emit();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
*/
|
|
|
|
_onDownloadRecordingClicked(recordingId: string) {
|
|
|
|
this.onDownloadRecordingClicked.emit(recordingId);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
*/
|
|
|
|
_onDeleteRecordingClicked(recordingId: string) {
|
|
|
|
this.onDeleteRecordingClicked.emit(recordingId);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
*/
|
|
|
|
_onPlayRecordingClicked(recordingId: string) {
|
|
|
|
this.onPlayRecordingClicked.emit(recordingId);
|
|
|
|
}
|
|
|
|
|
|
|
|
private subscribeToPanelToggling() {
|
|
|
|
this.panelSubscription = this.panelService.panelOpenedObs.subscribe(
|
|
|
|
(ev: { opened: boolean; type?: PanelType | string; expand?: string }) => {
|
|
|
|
if (ev.type === PanelType.ACTIVITIES) {
|
|
|
|
this.expandedPanel = ev.expand;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
private subscribeToActivitiesPanelDirective() {
|
|
|
|
this.recordingActivitySub = this.libService.recordingActivity.subscribe((value: boolean) => {
|
|
|
|
this.showRecordingActivity = value;
|
|
|
|
this.cd.markForCheck();
|
|
|
|
});
|
|
|
|
}
|
2022-04-25 16:17:32 +02:00
|
|
|
}
|