mirror of https://github.com/OpenVidu/openvidu.git
ov-components: Refactored config service
parent
95b8d055ed
commit
724fbd9186
|
@ -2,7 +2,7 @@ import { Component, OnInit, Output, EventEmitter, OnDestroy } from '@angular/cor
|
||||||
import { Subscription } from 'rxjs';
|
import { Subscription } from 'rxjs';
|
||||||
import { RecordingDeleteRequestedEvent, RecordingInfo, RecordingStatus } from '../../models/recording.model';
|
import { RecordingDeleteRequestedEvent, RecordingInfo, RecordingStatus } from '../../models/recording.model';
|
||||||
import { ActionService } from '../../services/action/action.service';
|
import { ActionService } from '../../services/action/action.service';
|
||||||
import { OpenViduComponentsConfigService } from '../../services/config/openvidu-components-angular.config.service';
|
import { OpenViduComponentsConfigService } from '../../services/config/directive-config.service';
|
||||||
import { RecordingService } from '../../services/recording/recording.service';
|
import { RecordingService } from '../../services/recording/recording.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { Component, EventEmitter, OnInit, Output } from '@angular/core';
|
||||||
import { Validators, FormGroup, FormBuilder } from '@angular/forms';
|
import { Validators, FormGroup, FormBuilder } from '@angular/forms';
|
||||||
import { Subscription } from 'rxjs';
|
import { Subscription } from 'rxjs';
|
||||||
import { ActionService } from '../../services/action/action.service';
|
import { ActionService } from '../../services/action/action.service';
|
||||||
import { OpenViduComponentsConfigService } from '../../services/config/openvidu-components-angular.config.service';
|
import { OpenViduComponentsConfigService } from '../../services/config/directive-config.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ov-admin-login',
|
selector: 'ov-admin-login',
|
||||||
|
|
|
@ -18,7 +18,7 @@ import { LayoutService } from '../../services/layout/layout.service';
|
||||||
import { ParticipantService } from '../../services/participant/participant.service';
|
import { ParticipantService } from '../../services/participant/participant.service';
|
||||||
import { CdkDrag } from '@angular/cdk/drag-drop';
|
import { CdkDrag } from '@angular/cdk/drag-drop';
|
||||||
import { PanelService } from '../../services/panel/panel.service';
|
import { PanelService } from '../../services/panel/panel.service';
|
||||||
import { OpenViduComponentsConfigService } from '../../services/config/openvidu-components-angular.config.service';
|
import { GlobalConfigService } from '../../services/config/global-config.service';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -86,7 +86,7 @@ export class LayoutComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||||
private layoutService: LayoutService,
|
private layoutService: LayoutService,
|
||||||
private panelService: PanelService,
|
private panelService: PanelService,
|
||||||
private participantService: ParticipantService,
|
private participantService: ParticipantService,
|
||||||
private libService: OpenViduComponentsConfigService,
|
private globalService: GlobalConfigService,
|
||||||
private cd: ChangeDetectorRef
|
private cd: ChangeDetectorRef
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
|
@ -207,7 +207,7 @@ export class LayoutComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||||
};
|
};
|
||||||
this.cdkSubscription = this.cdkDrag.released.subscribe(handler);
|
this.cdkSubscription = this.cdkDrag.released.subscribe(handler);
|
||||||
|
|
||||||
if (this.libService.getConfig().production) return;
|
if (this.globalService.isProduction()) return;
|
||||||
// Just for allow E2E testing with drag and drop
|
// Just for allow E2E testing with drag and drop
|
||||||
document.addEventListener('webcomponentTestingEndedDragAndDropEvent', handler);
|
document.addEventListener('webcomponentTestingEndedDragAndDropEvent', handler);
|
||||||
document.addEventListener('webcomponentTestingEndedDragAndDropRightEvent', (event: any) => {
|
document.addEventListener('webcomponentTestingEndedDragAndDropRightEvent', (event: any) => {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, OnInit, Output } from '@angular/core';
|
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, OnInit, Output } from '@angular/core';
|
||||||
import { Subscription } from 'rxjs';
|
import { Subscription } from 'rxjs';
|
||||||
import { PanelStatusInfo, PanelType } from '../../../models/panel.model';
|
import { PanelStatusInfo, PanelType } from '../../../models/panel.model';
|
||||||
import { OpenViduComponentsConfigService } from '../../../services/config/openvidu-components-angular.config.service';
|
import { OpenViduComponentsConfigService } from '../../../services/config/directive-config.service';
|
||||||
import { PanelService } from '../../../services/panel/panel.service';
|
import { PanelService } from '../../../services/panel/panel.service';
|
||||||
import {
|
import {
|
||||||
RecordingDeleteRequestedEvent,
|
RecordingDeleteRequestedEvent,
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChild, In
|
||||||
import { Subscription } from 'rxjs';
|
import { Subscription } from 'rxjs';
|
||||||
import { ParticipantPanelItemElementsDirective } from '../../../../directives/template/openvidu-components-angular.directive';
|
import { ParticipantPanelItemElementsDirective } from '../../../../directives/template/openvidu-components-angular.directive';
|
||||||
import { ParticipantModel } from '../../../../models/participant.model';
|
import { ParticipantModel } from '../../../../models/participant.model';
|
||||||
import { OpenViduComponentsConfigService } from '../../../../services/config/openvidu-components-angular.config.service';
|
import { OpenViduComponentsConfigService } from '../../../../services/config/directive-config.service';
|
||||||
import { ParticipantService } from '../../../../services/participant/participant.service';
|
import { ParticipantService } from '../../../../services/participant/participant.service';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Component, EventEmitter, OnInit, Output } from '@angular/core';
|
import { Component, EventEmitter, OnInit, Output } from '@angular/core';
|
||||||
import { Subscription } from 'rxjs';
|
import { Subscription } from 'rxjs';
|
||||||
import { PanelStatusInfo, PanelSettingsOptions, PanelType } from '../../../models/panel.model';
|
import { PanelStatusInfo, PanelSettingsOptions, PanelType } from '../../../models/panel.model';
|
||||||
import { OpenViduComponentsConfigService } from '../../../services/config/openvidu-components-angular.config.service';
|
import { OpenViduComponentsConfigService } from '../../../services/config/directive-config.service';
|
||||||
import { PanelService } from '../../../services/panel/panel.service';
|
import { PanelService } from '../../../services/panel/panel.service';
|
||||||
import { PlatformService } from '../../../services/platform/platform.service';
|
import { PlatformService } from '../../../services/platform/platform.service';
|
||||||
import { CustomDevice } from '../../../models/device.model';
|
import { CustomDevice } from '../../../models/device.model';
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { ChangeDetectorRef, Component, EventEmitter, HostListener, Input, OnDest
|
||||||
import { Subscription } from 'rxjs';
|
import { Subscription } from 'rxjs';
|
||||||
import { ILogger } from '../../models/logger.model';
|
import { ILogger } from '../../models/logger.model';
|
||||||
import { CdkOverlayService } from '../../services/cdk-overlay/cdk-overlay.service';
|
import { CdkOverlayService } from '../../services/cdk-overlay/cdk-overlay.service';
|
||||||
import { OpenViduComponentsConfigService } from '../../services/config/openvidu-components-angular.config.service';
|
import { OpenViduComponentsConfigService } from '../../services/config/directive-config.service';
|
||||||
import { LayoutService } from '../../services/layout/layout.service';
|
import { LayoutService } from '../../services/layout/layout.service';
|
||||||
import { LoggerService } from '../../services/logger/logger.service';
|
import { LoggerService } from '../../services/logger/logger.service';
|
||||||
import { OpenViduService } from '../../services/openvidu/openvidu.service';
|
import { OpenViduService } from '../../services/openvidu/openvidu.service';
|
||||||
|
|
|
@ -25,7 +25,7 @@ import { ActionService } from '../../services/action/action.service';
|
||||||
import { BroadcastingService } from '../../services/broadcasting/broadcasting.service';
|
import { BroadcastingService } from '../../services/broadcasting/broadcasting.service';
|
||||||
// import { CaptionService } from '../../services/caption/caption.service';
|
// import { CaptionService } from '../../services/caption/caption.service';
|
||||||
import { ChatService } from '../../services/chat/chat.service';
|
import { ChatService } from '../../services/chat/chat.service';
|
||||||
import { OpenViduComponentsConfigService } from '../../services/config/openvidu-components-angular.config.service';
|
import { OpenViduComponentsConfigService } from '../../services/config/directive-config.service';
|
||||||
import { LayoutService } from '../../services/layout/layout.service';
|
import { LayoutService } from '../../services/layout/layout.service';
|
||||||
import { LoggerService } from '../../services/logger/logger.service';
|
import { LoggerService } from '../../services/logger/logger.service';
|
||||||
import { OpenViduService } from '../../services/openvidu/openvidu.service';
|
import { OpenViduService } from '../../services/openvidu/openvidu.service';
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { Component, ElementRef, Input, OnDestroy, OnInit, ViewChild } from '@ang
|
||||||
import { MatMenuPanel, MatMenuTrigger } from '@angular/material/menu';
|
import { MatMenuPanel, MatMenuTrigger } from '@angular/material/menu';
|
||||||
import { Subscription } from 'rxjs';
|
import { Subscription } from 'rxjs';
|
||||||
import { CdkOverlayService } from '../../services/cdk-overlay/cdk-overlay.service';
|
import { CdkOverlayService } from '../../services/cdk-overlay/cdk-overlay.service';
|
||||||
import { OpenViduComponentsConfigService } from '../../services/config/openvidu-components-angular.config.service';
|
import { OpenViduComponentsConfigService } from '../../services/config/directive-config.service';
|
||||||
import { LayoutService } from '../../services/layout/layout.service';
|
import { LayoutService } from '../../services/layout/layout.service';
|
||||||
import { OpenViduService } from '../../services/openvidu/openvidu.service';
|
import { OpenViduService } from '../../services/openvidu/openvidu.service';
|
||||||
import { ParticipantService } from '../../services/participant/participant.service';
|
import { ParticipantService } from '../../services/participant/participant.service';
|
||||||
|
|
|
@ -35,7 +35,7 @@ import {
|
||||||
} from '../../models/recording.model';
|
} from '../../models/recording.model';
|
||||||
import { ActionService } from '../../services/action/action.service';
|
import { ActionService } from '../../services/action/action.service';
|
||||||
import { BroadcastingService } from '../../services/broadcasting/broadcasting.service';
|
import { BroadcastingService } from '../../services/broadcasting/broadcasting.service';
|
||||||
import { OpenViduComponentsConfigService } from '../../services/config/openvidu-components-angular.config.service';
|
import { OpenViduComponentsConfigService } from '../../services/config/directive-config.service';
|
||||||
import { DeviceService } from '../../services/device/device.service';
|
import { DeviceService } from '../../services/device/device.service';
|
||||||
import { LayoutService } from '../../services/layout/layout.service';
|
import { LayoutService } from '../../services/layout/layout.service';
|
||||||
import { LoggerService } from '../../services/logger/logger.service';
|
import { LoggerService } from '../../services/logger/logger.service';
|
||||||
|
|
|
@ -28,7 +28,7 @@ import {
|
||||||
} from '../../directives/template/openvidu-components-angular.directive';
|
} from '../../directives/template/openvidu-components-angular.directive';
|
||||||
import { ILogger } from '../../models/logger.model';
|
import { ILogger } from '../../models/logger.model';
|
||||||
import { ActionService } from '../../services/action/action.service';
|
import { ActionService } from '../../services/action/action.service';
|
||||||
import { OpenViduComponentsConfigService } from '../../services/config/openvidu-components-angular.config.service';
|
import { OpenViduComponentsConfigService } from '../../services/config/directive-config.service';
|
||||||
import { DeviceService } from '../../services/device/device.service';
|
import { DeviceService } from '../../services/device/device.service';
|
||||||
import { LoggerService } from '../../services/logger/logger.service';
|
import { LoggerService } from '../../services/logger/logger.service';
|
||||||
import { OpenViduService } from '../../services/openvidu/openvidu.service';
|
import { OpenViduService } from '../../services/openvidu/openvidu.service';
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { AfterViewInit, Directive, ElementRef, Input, OnDestroy } from '@angular/core';
|
import { AfterViewInit, Directive, ElementRef, Input, OnDestroy } from '@angular/core';
|
||||||
import { OpenViduComponentsConfigService } from '../../services/config/openvidu-components-angular.config.service';
|
import { OpenViduComponentsConfigService } from '../../services/config/directive-config.service';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The **recordingActivity** directive allows show/hide the recording activity in {@link ActivitiesPanelComponent}.
|
* The **recordingActivity** directive allows show/hide the recording activity in {@link ActivitiesPanelComponent}.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { Directive, AfterViewInit, OnDestroy, Input, ElementRef } from '@angular/core';
|
import { Directive, AfterViewInit, OnDestroy, Input, ElementRef } from '@angular/core';
|
||||||
import { RecordingInfo } from '../../models/recording.model';
|
import { RecordingInfo } from '../../models/recording.model';
|
||||||
import { OpenViduComponentsConfigService } from '../../services/config/openvidu-components-angular.config.service';
|
import { OpenViduComponentsConfigService } from '../../services/config/directive-config.service';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The **recordingsList** directive allows show all recordings saved in your OpenVidu deployment in {@link AdminDashboardComponent}.
|
* The **recordingsList** directive allows show all recordings saved in your OpenVidu deployment in {@link AdminDashboardComponent}.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Directive, AfterViewInit, OnDestroy, Input, ElementRef } from '@angular/core';
|
import { Directive, AfterViewInit, OnDestroy, Input, ElementRef } from '@angular/core';
|
||||||
import { OpenViduComponentsConfigService } from '../../services/config/openvidu-components-angular.config.service';
|
import { OpenViduComponentsConfigService } from '../../services/config/directive-config.service';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The **muteButton** directive allows show/hide the muted button in participant panel item component.
|
* The **muteButton** directive allows show/hide the muted button in participant panel item component.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { AfterViewInit, Directive, ElementRef, Input, OnDestroy } from '@angular/core';
|
import { AfterViewInit, Directive, ElementRef, Input, OnDestroy } from '@angular/core';
|
||||||
import { OpenViduComponentsConfigService } from '../../services/config/openvidu-components-angular.config.service';
|
import { OpenViduComponentsConfigService } from '../../services/config/directive-config.service';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The **displayParticipantName** directive allows show/hide the participants name in stream component.
|
* The **displayParticipantName** directive allows show/hide the participants name in stream component.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { AfterViewInit, Directive, ElementRef, Input, OnDestroy } from '@angular/core';
|
import { AfterViewInit, Directive, ElementRef, Input, OnDestroy } from '@angular/core';
|
||||||
import { OpenViduComponentsConfigService } from '../../services/config/openvidu-components-angular.config.service';
|
import { OpenViduComponentsConfigService } from '../../services/config/directive-config.service';
|
||||||
import { ToolbarAdditionalButtonsPosition } from '../../models/toolbar.model';
|
import { ToolbarAdditionalButtonsPosition } from '../../models/toolbar.model';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Directive, ElementRef, Input, OnDestroy, OnInit } from '@angular/core';
|
import { Directive, ElementRef, Input, OnDestroy, OnInit } from '@angular/core';
|
||||||
import { CaptionsLangOption } from '../../models/caption.model';
|
import { CaptionsLangOption } from '../../models/caption.model';
|
||||||
// import { CaptionService } from '../../services/caption/caption.service';
|
// import { CaptionService } from '../../services/caption/caption.service';
|
||||||
import { OpenViduComponentsConfigService } from '../../services/config/openvidu-components-angular.config.service';
|
import { OpenViduComponentsConfigService } from '../../services/config/directive-config.service';
|
||||||
import { TranslateService } from '../../services/translate/translate.service';
|
import { TranslateService } from '../../services/translate/translate.service';
|
||||||
import { LangOption } from '../../models/lang.model';
|
import { LangOption } from '../../models/lang.model';
|
||||||
import { StorageService } from '../../services/storage/storage.service';
|
import { StorageService } from '../../services/storage/storage.service';
|
||||||
|
|
|
@ -25,7 +25,7 @@ import { CdkOverlayContainer } from './config/custom-cdk-overlay';
|
||||||
import { OpenViduComponentsConfig } from './config/openvidu-components-angular.config';
|
import { OpenViduComponentsConfig } from './config/openvidu-components-angular.config';
|
||||||
import { ActionService } from './services/action/action.service';
|
import { ActionService } from './services/action/action.service';
|
||||||
import { ChatService } from './services/chat/chat.service';
|
import { ChatService } from './services/chat/chat.service';
|
||||||
import { OpenViduComponentsConfigService } from './services/config/openvidu-components-angular.config.service';
|
import { OpenViduComponentsConfigService } from './services/config/directive-config.service';
|
||||||
import { DeviceService } from './services/device/device.service';
|
import { DeviceService } from './services/device/device.service';
|
||||||
import { DocumentService } from './services/document/document.service';
|
import { DocumentService } from './services/document/document.service';
|
||||||
import { LayoutService } from './services/layout/layout.service';
|
import { LayoutService } from './services/layout/layout.service';
|
||||||
|
@ -97,7 +97,7 @@ const privateComponents = [
|
||||||
VideoDevicesComponent,
|
VideoDevicesComponent,
|
||||||
AudioDevicesComponent,
|
AudioDevicesComponent,
|
||||||
ParticipantNameInputComponent,
|
ParticipantNameInputComponent,
|
||||||
LangSelectorComponent,
|
LangSelectorComponent
|
||||||
// CaptionsSettingComponent
|
// CaptionsSettingComponent
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,13 @@
|
||||||
import { Inject, Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { BehaviorSubject, Observable } from 'rxjs';
|
import { BehaviorSubject, Observable } from 'rxjs';
|
||||||
import { OpenViduComponentsConfig, ParticipantFactoryFunction } from '../../config/openvidu-components-angular.config';
|
|
||||||
import { RecordingInfo } from '../../models/recording.model';
|
import { RecordingInfo } from '../../models/recording.model';
|
||||||
import { DOCUMENT } from '@angular/common';
|
|
||||||
import { ToolbarAdditionalButtonsPosition } from '../../models/toolbar.model';
|
import { ToolbarAdditionalButtonsPosition } from '../../models/toolbar.model';
|
||||||
|
|
||||||
// import { version } from '../../../../package.json';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class OpenViduComponentsConfigService {
|
export class OpenViduComponentsConfigService {
|
||||||
private configuration: OpenViduComponentsConfig;
|
|
||||||
private token = <BehaviorSubject<string>>new BehaviorSubject('');
|
private token = <BehaviorSubject<string>>new BehaviorSubject('');
|
||||||
token$: Observable<string>;
|
token$: Observable<string>;
|
||||||
|
|
||||||
|
@ -92,13 +87,7 @@ export class OpenViduComponentsConfigService {
|
||||||
private adminLoginError = <BehaviorSubject<any>>new BehaviorSubject(null);
|
private adminLoginError = <BehaviorSubject<any>>new BehaviorSubject(null);
|
||||||
adminLoginError$: Observable<any>;
|
adminLoginError$: Observable<any>;
|
||||||
|
|
||||||
constructor(
|
constructor() {
|
||||||
@Inject('OPENVIDU_COMPONENTS_CONFIG') config: OpenViduComponentsConfig,
|
|
||||||
@Inject(DOCUMENT) private document: Document
|
|
||||||
) {
|
|
||||||
this.configuration = config;
|
|
||||||
console.log(this.configuration);
|
|
||||||
if (this.isProduction()) console.log('OpenVidu Angular Production Mode');
|
|
||||||
this.token$ = this.token.asObservable();
|
this.token$ = this.token.asObservable();
|
||||||
this.livekitUrl$ = this.livekitUrl.asObservable();
|
this.livekitUrl$ = this.livekitUrl.asObservable();
|
||||||
this.tokenError$ = this.tokenError.asObservable();
|
this.tokenError$ = this.tokenError.asObservable();
|
||||||
|
@ -368,39 +357,6 @@ export class OpenViduComponentsConfigService {
|
||||||
return this.adminLoginError.getValue();
|
return this.adminLoginError.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
getConfig(): OpenViduComponentsConfig {
|
|
||||||
return this.configuration;
|
|
||||||
}
|
|
||||||
isProduction(): boolean {
|
|
||||||
return this.configuration?.production || false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieves the base href of the application.
|
|
||||||
*
|
|
||||||
* @returns The base href of the application as a string.
|
|
||||||
*/
|
|
||||||
getBaseHref(): string {
|
|
||||||
const base = this.document.getElementsByTagName('base');
|
|
||||||
if (!base || base.length === 0) {
|
|
||||||
return '/';
|
|
||||||
}
|
|
||||||
|
|
||||||
const baseHref = base[0].href;
|
|
||||||
if (baseHref) {
|
|
||||||
return baseHref;
|
|
||||||
}
|
|
||||||
return '/';
|
|
||||||
}
|
|
||||||
|
|
||||||
hasParticipantFactory(): boolean {
|
|
||||||
return typeof this.getConfig().participantFactory === 'function';
|
|
||||||
}
|
|
||||||
|
|
||||||
getParticipantFactory(): ParticipantFactoryFunction {
|
|
||||||
return this.getConfig().participantFactory;
|
|
||||||
}
|
|
||||||
|
|
||||||
isRecordingEnabled(): boolean {
|
isRecordingEnabled(): boolean {
|
||||||
return this.recordingButton.getValue() && this.recordingActivity.getValue();
|
return this.recordingButton.getValue() && this.recordingActivity.getValue();
|
||||||
}
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
import { DOCUMENT } from '@angular/common';
|
||||||
|
import { Inject, Injectable} from '@angular/core';
|
||||||
|
import { ParticipantFactoryFunction, OpenViduComponentsConfig } from '../../config/openvidu-components-angular.config';
|
||||||
|
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root'
|
||||||
|
})
|
||||||
|
export class GlobalConfigService {
|
||||||
|
private configuration: OpenViduComponentsConfig;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
@Inject('OPENVIDU_COMPONENTS_CONFIG') config: OpenViduComponentsConfig,
|
||||||
|
@Inject(DOCUMENT) private document: Document
|
||||||
|
) {
|
||||||
|
this.configuration = config;
|
||||||
|
console.log(this.configuration);
|
||||||
|
if (this.isProduction()) console.log('OpenVidu Angular Production Mode');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the base href of the application.
|
||||||
|
*
|
||||||
|
* @returns The base href of the application as a string.
|
||||||
|
*/
|
||||||
|
getBaseHref(): string {
|
||||||
|
const base = this.document.getElementsByTagName('base');
|
||||||
|
if (!base || base.length === 0) {
|
||||||
|
return '/';
|
||||||
|
}
|
||||||
|
|
||||||
|
const baseHref = base[0].href;
|
||||||
|
if (baseHref) {
|
||||||
|
return baseHref;
|
||||||
|
}
|
||||||
|
return '/';
|
||||||
|
}
|
||||||
|
|
||||||
|
hasParticipantFactory(): boolean {
|
||||||
|
return typeof this.getConfig().participantFactory === 'function';
|
||||||
|
}
|
||||||
|
|
||||||
|
getParticipantFactory(): ParticipantFactoryFunction {
|
||||||
|
return this.getConfig().participantFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
getConfig(): OpenViduComponentsConfig {
|
||||||
|
return this.configuration;
|
||||||
|
}
|
||||||
|
isProduction(): boolean {
|
||||||
|
return this.configuration?.production || false;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,18 +0,0 @@
|
||||||
import { Injectable } from '@angular/core';
|
|
||||||
import { OpenViduComponentsConfig } from '../../config/openvidu-components-angular.config';
|
|
||||||
|
|
||||||
@Injectable()
|
|
||||||
export class OpenViduAngularConfigServiceMock {
|
|
||||||
private configuration: OpenViduComponentsConfig;
|
|
||||||
|
|
||||||
constructor() {
|
|
||||||
this.configuration = { production: false };
|
|
||||||
}
|
|
||||||
|
|
||||||
getConfig(): OpenViduComponentsConfig {
|
|
||||||
return this.configuration;
|
|
||||||
}
|
|
||||||
isProduction(): boolean {
|
|
||||||
return this.configuration?.production;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,22 +0,0 @@
|
||||||
import { TestBed } from '@angular/core/testing';
|
|
||||||
import { OpenViduComponentsConfig } from '../../config/openvidu-components-angular.config';
|
|
||||||
|
|
||||||
import { OpenViduComponentsConfigService } from './openvidu-components-angular.config.service';
|
|
||||||
|
|
||||||
describe('OpenViduAngularConfigService', () => {
|
|
||||||
let service: OpenViduComponentsConfigService;
|
|
||||||
const config: OpenViduComponentsConfig = { production: false };
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
TestBed.configureTestingModule({
|
|
||||||
providers: [
|
|
||||||
OpenViduComponentsConfigService,
|
|
||||||
{provide: 'LIB_CONFIG', useValue: config}]
|
|
||||||
});
|
|
||||||
service = TestBed.inject(OpenViduComponentsConfigService);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should be created', () => {
|
|
||||||
expect(service).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { ILogService } from '../../models/logger.model';
|
import { ILogService } from '../../models/logger.model';
|
||||||
|
|
||||||
import { OpenViduComponentsConfigService } from '../config/openvidu-components-angular.config.service';
|
import { GlobalConfigService } from '../config/global-config.service';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
|
@ -18,7 +18,7 @@ export class LoggerService implements ILogService {
|
||||||
['[', '] ERROR: ']
|
['[', '] ERROR: ']
|
||||||
];
|
];
|
||||||
|
|
||||||
constructor(private openviduAngularConfigSrv: OpenViduComponentsConfigService) {
|
constructor(private globalService: GlobalConfigService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
private getLoggerFns(prefix: string) {
|
private getLoggerFns(prefix: string) {
|
||||||
|
@ -31,7 +31,7 @@ export class LoggerService implements ILogService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public get(prefix: string) {
|
public get(prefix: string) {
|
||||||
const prodMode = this.openviduAngularConfigSrv.isProduction();
|
const prodMode = this.globalService.isProduction();
|
||||||
const loggerService = this;
|
const loggerService = this;
|
||||||
return {
|
return {
|
||||||
d: function(...args: any[]) {
|
d: function(...args: any[]) {
|
||||||
|
|
|
@ -2,7 +2,8 @@ import { Injectable } from '@angular/core';
|
||||||
import { BehaviorSubject, Observable } from 'rxjs';
|
import { BehaviorSubject, Observable } from 'rxjs';
|
||||||
import { ILogger } from '../../models/logger.model';
|
import { ILogger } from '../../models/logger.model';
|
||||||
import { ParticipantModel, ParticipantProperties } from '../../models/participant.model';
|
import { ParticipantModel, ParticipantProperties } from '../../models/participant.model';
|
||||||
import { OpenViduComponentsConfigService } from '../config/openvidu-components-angular.config.service';
|
import { OpenViduComponentsConfigService } from '../config/directive-config.service';
|
||||||
|
import { GlobalConfigService } from '../config/global-config.service';
|
||||||
import { LoggerService } from '../logger/logger.service';
|
import { LoggerService } from '../logger/logger.service';
|
||||||
|
|
||||||
import { OpenViduService } from '../openvidu/openvidu.service';
|
import { OpenViduService } from '../openvidu/openvidu.service';
|
||||||
|
@ -45,7 +46,8 @@ export class ParticipantService {
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
constructor(
|
constructor(
|
||||||
private openviduAngularConfigSrv: OpenViduComponentsConfigService,
|
private globalService: GlobalConfigService,
|
||||||
|
private directiveService: OpenViduComponentsConfigService,
|
||||||
private openviduService: OpenViduService,
|
private openviduService: OpenViduService,
|
||||||
private storageSrv: StorageService,
|
private storageSrv: StorageService,
|
||||||
private loggerSrv: LoggerService
|
private loggerSrv: LoggerService
|
||||||
|
@ -320,7 +322,7 @@ export class ParticipantService {
|
||||||
if (this.openviduService.isRoomConnected() && this.localParticipant) {
|
if (this.openviduService.isRoomConnected() && this.localParticipant) {
|
||||||
return this.localParticipant.isCameraEnabled;
|
return this.localParticipant.isCameraEnabled;
|
||||||
} else {
|
} else {
|
||||||
const directiveCameraEnabled = this.openviduAngularConfigSrv.isVideoEnabled();
|
const directiveCameraEnabled = this.directiveService.isVideoEnabled();
|
||||||
|
|
||||||
if (!directiveCameraEnabled) {
|
if (!directiveCameraEnabled) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -336,7 +338,7 @@ export class ParticipantService {
|
||||||
if (this.openviduService.isRoomConnected() && this.localParticipant) {
|
if (this.openviduService.isRoomConnected() && this.localParticipant) {
|
||||||
return this.localParticipant.isMicrophoneEnabled;
|
return this.localParticipant.isMicrophoneEnabled;
|
||||||
} else {
|
} else {
|
||||||
const directiveMicropgoneEnabled = this.openviduAngularConfigSrv.isAudioEnabled();
|
const directiveMicropgoneEnabled = this.directiveService.isAudioEnabled();
|
||||||
|
|
||||||
if (!directiveMicropgoneEnabled) {
|
if (!directiveMicropgoneEnabled) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -532,8 +534,8 @@ export class ParticipantService {
|
||||||
}
|
}
|
||||||
|
|
||||||
private newParticipant(props: ParticipantProperties) {
|
private newParticipant(props: ParticipantProperties) {
|
||||||
if (this.openviduAngularConfigSrv.hasParticipantFactory()) {
|
if (this.globalService.hasParticipantFactory()) {
|
||||||
return this.openviduAngularConfigSrv.getParticipantFactory().apply(this, [props]);
|
return this.globalService.getParticipantFactory().apply(this, [props]);
|
||||||
}
|
}
|
||||||
return new ParticipantModel(props);
|
return new ParticipantModel(props);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
|
||||||
import { BehaviorSubject, Observable } from 'rxjs';
|
import { BehaviorSubject, Observable } from 'rxjs';
|
||||||
import { RecordingInfo, RecordingStatus, RecordingStatusInfo } from '../../models/recording.model';
|
import { RecordingInfo, RecordingStatus, RecordingStatusInfo } from '../../models/recording.model';
|
||||||
import { ActionService } from '../action/action.service';
|
import { ActionService } from '../action/action.service';
|
||||||
import { OpenViduComponentsConfigService } from '../config/openvidu-components-angular.config.service';
|
import { GlobalConfigService } from '../config/global-config.service';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
|
@ -23,9 +23,9 @@ export class RecordingService {
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
constructor(private actionService: ActionService, private openviduConfigService: OpenViduComponentsConfigService) {
|
constructor(private actionService: ActionService, private globalService: GlobalConfigService) {
|
||||||
this.recordingStatusObs = this.recordingStatus.asObservable();
|
this.recordingStatusObs = this.recordingStatus.asObservable();
|
||||||
this.API_RECORDINGS_PREFIX = this.openviduConfigService.getBaseHref() + this.API_RECORDINGS_PREFIX;
|
this.API_RECORDINGS_PREFIX = this.globalService.getBaseHref() + this.API_RECORDINGS_PREFIX;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -49,6 +49,6 @@ export * from './lib/services/openvidu/openvidu.service';
|
||||||
export * from './lib/services/panel/panel.service';
|
export * from './lib/services/panel/panel.service';
|
||||||
export * from './lib/services/participant/participant.service';
|
export * from './lib/services/participant/participant.service';
|
||||||
export * from './lib/services/recording/recording.service';
|
export * from './lib/services/recording/recording.service';
|
||||||
export * from './lib/services/config/openvidu-components-angular.config.service';
|
export * from './lib/services/config/global-config.service';
|
||||||
|
|
||||||
export * from 'livekit-client';
|
export * from 'livekit-client';
|
||||||
|
|
Loading…
Reference in New Issue