mirror of https://github.com/OpenVidu/openvidu.git
openvidu-components: Fixed race condition with session initialization
When prejoin component is disabled, the Session component was initialized before the videoconference component initialization had finishedpull/743/head
parent
25972260ac
commit
95e5e977da
|
@ -15,7 +15,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div [@inOutAnimation] id="session-container" *ngIf="showVideoconference || (!showPrejoin && !loading && !error)">
|
<div [@inOutAnimation] id="session-container" *ngIf="showVideoconference || (!showPrejoin && !loading && !error)">
|
||||||
<ov-session (onSessionCreated)="_onSessionCreated($event)">
|
<ov-session (onSessionCreated)="_onSessionCreated($event)" *ngIf="isSessionInitialized">
|
||||||
<ng-template #toolbar>
|
<ng-template #toolbar>
|
||||||
<ng-container *ngIf="openviduAngularToolbarTemplate">
|
<ng-container *ngIf="openviduAngularToolbarTemplate">
|
||||||
<ng-container *ngTemplateOutlet="openviduAngularToolbarTemplate"></ng-container>
|
<ng-container *ngTemplateOutlet="openviduAngularToolbarTemplate"></ng-container>
|
||||||
|
|
|
@ -401,6 +401,11 @@ export class VideoconferenceComponent implements OnInit, OnDestroy, AfterViewIni
|
||||||
*/
|
*/
|
||||||
showPrejoin: boolean = true;
|
showPrejoin: boolean = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
isSessionInitialized: boolean = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
|
@ -431,17 +436,12 @@ export class VideoconferenceComponent implements OnInit, OnDestroy, AfterViewIni
|
||||||
this.subscribeToVideconferenceDirectives();
|
this.subscribeToVideconferenceDirectives();
|
||||||
await this.deviceSrv.forceInitDevices();
|
await this.deviceSrv.forceInitDevices();
|
||||||
const nickname = this.externalParticipantName || this.storageSrv.getNickname() || `OpenVidu_User${Math.floor(Math.random() * 100)}`;
|
const nickname = this.externalParticipantName || this.storageSrv.getNickname() || `OpenVidu_User${Math.floor(Math.random() * 100)}`;
|
||||||
const props: ParticipantProperties = {
|
this.participantService.initLocalParticipant({local: true, nickname});
|
||||||
local: true,
|
|
||||||
nickname
|
|
||||||
};
|
|
||||||
this.participantService.initLocalParticipant(props);
|
|
||||||
this.openviduService.initialize();
|
this.openviduService.initialize();
|
||||||
|
|
||||||
if (this.deviceSrv.hasVideoDeviceAvailable() || this.deviceSrv.hasAudioDeviceAvailable()) {
|
if (this.deviceSrv.hasVideoDeviceAvailable() || this.deviceSrv.hasAudioDeviceAvailable()) {
|
||||||
await this.initwebcamPublisher();
|
await this.initwebcamPublisher();
|
||||||
}
|
}
|
||||||
|
this.isSessionInitialized = true;
|
||||||
this.onParticipantCreated.emit(this.participantService.getLocalParticipant());
|
this.onParticipantCreated.emit(this.participantService.getLocalParticipant());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue