mirror of https://github.com/OpenVidu/openvidu.git
ov-component: add showDisconnectionDialog directive and update service for disconnection dialog management
parent
5f0639c157
commit
6497751375
|
@ -532,7 +532,7 @@ export class SessionComponent implements OnInit, OnDestroy {
|
|||
this.log.d('Participant disconnected', participantLeftEvent);
|
||||
this.onParticipantLeft.emit(participantLeftEvent);
|
||||
this.onRoomDisconnected.emit();
|
||||
if (descriptionErrorKey) {
|
||||
if (this.libService.getShowDisconnectionDialog() && descriptionErrorKey) {
|
||||
this.actionService.openDialog(
|
||||
this.translateService.translate(messageErrorKey),
|
||||
this.translateService.translate(descriptionErrorKey)
|
||||
|
|
|
@ -736,6 +736,60 @@ export class AudioEnabledDirective implements OnDestroy {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The **showDisconnectionDialog** directive allows to show/hide the disconnection dialog when the local participant is disconnected from the room.
|
||||
*
|
||||
* It is only available for {@link VideoconferenceComponent}.
|
||||
*
|
||||
* Default: `true`
|
||||
*
|
||||
* @example
|
||||
* <ov-videoconference [showDisconnectionDialog]="false"></ov-videoconference>
|
||||
*/
|
||||
@Directive({
|
||||
selector: 'ov-videoconference[showDisconnectionDialog]',
|
||||
standalone: false
|
||||
})
|
||||
export class ShowDisconnectionDialogDirective implements OnDestroy {
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
@Input() set showDisconnectionDialog(value: boolean) {
|
||||
this.update(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
constructor(
|
||||
public elementRef: ElementRef,
|
||||
private libService: OpenViduComponentsConfigService
|
||||
) {}
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
ngOnDestroy(): void {
|
||||
this.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
clear() {
|
||||
this.update(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
update(value: boolean) {
|
||||
if (this.libService.getShowDisconnectionDialog() !== value) {
|
||||
this.libService.setShowDisconnectionDialog(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The **recordingStreamBaseUrl** directive sets the base URL for retrieving recording streams.
|
||||
* The complete request URL is dynamically constructed by concatenating the supplied URL, the
|
||||
|
|
|
@ -33,6 +33,9 @@ export class OpenViduComponentsConfigService {
|
|||
private audioEnabled = <BehaviorSubject<boolean>>new BehaviorSubject(true);
|
||||
audioEnabled$: Observable<boolean>;
|
||||
|
||||
private showDisconnectionDialog = <BehaviorSubject<boolean>>new BehaviorSubject(true);
|
||||
showDisconnectionDialog$: Observable<boolean>;
|
||||
|
||||
private recordingStreamBaseUrl = <BehaviorSubject<string>>new BehaviorSubject('call/api/recordings');
|
||||
recordingStreamBaseUrl$: Observable<string>;
|
||||
|
||||
|
@ -218,6 +221,14 @@ export class OpenViduComponentsConfigService {
|
|||
return this.audioEnabled.getValue();
|
||||
}
|
||||
|
||||
getShowDisconnectionDialog(): boolean {
|
||||
return this.showDisconnectionDialog.getValue();
|
||||
}
|
||||
|
||||
setShowDisconnectionDialog(showDisconnectionDialog: boolean) {
|
||||
this.showDisconnectionDialog.next(showDisconnectionDialog);
|
||||
}
|
||||
|
||||
setRecordingStreamBaseUrl(recordingStreamBaseUrl: string) {
|
||||
this.recordingStreamBaseUrl.next(recordingStreamBaseUrl);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue