mirror of https://github.com/OpenVidu/openvidu.git
openvidu-copmponents: Updated recording and admin dashboard
parent
b2dc5da33c
commit
c71848ec3c
|
@ -1,6 +1,11 @@
|
||||||
<div class="dashboard-container">
|
<div class="dashboard-container">
|
||||||
<mat-toolbar class="header">
|
<mat-toolbar class="header">
|
||||||
<span>{{ 'ADMIN.DASHBOARD' | translate }}</span>
|
<span>{{ 'ADMIN.DASHBOARD' | translate }}</span>
|
||||||
|
<div class="refresh-btn">
|
||||||
|
<button matSuffix mat-icon-button aria-label="Refresh" (click)="logout()">
|
||||||
|
<mat-icon>logout</mat-icon>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</mat-toolbar>
|
</mat-toolbar>
|
||||||
|
|
||||||
<div class="dashboard-body">
|
<div class="dashboard-body">
|
||||||
|
@ -67,7 +72,7 @@
|
||||||
(recording.properties.outputMode === 'COMPOSED' ||
|
(recording.properties.outputMode === 'COMPOSED' ||
|
||||||
recording.properties.outputMode === 'COMPOSED_QUICK_START')
|
recording.properties.outputMode === 'COMPOSED_QUICK_START')
|
||||||
"
|
"
|
||||||
[src]="getThumbnailSrc(recording)"
|
[src]="recording.thumbnailB64"
|
||||||
/>
|
/>
|
||||||
<div class="video-btns">
|
<div class="video-btns">
|
||||||
<button
|
<button
|
||||||
|
@ -77,7 +82,7 @@
|
||||||
recording.properties.outputMode !== 'INDIVIDUAL'
|
recording.properties.outputMode !== 'INDIVIDUAL'
|
||||||
"
|
"
|
||||||
mat-icon-button
|
mat-icon-button
|
||||||
(click)="play(recording)"
|
(click)="play(recording.id)"
|
||||||
>
|
>
|
||||||
<mat-icon id="play" aria-label="Play" title="{{ 'PANEL.RECORDING.PLAY' | translate }}"
|
<mat-icon id="play" aria-label="Play" title="{{ 'PANEL.RECORDING.PLAY' | translate }}"
|
||||||
>play_arrow</mat-icon
|
>play_arrow</mat-icon
|
||||||
|
|
|
@ -3,7 +3,6 @@ import { Subscription } from 'rxjs';
|
||||||
import { RecordingInfo } from '../../models/recording.model';
|
import { RecordingInfo } from '../../models/recording.model';
|
||||||
import { ActionService } from '../../services/action/action.service';
|
import { ActionService } from '../../services/action/action.service';
|
||||||
import { OpenViduAngularConfigService } from '../../services/config/openvidu-angular.config.service';
|
import { OpenViduAngularConfigService } from '../../services/config/openvidu-angular.config.service';
|
||||||
import { RecordingService } from '../../services/recording/recording.service';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ov-admin-dashboard',
|
selector: 'ov-admin-dashboard',
|
||||||
|
@ -36,6 +35,11 @@ export class AdminDashboardComponent implements OnInit, OnDestroy {
|
||||||
*/
|
*/
|
||||||
@Output() onRefreshRecordingsClicked: EventEmitter<void> = new EventEmitter<void>();
|
@Output() onRefreshRecordingsClicked: EventEmitter<void> = new EventEmitter<void>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides event notifications that fire when logout button has been clicked.
|
||||||
|
*/
|
||||||
|
@Output() onLogoutClicked: EventEmitter<void> = new EventEmitter<void>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
|
@ -58,7 +62,7 @@ export class AdminDashboardComponent implements OnInit, OnDestroy {
|
||||||
*/
|
*/
|
||||||
constructor(
|
constructor(
|
||||||
private actionService: ActionService,
|
private actionService: ActionService,
|
||||||
private recordingService: RecordingService,
|
|
||||||
private libService: OpenViduAngularConfigService
|
private libService: OpenViduAngularConfigService
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
|
@ -68,10 +72,21 @@ export class AdminDashboardComponent implements OnInit, OnDestroy {
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.subscribeToAdminDirectives();
|
this.subscribeToAdminDirectives();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
if (this.adminSubscription) this.adminSubscription.unsubscribe();
|
if (this.adminSubscription) this.adminSubscription.unsubscribe();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
logout() {
|
||||||
|
this.onLogoutClicked.emit();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
|
@ -120,13 +135,6 @@ export class AdminDashboardComponent implements OnInit, OnDestroy {
|
||||||
this.sortByLegend = 'Size';
|
this.sortByLegend = 'Size';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @internal
|
|
||||||
*/
|
|
||||||
getThumbnailSrc(recording: RecordingInfo): string {
|
|
||||||
return !recording.url ? '' : recording.url.substring(0, recording.url.lastIndexOf('/')) + '/' + recording.id + '.jpg';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
|
@ -141,8 +149,6 @@ export class AdminDashboardComponent implements OnInit, OnDestroy {
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
download(recordingId: string) {
|
download(recordingId: string) {
|
||||||
//TODO solucionar el tema del login.
|
|
||||||
// TODO Si soy capaz de loguearme en openvidu al hacer login en el dashboard, no necesitaria emitir evento
|
|
||||||
this.onDownloadRecordingClicked.emit(recordingId);
|
this.onDownloadRecordingClicked.emit(recordingId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,8 +162,8 @@ export class AdminDashboardComponent implements OnInit, OnDestroy {
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
async play(recording: RecordingInfo) {
|
async play(recordingId: string) {
|
||||||
this.actionService.openRecordingPlayerDialog(recording.url, 'video/mp4', true);
|
this.onPlayRecordingClicked.emit(recordingId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private subscribeToAdminDirectives() {
|
private subscribeToAdminDirectives() {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { MatDialog, MatDialogConfig, MatDialogRef } from '@angular/material/dialog';
|
import { MatDialog, MatDialogConfig, MatDialogRef } from '@angular/material/dialog';
|
||||||
import { MatSnackBar } from '@angular/material/snack-bar';
|
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||||
import { SafeResourceUrl } from '@angular/platform-browser';
|
import { SafeResourceUrl, SafeUrl } from '@angular/platform-browser';
|
||||||
import { Subscription } from 'rxjs';
|
import { Subscription } from 'rxjs';
|
||||||
import { DeleteDialogComponent } from '../../components/dialogs/delete-recording.component';
|
import { DeleteDialogComponent } from '../../components/dialogs/delete-recording.component';
|
||||||
import { RecordingDialogComponent } from '../../components/dialogs/recording-dialog.component';
|
import { RecordingDialogComponent } from '../../components/dialogs/recording-dialog.component';
|
||||||
|
@ -68,7 +68,7 @@ export class ActionService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
openRecordingPlayerDialog(src: SafeResourceUrl, type: string, allowClose = true) {
|
openRecordingPlayerDialog(src: SafeUrl, type: string, allowClose = true) {
|
||||||
try {
|
try {
|
||||||
this.closeDialog();
|
this.closeDialog();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
|
@ -69,9 +69,9 @@ export class RecordingService {
|
||||||
* Play the recording blob received as parameter. This parameter must be obtained from backend using the OpenVidu REST API
|
* Play the recording blob received as parameter. This parameter must be obtained from backend using the OpenVidu REST API
|
||||||
* @param blob
|
* @param blob
|
||||||
*/
|
*/
|
||||||
playRecording(blob: Blob) {
|
playRecording(file: Blob) {
|
||||||
const src = URL.createObjectURL(blob);
|
const src = this.sanitizer.bypassSecurityTrustUrl(URL.createObjectURL(file));
|
||||||
this.actionService.openRecordingPlayerDialog(this.sanitizer.bypassSecurityTrustResourceUrl(src), blob.type, true);
|
this.actionService.openRecordingPlayerDialog(src, file.type, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -81,7 +81,7 @@ export class RecordingService {
|
||||||
* @param blob
|
* @param blob
|
||||||
*/
|
*/
|
||||||
downloadRecording(fileName: string, blob: Blob) {
|
downloadRecording(fileName: string, blob: Blob) {
|
||||||
const data = window.URL.createObjectURL(blob);
|
const data = URL.createObjectURL(blob);
|
||||||
const link = document.createElement('a');
|
const link = document.createElement('a');
|
||||||
link.href = data;
|
link.href = data;
|
||||||
link.download = `${fileName}.mp4`;
|
link.download = `${fileName}.mp4`;
|
||||||
|
|
Loading…
Reference in New Issue