frontend: refactor playRecording method to generate recording URL and open it in a new tab

This commit is contained in:
juancarmore 2025-07-25 22:12:36 +02:00
parent ed6af7a7ff
commit 96dd1a1137
4 changed files with 13 additions and 15 deletions

View File

@ -122,8 +122,8 @@ export class RecordingsComponent implements OnInit {
await this.loadRecordings(filters); await this.loadRecordings(filters);
} }
private playRecording(recording: MeetRecordingInfo) { private async playRecording(recording: MeetRecordingInfo) {
this.recordingService.playRecording(recording.recordingId); await this.recordingService.playRecording(recording.recordingId);
} }
private downloadRecording(recording: MeetRecordingInfo) { private downloadRecording(recording: MeetRecordingInfo) {

View File

@ -130,8 +130,8 @@ export class RoomRecordingsComponent implements OnInit {
await this.loadRecordings(); await this.loadRecordings();
} }
private playRecording(recording: MeetRecordingInfo) { private async playRecording(recording: MeetRecordingInfo) {
this.recordingService.playRecording(recording.recordingId); await this.recordingService.playRecording(recording.recordingId);
} }
private downloadRecording(recording: MeetRecordingInfo) { private downloadRecording(recording: MeetRecordingInfo) {

View File

@ -410,9 +410,7 @@ export class VideoRoomComponent implements OnInit {
async onViewRecordingsClicked(recordingId?: any) { async onViewRecordingsClicked(recordingId?: any) {
if (recordingId) { if (recordingId) {
const privateAccess = await this.authService.isUserAuthenticated(); await this.recordingService.playRecording(recordingId);
const { url } = await this.recordingService.generateRecordingUrl(recordingId, privateAccess);
window.open(url, '_blank');
} else { } else {
window.open(`/room/${this.roomId}/recordings?secret=${this.roomSecret}`, '_blank'); window.open(`/room/${this.roomId}/recordings?secret=${this.roomSecret}`, '_blank');
} }

View File

@ -1,10 +1,10 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { MatDialog } from '@angular/material/dialog'; import { MatDialog } from '@angular/material/dialog';
import { ShareRecordingDialogComponent } from '@lib/components'; import { ShareRecordingDialogComponent } from '@lib/components';
import { HttpService, ParticipantTokenService } from '@lib/services'; import { AuthService, HttpService, ParticipantTokenService } from '@lib/services';
import { MeetRecordingFilters, MeetRecordingInfo, RecordingPermissions } from '@lib/typings/ce'; import { MeetRecordingFilters, MeetRecordingInfo, RecordingPermissions } from '@lib/typings/ce';
import { getValidDecodedToken } from '@lib/utils'; import { getValidDecodedToken } from '@lib/utils';
import { ActionService, LoggerService } from 'openvidu-components-angular'; import { LoggerService } from 'openvidu-components-angular';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
@ -24,7 +24,7 @@ export class RecordingManagerService {
protected loggerService: LoggerService, protected loggerService: LoggerService,
private httpService: HttpService, private httpService: HttpService,
protected participantService: ParticipantTokenService, protected participantService: ParticipantTokenService,
private actionService: ActionService, protected authService: AuthService,
protected dialog: MatDialog protected dialog: MatDialog
) { ) {
this.log = this.loggerService.get('OpenVidu Meet - RecordingManagerService'); this.log = this.loggerService.get('OpenVidu Meet - RecordingManagerService');
@ -215,14 +215,14 @@ export class RecordingManagerService {
} }
/** /**
* Plays a recording by opening a dialog with the recording player * Plays a recording by generating a URL and opening it in a new tab
* *
* @param recordingId - The ID of the recording to play * @param recordingId - The ID of the recording to play
* @param secret - Optional secret for accessing the recording
*/ */
playRecording(recordingId: string, secret?: string) { async playRecording(recordingId: string) {
const recordingUrl = this.getRecordingMediaUrl(recordingId, secret); const privateAccess = await this.authService.isUserAuthenticated();
this.actionService.openRecordingPlayerDialog(recordingUrl); const { url } = await this.generateRecordingUrl(recordingId, privateAccess);
window.open(url, '_blank');
} }
/** /**