frontend: pass secret parameter to downloadRecording method and update usage in ViewRecordingComponent

This commit is contained in:
juancarmore 2025-09-24 12:53:14 +02:00
parent 358b519b78
commit b97da07bea
2 changed files with 8 additions and 6 deletions

View File

@ -30,6 +30,8 @@ import { ViewportService } from 'openvidu-components-angular';
export class ViewRecordingComponent implements OnInit, OnDestroy { export class ViewRecordingComponent implements OnInit, OnDestroy {
recording?: MeetRecordingInfo; recording?: MeetRecordingInfo;
recordingUrl?: string; recordingUrl?: string;
secret?: string;
videoError = false; videoError = false;
isLoading = true; isLoading = true;
hasError = false; hasError = false;
@ -53,7 +55,7 @@ export class ViewRecordingComponent implements OnInit, OnDestroy {
private async loadRecording() { private async loadRecording() {
const recordingId = this.route.snapshot.params['recording-id']; const recordingId = this.route.snapshot.params['recording-id'];
const secret = this.route.snapshot.queryParams['secret']; this.secret = this.route.snapshot.queryParams['secret'];
if (!recordingId) { if (!recordingId) {
this.hasError = true; this.hasError = true;
@ -62,10 +64,10 @@ export class ViewRecordingComponent implements OnInit, OnDestroy {
} }
try { try {
this.recording = await this.recordingService.getRecording(recordingId, secret); this.recording = await this.recordingService.getRecording(recordingId, this.secret);
if (this.recording.status === MeetRecordingStatus.COMPLETE) { if (this.recording.status === MeetRecordingStatus.COMPLETE) {
this.recordingUrl = this.recordingService.getRecordingMediaUrl(recordingId, secret); this.recordingUrl = this.recordingService.getRecordingMediaUrl(recordingId, this.secret);
} }
} catch (error) { } catch (error) {
console.error('Error fetching recording:', error); console.error('Error fetching recording:', error);
@ -97,7 +99,7 @@ export class ViewRecordingComponent implements OnInit, OnDestroy {
return; return;
} }
this.recordingService.downloadRecording(this.recording); this.recordingService.downloadRecording(this.recording, this.secret);
} }
openShareDialog() { openShareDialog() {

View File

@ -245,8 +245,8 @@ export class RecordingService {
* *
* @param recording - The recording information containing the ID and filename * @param recording - The recording information containing the ID and filename
*/ */
downloadRecording(recording: MeetRecordingInfo) { downloadRecording(recording: MeetRecordingInfo, secret?: string) {
const recordingUrl = this.getRecordingMediaUrl(recording.recordingId); const recordingUrl = this.getRecordingMediaUrl(recording.recordingId, secret);
const link = document.createElement('a'); const link = document.createElement('a');
link.href = recordingUrl; link.href = recordingUrl;
link.download = recording.filename || `${recording.recordingId}.mp4`; link.download = recording.filename || `${recording.recordingId}.mp4`;