mirror of https://github.com/OpenVidu/openvidu.git
openvidu-components: Fixed possible access to undefined
parent
af8c4ec9d4
commit
4af0e85341
|
@ -176,15 +176,15 @@ export class RecordingActivityComponent implements OnInit {
|
|||
|
||||
private subscribeToRecordingStatus() {
|
||||
this.recordingStatusSubscription = this.recordingService.recordingStatusObs.subscribe(
|
||||
(ev: { info: RecordingInfo; time?: Date }) => {
|
||||
(ev?: { info: RecordingInfo; time?: Date }) => {
|
||||
if (ev?.info) {
|
||||
if (this.recordingStatus !== RecordingStatus.FAILED) {
|
||||
this.oldRecordingStatus = this.recordingStatus;
|
||||
}
|
||||
this.recordingStatus = ev.info.status;
|
||||
this.recordingAlive = ev.info.status === RecordingStatus.STARTED;
|
||||
this.cd.markForCheck();
|
||||
}
|
||||
this.cd.markForCheck();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
@ -695,12 +695,15 @@ export class ToolbarComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||
}
|
||||
|
||||
private subscribeToRecordingStatus() {
|
||||
this.recordingSubscription = this.recordingService.recordingStatusObs.subscribe((ev: { info: RecordingInfo; time?: Date }) => {
|
||||
this.recordingStatus = ev.info.status;
|
||||
if (ev.time) {
|
||||
this.recordingTime = ev.time;
|
||||
this.recordingSubscription = this.recordingService.recordingStatusObs.subscribe((ev?: { info: RecordingInfo; time?: Date }) => {
|
||||
if (ev) {
|
||||
this.recordingStatus = ev.info.status;
|
||||
|
||||
if (ev?.time) {
|
||||
this.recordingTime = ev.time;
|
||||
}
|
||||
this.cd.markForCheck();
|
||||
}
|
||||
this.cd.markForCheck();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -11,12 +11,12 @@ export class RecordingService {
|
|||
/**
|
||||
* Recording status Observable which pushes the recording state in every update.
|
||||
*/
|
||||
recordingStatusObs: Observable<{ info: RecordingInfo; time?: Date }>;
|
||||
recordingStatusObs: Observable<{ info: RecordingInfo; time?: Date } | undefined>;
|
||||
|
||||
private recordingTime: Date | undefined;
|
||||
private recordingTimeInterval: NodeJS.Timer;
|
||||
private currentRecording: RecordingInfo = { status: RecordingStatus.STOPPED };
|
||||
private recordingStatus = <BehaviorSubject<{ info: RecordingInfo; time?: Date | undefined } | 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] + '/' : '');
|
||||
|
||||
|
||||
|
@ -106,9 +106,11 @@ export class RecordingService {
|
|||
this.recordingTime = new Date();
|
||||
this.recordingTime.setHours(0, 0, 0, 0);
|
||||
this.recordingTimeInterval = setInterval(() => {
|
||||
this.recordingTime.setSeconds(this.recordingTime.getSeconds() + 1);
|
||||
this.recordingTime = new Date(this.recordingTime.getTime());
|
||||
this.recordingStatus.next({ info: this.currentRecording, time: this.recordingTime });
|
||||
if(this.recordingTime) {
|
||||
this.recordingTime.setSeconds(this.recordingTime.getSeconds() + 1);
|
||||
this.recordingTime = new Date(this.recordingTime.getTime());
|
||||
this.recordingStatus.next({ info: this.currentRecording, time: this.recordingTime });
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue