Merge pull request #5750 from tsiegleauq/avoid-zombie-jitsi
Avoid stream/jitsi cases without information
This commit is contained in:
commit
5cc464b250
@ -200,8 +200,7 @@
|
|||||||
*ngIf="(canSeeLiveStream && !streamActiveInAnotherTab) || streamRunning"
|
*ngIf="(canSeeLiveStream && !streamActiveInAnotherTab) || streamRunning"
|
||||||
></os-vjs-player>
|
></os-vjs-player>
|
||||||
<div class="disconnected" *ngIf="streamActiveInAnotherTab && !streamRunning">
|
<div class="disconnected" *ngIf="streamActiveInAnotherTab && !streamRunning">
|
||||||
<span>{{ 'The livestream is already running in your OpenSlides session.' | translate }}</span>
|
<button class="restart-stream-button" mat-button color="warn" (click)="deleteStreamingLock()">
|
||||||
<button mat-button color="warn" (click)="deleteStreamingLock()">
|
|
||||||
<span>{{ 'Restart livestream' | translate }}</span>
|
<span>{{ 'Restart livestream' | translate }}</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -81,8 +81,6 @@ export class JitsiComponent extends BaseViewComponentDirective implements OnInit
|
|||||||
public enableJitsi: boolean;
|
public enableJitsi: boolean;
|
||||||
|
|
||||||
private autoconnect: boolean;
|
private autoconnect: boolean;
|
||||||
private startWithMicMuted: boolean;
|
|
||||||
private startWithVideoMuted: boolean;
|
|
||||||
private roomName: string;
|
private roomName: string;
|
||||||
private roomPassword: string;
|
private roomPassword: string;
|
||||||
private jitsiDomain: string;
|
private jitsiDomain: string;
|
||||||
@ -95,7 +93,7 @@ export class JitsiComponent extends BaseViewComponentDirective implements OnInit
|
|||||||
private isPasswortSet = false;
|
private isPasswortSet = false;
|
||||||
|
|
||||||
public isJitsiDialogOpen = false;
|
public isJitsiDialogOpen = false;
|
||||||
public showJitsiWindow = false;
|
public showJitsiWindow = true;
|
||||||
public muted = true;
|
public muted = true;
|
||||||
|
|
||||||
@ViewChild('jitsi')
|
@ViewChild('jitsi')
|
||||||
@ -123,7 +121,6 @@ export class JitsiComponent extends BaseViewComponentDirective implements OnInit
|
|||||||
|
|
||||||
private RTC_LOGGED_STORAGE_KEY = 'rtcIsLoggedIn';
|
private RTC_LOGGED_STORAGE_KEY = 'rtcIsLoggedIn';
|
||||||
private STREAM_RUNNING_STORAGE_KEY = 'streamIsRunning';
|
private STREAM_RUNNING_STORAGE_KEY = 'streamIsRunning';
|
||||||
private CONFERENCE_STATE_STORAGE_KEY = 'conferenceState';
|
|
||||||
|
|
||||||
// JitsiID to ConferenceMember
|
// JitsiID to ConferenceMember
|
||||||
public members = {};
|
public members = {};
|
||||||
@ -245,8 +242,13 @@ export class JitsiComponent extends BaseViewComponentDirective implements OnInit
|
|||||||
super(titleService, translate, snackBar);
|
super(titleService, translate, snackBar);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ngOnInit(): void {
|
public async ngOnInit(): Promise<void> {
|
||||||
this.setUp();
|
await this.setUp();
|
||||||
|
if (this.canSeeLiveStream && this.videoStreamUrl) {
|
||||||
|
this.currentState = ConferenceState.stream;
|
||||||
|
} else {
|
||||||
|
this.currentState = ConferenceState.jitsi;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async ngOnDestroy(): Promise<void> {
|
public async ngOnDestroy(): Promise<void> {
|
||||||
@ -292,8 +294,6 @@ export class JitsiComponent extends BaseViewComponentDirective implements OnInit
|
|||||||
.watch(this.RTC_LOGGED_STORAGE_KEY)
|
.watch(this.RTC_LOGGED_STORAGE_KEY)
|
||||||
.pipe(distinctUntilChanged())
|
.pipe(distinctUntilChanged())
|
||||||
.subscribe((inUse: boolean) => {
|
.subscribe((inUse: boolean) => {
|
||||||
console.log('RTC_LOGGED_STORAGE_KEY is in use: ', inUse);
|
|
||||||
|
|
||||||
this.isJitsiActiveInAnotherTab = inUse;
|
this.isJitsiActiveInAnotherTab = inUse;
|
||||||
this.lockLoaded.resolve();
|
this.lockLoaded.resolve();
|
||||||
if (!inUse && !this.isJitsiActive) {
|
if (!inUse && !this.isJitsiActive) {
|
||||||
@ -342,41 +342,20 @@ export class JitsiComponent extends BaseViewComponentDirective implements OnInit
|
|||||||
this.nextSpeakerAmount = nextSpeakerAmount;
|
this.nextSpeakerAmount = nextSpeakerAmount;
|
||||||
}),
|
}),
|
||||||
this.configService.get<string>('general_system_stream_url').subscribe(url => {
|
this.configService.get<string>('general_system_stream_url').subscribe(url => {
|
||||||
this.videoStreamUrl = url;
|
this.onLiveStreamAvailable(url);
|
||||||
this.configsLoaded.resolve();
|
this.configsLoaded.resolve();
|
||||||
}),
|
}),
|
||||||
this.configService.get<boolean>('general_system_conference_open_microphone').subscribe(open => {
|
this.configService.get<boolean>('general_system_conference_open_microphone').subscribe(open => {
|
||||||
this.startWithMicMuted = !open;
|
this.configOverwrite.startWithAudioMuted = !open;
|
||||||
this.configOverwrite.startWithAudioMuted = this.startWithMicMuted;
|
|
||||||
console.log('this.startWithMicMuted ', this.startWithMicMuted);
|
|
||||||
}),
|
}),
|
||||||
this.configService.get<boolean>('general_system_conference_open_video').subscribe(open => {
|
this.configService.get<boolean>('general_system_conference_open_video').subscribe(open => {
|
||||||
this.startWithVideoMuted = !open;
|
this.configOverwrite.startWithVideoMuted = !open;
|
||||||
this.configOverwrite.startWithVideoMuted = this.startWithVideoMuted;
|
|
||||||
console.log('this.startWithVideoMuted ', this.startWithVideoMuted);
|
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
await this.configsLoaded;
|
await this.configsLoaded;
|
||||||
|
|
||||||
this.subscriptions.push(
|
this.subscriptions.push(
|
||||||
this.storageMap.watch(this.CONFERENCE_STATE_STORAGE_KEY).subscribe((confState: ConferenceState) => {
|
|
||||||
if (confState in ConferenceState) {
|
|
||||||
if (this.enableJitsi && (!this.videoStreamUrl || !this.canSeeLiveStream)) {
|
|
||||||
this.currentState = ConferenceState.jitsi;
|
|
||||||
} else if (!this.enableJitsi && this.videoStreamUrl && this.canSeeLiveStream) {
|
|
||||||
this.currentState = ConferenceState.stream;
|
|
||||||
} else {
|
|
||||||
this.currentState = confState;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.setDefaultConfState();
|
|
||||||
}
|
|
||||||
// show stream window when the state changes to stream
|
|
||||||
if (this.currentState === ConferenceState.stream && !this.streamActiveInAnotherTab) {
|
|
||||||
this.showJitsiWindow = true;
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
// check if the operator is on the clos, remove from room if not permitted
|
// check if the operator is on the clos, remove from room if not permitted
|
||||||
this.closService.currentListOfSpeakersObservable
|
this.closService.currentListOfSpeakersObservable
|
||||||
.pipe(
|
.pipe(
|
||||||
@ -582,9 +561,10 @@ export class JitsiComponent extends BaseViewComponentDirective implements OnInit
|
|||||||
this.showJitsiWindow = false;
|
this.showJitsiWindow = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async viewStream(): Promise<void> {
|
public viewStream(): void {
|
||||||
this.stopJitsi();
|
this.stopJitsi();
|
||||||
this.setConferenceState(ConferenceState.stream);
|
this.setConferenceState(ConferenceState.stream);
|
||||||
|
this.showJitsiWindow = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public onSteamStarted(): void {
|
public onSteamStarted(): void {
|
||||||
@ -592,6 +572,18 @@ export class JitsiComponent extends BaseViewComponentDirective implements OnInit
|
|||||||
this.storageMap.set(this.STREAM_RUNNING_STORAGE_KEY, true).subscribe(() => {});
|
this.storageMap.set(this.STREAM_RUNNING_STORAGE_KEY, true).subscribe(() => {});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private onLiveStreamAvailable(liveStreamUrl: string): void {
|
||||||
|
this.videoStreamUrl = liveStreamUrl;
|
||||||
|
// this is the "dead" state; you would see the jitsi state; but are not connected
|
||||||
|
// or the connection is prohibited. If this occurs and a live stream
|
||||||
|
// becomes available, switch to the stream state
|
||||||
|
if (this.videoStreamUrl && this.currentState === ConferenceState.jitsi && !this.isJitsiActive) {
|
||||||
|
this.viewStream();
|
||||||
|
} else if (!this.videoStreamUrl && this.enableJitsi) {
|
||||||
|
this.setConferenceState(ConferenceState.jitsi);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private async deleteJitsiLock(): Promise<void> {
|
private async deleteJitsiLock(): Promise<void> {
|
||||||
await this.storageMap.delete(this.RTC_LOGGED_STORAGE_KEY).toPromise();
|
await this.storageMap.delete(this.RTC_LOGGED_STORAGE_KEY).toPromise();
|
||||||
}
|
}
|
||||||
@ -600,15 +592,7 @@ export class JitsiComponent extends BaseViewComponentDirective implements OnInit
|
|||||||
await this.storageMap.delete(this.STREAM_RUNNING_STORAGE_KEY).toPromise();
|
await this.storageMap.delete(this.STREAM_RUNNING_STORAGE_KEY).toPromise();
|
||||||
}
|
}
|
||||||
|
|
||||||
private setDefaultConfState(): void {
|
|
||||||
this.videoStreamUrl && this.canSeeLiveStream
|
|
||||||
? this.setConferenceState(ConferenceState.stream)
|
|
||||||
: this.setConferenceState(ConferenceState.jitsi);
|
|
||||||
}
|
|
||||||
|
|
||||||
private setConferenceState(newState: ConferenceState): void {
|
private setConferenceState(newState: ConferenceState): void {
|
||||||
if (this.currentState !== newState) {
|
this.currentState = newState;
|
||||||
this.storageMap.set(this.CONFERENCE_STATE_STORAGE_KEY, newState).subscribe(() => {});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user