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 [@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-container *ngIf="openviduAngularToolbarTemplate">
|
||||
<ng-container *ngTemplateOutlet="openviduAngularToolbarTemplate"></ng-container>
|
||||
|
|
|
@ -401,6 +401,11 @@ export class VideoconferenceComponent implements OnInit, OnDestroy, AfterViewIni
|
|||
*/
|
||||
showPrejoin: boolean = true;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
isSessionInitialized: boolean = false;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
|
@ -431,17 +436,12 @@ export class VideoconferenceComponent implements OnInit, OnDestroy, AfterViewIni
|
|||
this.subscribeToVideconferenceDirectives();
|
||||
await this.deviceSrv.forceInitDevices();
|
||||
const nickname = this.externalParticipantName || this.storageSrv.getNickname() || `OpenVidu_User${Math.floor(Math.random() * 100)}`;
|
||||
const props: ParticipantProperties = {
|
||||
local: true,
|
||||
nickname
|
||||
};
|
||||
this.participantService.initLocalParticipant(props);
|
||||
this.participantService.initLocalParticipant({local: true, nickname});
|
||||
this.openviduService.initialize();
|
||||
|
||||
if (this.deviceSrv.hasVideoDeviceAvailable() || this.deviceSrv.hasAudioDeviceAvailable()) {
|
||||
await this.initwebcamPublisher();
|
||||
}
|
||||
|
||||
this.isSessionInitialized = true;
|
||||
this.onParticipantCreated.emit(this.participantService.getLocalParticipant());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue