mirror of https://github.com/OpenVidu/openvidu.git
ov-components: add participant name visibility control to pre-join component
parent
72888e4ea9
commit
e373d23cc9
|
@ -40,7 +40,7 @@
|
||||||
></ov-audio-devices-select>
|
></ov-audio-devices-select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="participant-name-container">
|
<div class="participant-name-container" *ngIf="showParticipantName">
|
||||||
<ov-participant-name-input
|
<ov-participant-name-input
|
||||||
[isPrejoinPage]="true"
|
[isPrejoinPage]="true"
|
||||||
[error]="!!_error"
|
[error]="!!_error"
|
||||||
|
|
|
@ -43,6 +43,7 @@ export class PreJoinComponent implements OnInit, OnDestroy {
|
||||||
showCameraButton: boolean = true;
|
showCameraButton: boolean = true;
|
||||||
showMicrophoneButton: boolean = true;
|
showMicrophoneButton: boolean = true;
|
||||||
showLogo: boolean = true;
|
showLogo: boolean = true;
|
||||||
|
showParticipantName: boolean = true;
|
||||||
|
|
||||||
videoTrack: LocalTrack | undefined;
|
videoTrack: LocalTrack | undefined;
|
||||||
audioTrack: LocalTrack | undefined;
|
audioTrack: LocalTrack | undefined;
|
||||||
|
@ -52,6 +53,7 @@ export class PreJoinComponent implements OnInit, OnDestroy {
|
||||||
private microphoneButtonSub: Subscription;
|
private microphoneButtonSub: Subscription;
|
||||||
private minimalSub: Subscription;
|
private minimalSub: Subscription;
|
||||||
private displayLogoSub: Subscription;
|
private displayLogoSub: Subscription;
|
||||||
|
private displayParticipantNameSub: Subscription;
|
||||||
private shouldRemoveTracksWhenComponentIsDestroyed: boolean = true;
|
private shouldRemoveTracksWhenComponentIsDestroyed: boolean = true;
|
||||||
|
|
||||||
@HostListener('window:resize')
|
@HostListener('window:resize')
|
||||||
|
@ -88,6 +90,7 @@ export class PreJoinComponent implements OnInit, OnDestroy {
|
||||||
if (this.cameraButtonSub) this.cameraButtonSub.unsubscribe();
|
if (this.cameraButtonSub) this.cameraButtonSub.unsubscribe();
|
||||||
if (this.microphoneButtonSub) this.microphoneButtonSub.unsubscribe();
|
if (this.microphoneButtonSub) this.microphoneButtonSub.unsubscribe();
|
||||||
if (this.displayLogoSub) this.displayLogoSub.unsubscribe();
|
if (this.displayLogoSub) this.displayLogoSub.unsubscribe();
|
||||||
|
if (this.displayParticipantNameSub) this.displayParticipantNameSub.unsubscribe();
|
||||||
|
|
||||||
if (this.shouldRemoveTracksWhenComponentIsDestroyed) {
|
if (this.shouldRemoveTracksWhenComponentIsDestroyed) {
|
||||||
this.tracks.forEach((track) => {
|
this.tracks.forEach((track) => {
|
||||||
|
@ -151,6 +154,9 @@ export class PreJoinComponent implements OnInit, OnDestroy {
|
||||||
if (value) this.participantName = value;
|
if (value) this.participantName = value;
|
||||||
// this.cd.markForCheck();
|
// this.cd.markForCheck();
|
||||||
});
|
});
|
||||||
|
this.displayParticipantNameSub = this.libService.prejoinDisplayParticipantName$.subscribe((value: boolean) => {
|
||||||
|
this.showParticipantName = value;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async videoEnabledChanged(enabled: boolean) {
|
async videoEnabledChanged(enabled: boolean) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { ActivitiesPanelBroadcastingActivityDirective, ActivitiesPanelRecordingActivityDirective } from './activities-panel.directive';
|
import { ActivitiesPanelBroadcastingActivityDirective, ActivitiesPanelRecordingActivityDirective } from './activities-panel.directive';
|
||||||
import { AdminLoginErrorDirective, AdminDashboardRecordingsListDirective, AdminLoginTitleDirective, AdminDashboardTitleDirective } from './admin.directive';
|
import { AdminLoginErrorDirective, AdminDashboardRecordingsListDirective, AdminLoginTitleDirective, AdminDashboardTitleDirective } from './admin.directive';
|
||||||
import { LayoutRemoteParticipantsDirective, FallbackLogoDirective, ToolbarBrandingLogoDirective } from './internals.directive';
|
import { LayoutRemoteParticipantsDirective, FallbackLogoDirective, ToolbarBrandingLogoDirective, PrejoinDisplayParticipantName } from './internals.directive';
|
||||||
import { ParticipantPanelItemMuteButtonDirective } from './participant-panel-item.directive';
|
import { ParticipantPanelItemMuteButtonDirective } from './participant-panel-item.directive';
|
||||||
import {
|
import {
|
||||||
StreamDisplayAudioDetectionDirective,
|
StreamDisplayAudioDetectionDirective,
|
||||||
|
@ -53,6 +53,7 @@ import {
|
||||||
// CaptionsLangOptionsDirective,
|
// CaptionsLangOptionsDirective,
|
||||||
// CaptionsLangDirective,
|
// CaptionsLangDirective,
|
||||||
PrejoinDirective,
|
PrejoinDirective,
|
||||||
|
PrejoinDisplayParticipantName,
|
||||||
VideoEnabledDirective,
|
VideoEnabledDirective,
|
||||||
AudioEnabledDirective,
|
AudioEnabledDirective,
|
||||||
ToolbarCameraButtonDirective,
|
ToolbarCameraButtonDirective,
|
||||||
|
@ -96,6 +97,7 @@ import {
|
||||||
// CaptionsLangOptionsDirective,
|
// CaptionsLangOptionsDirective,
|
||||||
// CaptionsLangDirective,
|
// CaptionsLangDirective,
|
||||||
PrejoinDirective,
|
PrejoinDirective,
|
||||||
|
PrejoinDisplayParticipantName,
|
||||||
VideoEnabledDirective,
|
VideoEnabledDirective,
|
||||||
AudioEnabledDirective,
|
AudioEnabledDirective,
|
||||||
ToolbarCameraButtonDirective,
|
ToolbarCameraButtonDirective,
|
||||||
|
|
|
@ -122,3 +122,38 @@ export class ToolbarBrandingLogoDirective implements AfterViewInit, OnDestroy {
|
||||||
this.libService.setBrandingLogo(value);
|
this.libService.setBrandingLogo(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
@Directive({
|
||||||
|
selector: 'ov-videoconference[prejoinDisplayParticipantName]'
|
||||||
|
})
|
||||||
|
export class PrejoinDisplayParticipantName implements OnDestroy {
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
@Input() set prejoinDisplayParticipantName(value: boolean) {
|
||||||
|
this.update(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
constructor(
|
||||||
|
public elementRef: ElementRef,
|
||||||
|
private libService: OpenViduComponentsConfigService
|
||||||
|
) {}
|
||||||
|
|
||||||
|
ngOnDestroy(): void {
|
||||||
|
this.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
private clear() {
|
||||||
|
this.update(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private update(value: boolean) {
|
||||||
|
this.libService.setPrejoinDisplayParticipantName(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -25,6 +25,8 @@ export class OpenViduComponentsConfigService {
|
||||||
participantName$: Observable<string>;
|
participantName$: Observable<string>;
|
||||||
private prejoin = <BehaviorSubject<boolean>>new BehaviorSubject(true);
|
private prejoin = <BehaviorSubject<boolean>>new BehaviorSubject(true);
|
||||||
prejoin$: Observable<boolean>;
|
prejoin$: Observable<boolean>;
|
||||||
|
private prejoinDisplayParticipantName = <BehaviorSubject<boolean>>new BehaviorSubject(true);
|
||||||
|
prejoinDisplayParticipantName$: Observable<boolean>;
|
||||||
|
|
||||||
private videoEnabled = <BehaviorSubject<boolean>>new BehaviorSubject(true);
|
private videoEnabled = <BehaviorSubject<boolean>>new BehaviorSubject(true);
|
||||||
videoEnabled$: Observable<boolean>;
|
videoEnabled$: Observable<boolean>;
|
||||||
|
@ -116,6 +118,7 @@ export class OpenViduComponentsConfigService {
|
||||||
this.minimal$ = this.minimal.asObservable();
|
this.minimal$ = this.minimal.asObservable();
|
||||||
this.participantName$ = this.participantName.asObservable();
|
this.participantName$ = this.participantName.asObservable();
|
||||||
this.prejoin$ = this.prejoin.asObservable();
|
this.prejoin$ = this.prejoin.asObservable();
|
||||||
|
this.prejoinDisplayParticipantName$ = this.prejoinDisplayParticipantName.asObservable();
|
||||||
this.videoEnabled$ = this.videoEnabled.asObservable();
|
this.videoEnabled$ = this.videoEnabled.asObservable();
|
||||||
this.audioEnabled$ = this.audioEnabled.asObservable();
|
this.audioEnabled$ = this.audioEnabled.asObservable();
|
||||||
//Toolbar observables
|
//Toolbar observables
|
||||||
|
@ -187,6 +190,10 @@ export class OpenViduComponentsConfigService {
|
||||||
this.prejoin.next(prejoin);
|
this.prejoin.next(prejoin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setPrejoinDisplayParticipantName(prejoinDisplayParticipantName: boolean) {
|
||||||
|
this.prejoinDisplayParticipantName.next(prejoinDisplayParticipantName);
|
||||||
|
}
|
||||||
|
|
||||||
isPrejoin(): boolean {
|
isPrejoin(): boolean {
|
||||||
return this.prejoin.getValue();
|
return this.prejoin.getValue();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue