openvidu-components: Fixed video recording cache

The browser was storing the play recording request on cache . Adding a query parameter which is updated each time fix this problem
pull/803/head
Carlos Santos 2023-04-25 12:40:21 +02:00
parent fffbdd3cd5
commit f5e18fc11d
1 changed files with 5 additions and 3 deletions

View File

@ -19,7 +19,6 @@ export class RecordingService {
private recordingStatus = <BehaviorSubject<{ info: RecordingInfo; time?: Date } | undefined>>new BehaviorSubject(undefined); private recordingStatus = <BehaviorSubject<{ info: RecordingInfo; time?: Date } | undefined>>new BehaviorSubject(undefined);
private baseUrl = '/' + (!!window.location.pathname.split('/')[1] ? window.location.pathname.split('/')[1] + '/' : ''); private baseUrl = '/' + (!!window.location.pathname.split('/')[1] ? window.location.pathname.split('/')[1] + '/' : '');
/** /**
* @internal * @internal
*/ */
@ -72,7 +71,10 @@ export class RecordingService {
const recordingId = recording.id; const recordingId = recording.id;
// Only COMPOSED recording is supported. The extension will allways be 'mp4'. // Only COMPOSED recording is supported. The extension will allways be 'mp4'.
const extension = 'mp4'; //recording.url?.split('.').pop() || 'mp4'; const extension = 'mp4'; //recording.url?.split('.').pop() || 'mp4';
this.actionService.openRecordingPlayerDialog(`${this.baseUrl}recordings/${recordingId}/${recordingId}.${extension}`); const queryParamForAvoidCache = `?t=${new Date().getTime()}`;
this.actionService.openRecordingPlayerDialog(
`${this.baseUrl}recordings/${recordingId}/${recordingId}.${extension}${queryParamForAvoidCache}`
);
} }
/** /**
@ -106,7 +108,7 @@ export class RecordingService {
this.recordingTime = new Date(); this.recordingTime = new Date();
this.recordingTime.setHours(0, 0, 0, 0); this.recordingTime.setHours(0, 0, 0, 0);
this.recordingTimeInterval = setInterval(() => { this.recordingTimeInterval = setInterval(() => {
if(this.recordingTime) { if (this.recordingTime) {
this.recordingTime.setSeconds(this.recordingTime.getSeconds() + 1); this.recordingTime.setSeconds(this.recordingTime.getSeconds() + 1);
this.recordingTime = new Date(this.recordingTime.getTime()); this.recordingTime = new Date(this.recordingTime.getTime());
this.recordingStatus.next({ info: this.currentRecording, time: this.recordingTime }); this.recordingStatus.next({ info: this.currentRecording, time: this.recordingTime });