openvidu-components: Updated library config

pull/707/head
csantosm 2022-02-14 14:12:58 +01:00
parent 3b46b7333b
commit 5d16528f82
10 changed files with 34 additions and 39 deletions

View File

@ -43,9 +43,6 @@
<div class="status-icons"> <div class="status-icons">
<!-- <div id="statusMic" *ngIf="!this._stream.streamManager?.stream?.audioActive">
<mat-icon>mic_off</mat-icon>
</div> -->
<button mat-icon-button id="statusMic" *ngIf="!this._stream.streamManager?.stream?.audioActive" disabled> <button mat-icon-button id="statusMic" *ngIf="!this._stream.streamManager?.stream?.audioActive" disabled>
<mat-icon>mic_off</mat-icon> <mat-icon>mic_off</mat-icon>
@ -54,11 +51,6 @@
<div class="videoButtons"> <div class="videoButtons">
<!-- Custom stream notifications -->
<ng-container *ngIf="notificationTemplate">
<ng-container *ngTemplateOutlet="notificationTemplate; context: { stream: _stream }"></ng-container>
</ng-container>
<button mat-icon-button (click)="toggleVideoMenu($event)" matTooltip="Settings" aria-label="Video settings menu"> <button mat-icon-button (click)="toggleVideoMenu($event)" matTooltip="Settings" aria-label="Video settings menu">
<mat-icon>more_vert</mat-icon> <mat-icon>more_vert</mat-icon>
</button> </button>

View File

@ -22,8 +22,6 @@ import { ParticipantService } from '../../services/participant/participant.servi
styleUrls: ['./stream.component.css'] styleUrls: ['./stream.component.css']
}) })
export class StreamComponent implements OnInit { export class StreamComponent implements OnInit {
@ContentChild('notification', { read: TemplateRef }) notificationTemplate: TemplateRef<any>;
videoSizeIconEnum = VideoSizeIcon; videoSizeIconEnum = VideoSizeIcon;
videoTypeEnum = VideoType; videoTypeEnum = VideoType;
videoSizeIcon: VideoSizeIcon = VideoSizeIcon.BIG; videoSizeIcon: VideoSizeIcon = VideoSizeIcon.BIG;

View File

@ -15,7 +15,7 @@
align-items: center; align-items: center;
} }
#media-buttons-container button, ::ng-deep #media-buttons-container>.ng-star-inserted { #media-buttons-container > *, ::ng-deep #media-buttons-container > * {
width: 40px; width: 40px;
height: 40px; height: 40px;
background-color: var(--ov-secondary-color); background-color: var(--ov-secondary-color);
@ -26,7 +26,7 @@
background-color: var(--ov-warn-color) !important; background-color: var(--ov-warn-color) !important;
} }
.active-btn { .active-btn, ::ng-deep .active-btn {
background-color: var(--ov-tertiary-color) !important; background-color: var(--ov-tertiary-color) !important;
} }

View File

@ -61,10 +61,8 @@
<mat-icon *ngIf="!isFullscreenEnabled" matTooltip="Fullscreen">fullscreen</mat-icon> <mat-icon *ngIf="!isFullscreenEnabled" matTooltip="Fullscreen">fullscreen</mat-icon>
</button> </button>
<!-- Custom centered buttons --> <!-- Custom toolbar buttons -->
<ng-container *ngIf="centeredButtonsTemplate"> <ng-content select="[toolbar-btn]"></ng-content>
<ng-container *ngTemplateOutlet="centeredButtonsTemplate"></ng-container>
</ng-container>
<!-- Leave session button --> <!-- Leave session button -->
<button mat-icon-button (click)="leaveSession()" id="leave-btn"> <button mat-icon-button (click)="leaveSession()" id="leave-btn">

View File

@ -102,11 +102,8 @@ export class ToolbarComponent implements OnInit, OnDestroy {
this.subscribeToUserMediaProperties(); this.subscribeToUserMediaProperties();
this.subscribeToReconnection(); this.subscribeToReconnection();
this.subscribeToMenuToggling();
if(!this.libraryConfigSrv.isUsingProLibrary()){ this.subscribeToChatMessages();
this.subscribeToMenuToggling();
this.subscribeToChatMessages();
}
} }
toggleMicrophone() { toggleMicrophone() {

View File

@ -9,8 +9,6 @@ import { StreamDirective } from '../../directives/stream/stream.directive';
export class VideoconferenceComponent implements OnInit { export class VideoconferenceComponent implements OnInit {
streamTemplate: TemplateRef<any>; streamTemplate: TemplateRef<any>;
// @ContentChild('layout', { read: TemplateRef }) layoutTemplate: TemplateRef<any>;
@ContentChild(StreamDirective) @ContentChild(StreamDirective)
set customStream(customStream: StreamDirective) { set customStream(customStream: StreamDirective) {
if (customStream) { if (customStream) {

View File

@ -1,6 +1,7 @@
export interface LibConfig { export interface LibConfig {
environment: { production?: boolean,
production: boolean; participantFactory?: ParticipantFactoryFunction,
useProdLibrary?: boolean
};
} }
export type ParticipantFactoryFunction = (connWrapper: any, participantId: string) => any;

View File

@ -144,9 +144,9 @@ import { AudioWaveComponent } from './components/audio-wave/audio-wave.component
entryComponents: [DialogTemplateComponent] entryComponents: [DialogTemplateComponent]
}) })
export class OpenviduAngularModule { export class OpenviduAngularModule {
static forRoot(environment): ModuleWithProviders<OpenviduAngularModule> { static forRoot(config): ModuleWithProviders<OpenviduAngularModule> {
// console.log(`${library.name} config: ${environment}`); // console.log(`${library.name} config: ${environment}`);
const libConfig: LibConfig = { environment }; const libConfig: LibConfig = config;
return { return {
ngModule: OpenviduAngularModule, ngModule: OpenviduAngularModule,
providers: [LibraryConfigService, { provide: 'LIB_CONFIG', useValue: libConfig }] providers: [LibraryConfigService, { provide: 'LIB_CONFIG', useValue: libConfig }]

View File

@ -1,5 +1,5 @@
import { Inject, Injectable } from '@angular/core'; import { Inject, Injectable } from '@angular/core';
import { LibConfig } from '../../config/lib.config'; import { LibConfig, ParticipantFactoryFunction } from '../../config/lib.config';
// import { version } from '../../../../package.json'; // import { version } from '../../../../package.json';
@ -10,8 +10,7 @@ export class LibraryConfigService {
constructor(@Inject('LIB_CONFIG') config: LibConfig) { constructor(@Inject('LIB_CONFIG') config: LibConfig) {
this.configuration = config; this.configuration = config;
console.log(this.configuration); console.log(this.configuration);
this.isUsingProLibrary() ? console.log('Using PRO library') : console.log('Using CE library'); if(this.isProduction()) console.log('OpenVidu Angular Production Mode');
if(this.isProduction()) console.log('Production Mode');
// console.log(version) // console.log(version)
} }
@ -19,10 +18,14 @@ export class LibraryConfigService {
return this.configuration; return this.configuration;
} }
isProduction(): boolean { isProduction(): boolean {
return this.configuration?.environment?.production; return this.configuration?.production;
} }
isUsingProLibrary(): boolean { hasParticipantFactory(): boolean {
return !!this.configuration?.environment?.useProdLibrary; return typeof this.getConfig().participantFactory === "function";
}
getParticipantFactory(): ParticipantFactoryFunction {
return this.getConfig().participantFactory;
} }
} }

View File

@ -4,6 +4,7 @@ import { BehaviorSubject, Observable } from 'rxjs';
import { ILogger } from '../../models/logger.model'; import { ILogger } from '../../models/logger.model';
import { StreamModel, ParticipantAbstractModel, ParticipantModel } from '../../models/participant.model'; import { StreamModel, ParticipantAbstractModel, ParticipantModel } from '../../models/participant.model';
import { VideoType } from '../../models/video-type.model'; import { VideoType } from '../../models/video-type.model';
import { LibraryConfigService } from '../library-config/library-config.service';
import { LoggerService } from '../logger/logger.service'; import { LoggerService } from '../logger/logger.service';
@Injectable({ @Injectable({
@ -29,7 +30,7 @@ export class ParticipantService {
protected log: ILogger; protected log: ILogger;
constructor(protected loggerSrv: LoggerService) { constructor(protected libraryConfigSrv: LibraryConfigService, protected loggerSrv: LoggerService) {
this.log = this.loggerSrv.get('ParticipantService'); this.log = this.loggerSrv.get('ParticipantService');
this.localParticipantObs = this._localParticipant.asObservable(); this.localParticipantObs = this._localParticipant.asObservable();
@ -42,6 +43,9 @@ export class ParticipantService {
this.updateLocalParticipant(); this.updateLocalParticipant();
} }
getLocalParticipant(): ParticipantAbstractModel {
return this.localParticipant;
}
getMyParticipantId(): string { getMyParticipantId(): string {
return this.localParticipant.id; return this.localParticipant.id;
} }
@ -189,7 +193,7 @@ export class ParticipantService {
return this.localParticipant.isScreenAudioActive(); return this.localParticipant.isScreenAudioActive();
} }
protected updateLocalParticipant() { updateLocalParticipant() {
// Cloning localParticipant object for not applying changes on the global variable // Cloning localParticipant object for not applying changes on the global variable
let participantsWithConnectionAvailable: ParticipantAbstractModel = Object.assign(this.newParticipant(), this.localParticipant); let participantsWithConnectionAvailable: ParticipantAbstractModel = Object.assign(this.newParticipant(), this.localParticipant);
const availableConnections = participantsWithConnectionAvailable.getAvailableConnections(); const availableConnections = participantsWithConnectionAvailable.getAvailableConnections();
@ -299,7 +303,11 @@ export class ParticipantService {
updateRemoteParticipants() { updateRemoteParticipants() {
this._remoteParticipants.next(this.remoteParticipants); this._remoteParticipants.next(this.remoteParticipants);
} }
protected newParticipant(steramModel?: StreamModel, participantId?: string) { protected newParticipant(streamModel?: StreamModel, participantId?: string) {
return new ParticipantModel(steramModel, participantId);
if(this.libraryConfigSrv.hasParticipantFactory()){
return this.libraryConfigSrv.getParticipantFactory().apply(this, [streamModel, participantId]);
}
return new ParticipantModel(streamModel, participantId);
} }
} }