mirror of https://github.com/OpenVidu/openvidu.git
openvidu-components: Renamed components and models
* ov-room to ov-session * ov-participant to ov-stream * ov-chat to ov-chat-panel * ov-participant-panel to ov-participants-panel * ConnectionWrapper to StreamModelpull/690/head
parent
6d37e4ce1f
commit
9f9f09c8c5
|
@ -2,21 +2,21 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
import { ChatService } from '../../services/chat/chat.service';
|
import { ChatService } from '../../services/chat/chat.service';
|
||||||
import { ChatServiceMock } from '../../services/chat/chat.service.mock';
|
import { ChatServiceMock } from '../../services/chat/chat.service.mock';
|
||||||
|
|
||||||
import { ChatComponent } from './chat.component';
|
import { ChatPanelComponent } from './chat-panel.component';
|
||||||
|
|
||||||
describe('ChatComponent', () => {
|
describe('ChatPanelComponent', () => {
|
||||||
let component: ChatComponent;
|
let component: ChatPanelComponent;
|
||||||
let fixture: ComponentFixture<ChatComponent>;
|
let fixture: ComponentFixture<ChatPanelComponent>;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
await TestBed.configureTestingModule({
|
await TestBed.configureTestingModule({
|
||||||
declarations: [ChatComponent],
|
declarations: [ChatPanelComponent],
|
||||||
providers: [{ provide: ChatService, useClass: ChatServiceMock }]
|
providers: [{ provide: ChatService, useClass: ChatServiceMock }]
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
fixture = TestBed.createComponent(ChatComponent);
|
fixture = TestBed.createComponent(ChatPanelComponent);
|
||||||
component = fixture.componentInstance;
|
component = fixture.componentInstance;
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
});
|
});
|
|
@ -6,11 +6,11 @@ import { ChatService } from '../../services/chat/chat.service';
|
||||||
import { SidenavMenuService } from '../../services/sidenav-menu/sidenav-menu.service';
|
import { SidenavMenuService } from '../../services/sidenav-menu/sidenav-menu.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ov-chat',
|
selector: 'ov-chat-panel',
|
||||||
templateUrl: './chat.component.html',
|
templateUrl: './chat-panel.component.html',
|
||||||
styleUrls: ['./chat.component.css']
|
styleUrls: ['./chat-panel.component.css']
|
||||||
})
|
})
|
||||||
export class ChatComponent implements OnInit, AfterViewInit {
|
export class ChatPanelComponent implements OnInit, AfterViewInit {
|
||||||
@ViewChild('chatScroll') chatScroll: ElementRef;
|
@ViewChild('chatScroll') chatScroll: ElementRef;
|
||||||
@ViewChild('chatInput') chatInput: ElementRef;
|
@ViewChild('chatInput') chatInput: ElementRef;
|
||||||
message: string;
|
message: string;
|
|
@ -15,8 +15,8 @@
|
||||||
|
|
||||||
<!-- Default menu content if custom menu content is not injected -->
|
<!-- Default menu content if custom menu content is not injected -->
|
||||||
<ng-template #defaultMenuContent>
|
<ng-template #defaultMenuContent>
|
||||||
<ov-chat *ngIf="isChatOpened"></ov-chat>
|
<ov-chat-panel *ngIf="isChatOpened"></ov-chat-panel>
|
||||||
<ov-participant-panel *ngIf="isParticipantsOpened"></ov-participant-panel>
|
<ov-participants-panel *ngIf="isParticipantsOpened"></ov-participants-panel>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
|
||||||
</mat-sidenav>
|
</mat-sidenav>
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
*ngFor="let connection of localParticipant | connections"
|
*ngFor="let connection of localParticipant | connections"
|
||||||
[ngClass]="{ OV_small: !connection.streamManager?.stream?.videoActive }"
|
[ngClass]="{ OV_small: !connection.streamManager?.stream?.videoActive }"
|
||||||
>
|
>
|
||||||
<ov-participant [participant]="connection" [videoEnlarged]="connection.videoEnlarged"></ov-participant>
|
<ov-stream [participant]="connection" [videoEnlarged]="connection.videoEnlarged"></ov-stream>
|
||||||
</div>
|
</div>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@
|
||||||
id="remote-participant"
|
id="remote-participant"
|
||||||
[ngClass]="{ OV_small: !connection.streamManager?.stream?.videoActive }"
|
[ngClass]="{ OV_small: !connection.streamManager?.stream?.videoActive }"
|
||||||
>
|
>
|
||||||
<ov-participant [participant]="connection" [videoEnlarged]="connection.videoEnlarged"></ov-participant>
|
<ov-stream [participant]="connection" [videoEnlarged]="connection.videoEnlarged"></ov-stream>
|
||||||
</div>
|
</div>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
import { ParticipantPanelComponent } from './participant-panel.component';
|
import { ParticipantsPanelComponent } from './participants-panel.component';
|
||||||
|
|
||||||
describe('ParticipantPanelComponent', () => {
|
describe('ParticipantsPanelComponent', () => {
|
||||||
let component: ParticipantPanelComponent;
|
let component: ParticipantsPanelComponent;
|
||||||
let fixture: ComponentFixture<ParticipantPanelComponent>;
|
let fixture: ComponentFixture<ParticipantsPanelComponent>;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
await TestBed.configureTestingModule({
|
await TestBed.configureTestingModule({
|
||||||
declarations: [ ParticipantPanelComponent ]
|
declarations: [ ParticipantsPanelComponent ]
|
||||||
})
|
})
|
||||||
.compileComponents();
|
.compileComponents();
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
fixture = TestBed.createComponent(ParticipantPanelComponent);
|
fixture = TestBed.createComponent(ParticipantsPanelComponent);
|
||||||
component = fixture.componentInstance;
|
component = fixture.componentInstance;
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
});
|
});
|
|
@ -4,11 +4,11 @@ import { ParticipantService } from '../../../services/participant/participant.se
|
||||||
import { SidenavMenuService } from '../../../services/sidenav-menu/sidenav-menu.service';
|
import { SidenavMenuService } from '../../../services/sidenav-menu/sidenav-menu.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ov-participant-panel',
|
selector: 'ov-participants-panel',
|
||||||
templateUrl: './participant-panel.component.html',
|
templateUrl: './participants-panel.component.html',
|
||||||
styleUrls: ['./participant-panel.component.css']
|
styleUrls: ['./participants-panel.component.css']
|
||||||
})
|
})
|
||||||
export class ParticipantPanelComponent implements OnInit {
|
export class ParticipantsPanelComponent implements OnInit {
|
||||||
localParticipant: any;
|
localParticipant: any;
|
||||||
remoteParticipants: ParticipantAbstractModel[] = [];
|
remoteParticipants: ParticipantAbstractModel[] = [];
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#room-container {
|
#session-container {
|
||||||
background-color: var(--ov-primary-color);
|
background-color: var(--ov-primary-color);
|
||||||
min-width: 400px;
|
min-width: 400px;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
@ -41,7 +41,7 @@
|
||||||
|
|
||||||
|
|
||||||
@media only screen and (max-width: 600px) {
|
@media only screen and (max-width: 600px) {
|
||||||
#room-container {
|
#session-container {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
/* position: fixed; */
|
/* position: fixed; */
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
<div id="room-container">
|
<div id="session-container">
|
||||||
|
|
||||||
<!-- Custom toolbar -->
|
<!-- Custom toolbar -->
|
||||||
<!-- <ng-container *ngIf="toolbarTemplate">
|
<!-- <ng-container *ngIf="toolbarTemplate">
|
|
@ -16,15 +16,15 @@ import { WebrtcServiceMock } from '../../services/webrtc/webrtc.service.mock';
|
||||||
import { ParticipantService } from '../../services/participant/participant.service';
|
import { ParticipantService } from '../../services/participant/participant.service';
|
||||||
import { ParticipantServiceMock } from '../../services/participant/participant.service.mock';
|
import { ParticipantServiceMock } from '../../services/participant/participant.service.mock';
|
||||||
|
|
||||||
import { RoomComponent } from './room.component';
|
import { SessionComponent } from './session.component';
|
||||||
|
|
||||||
describe('RoomComponent', () => {
|
describe('SessionComponent', () => {
|
||||||
let component: RoomComponent;
|
let component: SessionComponent;
|
||||||
let fixture: ComponentFixture<RoomComponent>;
|
let fixture: ComponentFixture<SessionComponent>;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
await TestBed.configureTestingModule({
|
await TestBed.configureTestingModule({
|
||||||
declarations: [ RoomComponent ],
|
declarations: [ SessionComponent ],
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: LoggerService, useClass: LoggerServiceMock },
|
{ provide: LoggerService, useClass: LoggerServiceMock },
|
||||||
{ provide: ActionService, useClass: ActionServiceMock },
|
{ provide: ActionService, useClass: ActionServiceMock },
|
||||||
|
@ -39,7 +39,7 @@ describe('RoomComponent', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
fixture = TestBed.createComponent(RoomComponent);
|
fixture = TestBed.createComponent(SessionComponent);
|
||||||
component = fixture.componentInstance;
|
component = fixture.componentInstance;
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
});
|
});
|
|
@ -14,11 +14,11 @@ import { Signal } from '../../models/signal.model';
|
||||||
import { ParticipantService } from '../../services/participant/participant.service';
|
import { ParticipantService } from '../../services/participant/participant.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ov-room',
|
selector: 'ov-session',
|
||||||
templateUrl: './room.component.html',
|
templateUrl: './session.component.html',
|
||||||
styleUrls: ['./room.component.css']
|
styleUrls: ['./session.component.css']
|
||||||
})
|
})
|
||||||
export class RoomComponent implements OnInit {
|
export class SessionComponent implements OnInit {
|
||||||
@ContentChild('toolbar', { read: TemplateRef }) toolbarTemplate: TemplateRef<any>;
|
@ContentChild('toolbar', { read: TemplateRef }) toolbarTemplate: TemplateRef<any>;
|
||||||
@Input() tokens: { webcam: string; screen: string };
|
@Input() tokens: { webcam: string; screen: string };
|
||||||
@Output() _session = new EventEmitter<any>();
|
@Output() _session = new EventEmitter<any>();
|
||||||
|
@ -38,7 +38,7 @@ export class RoomComponent implements OnInit {
|
||||||
protected tokenService: TokenService,
|
protected tokenService: TokenService,
|
||||||
protected platformService: PlatformService
|
protected platformService: PlatformService
|
||||||
) {
|
) {
|
||||||
this.log = this.loggerSrv.get('RoomComponent');
|
this.log = this.loggerSrv.get('SessionComponent');
|
||||||
}
|
}
|
||||||
|
|
||||||
@HostListener('window:beforeunload')
|
@HostListener('window:beforeunload')
|
|
@ -13,15 +13,15 @@ import { StorageService } from '../../services/storage/storage.service';
|
||||||
import { Signal } from '../../models/signal.model';
|
import { Signal } from '../../models/signal.model';
|
||||||
import { LayoutClass } from '../../models/layout.model';
|
import { LayoutClass } from '../../models/layout.model';
|
||||||
import { PublisherProperties } from 'openvidu-browser';
|
import { PublisherProperties } from 'openvidu-browser';
|
||||||
import { ConnectionWrapper } from '../../models/participant.model';
|
import { StreamModel } from '../../models/participant.model';
|
||||||
import { ParticipantService } from '../../services/participant/participant.service';
|
import { ParticipantService } from '../../services/participant/participant.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ov-participant',
|
selector: 'ov-stream',
|
||||||
templateUrl: './participant.component.html',
|
templateUrl: './stream.component.html',
|
||||||
styleUrls: ['./participant.component.css']
|
styleUrls: ['./stream.component.css']
|
||||||
})
|
})
|
||||||
export class ParticipantComponent implements OnInit {
|
export class StreamComponent implements OnInit {
|
||||||
videoSizeIconEnum = VideoSizeIcon;
|
videoSizeIconEnum = VideoSizeIcon;
|
||||||
videoTypeEnum = VideoType;
|
videoTypeEnum = VideoType;
|
||||||
videoSizeIcon: VideoSizeIcon = VideoSizeIcon.BIG;
|
videoSizeIcon: VideoSizeIcon = VideoSizeIcon.BIG;
|
||||||
|
@ -29,7 +29,7 @@ export class ParticipantComponent implements OnInit {
|
||||||
toggleNickname: boolean;
|
toggleNickname: boolean;
|
||||||
nicknameFormControl: FormControl;
|
nicknameFormControl: FormControl;
|
||||||
matcher: NicknameMatcher;
|
matcher: NicknameMatcher;
|
||||||
_participant: ConnectionWrapper;
|
_participant: StreamModel;
|
||||||
|
|
||||||
@ViewChild('streamComponent', { read: ViewContainerRef }) streamComponent: ViewContainerRef;
|
@ViewChild('streamComponent', { read: ViewContainerRef }) streamComponent: ViewContainerRef;
|
||||||
@ViewChild(MatMenuTrigger) public menuTrigger: MatMenuTrigger;
|
@ViewChild(MatMenuTrigger) public menuTrigger: MatMenuTrigger;
|
||||||
|
@ -53,14 +53,14 @@ export class ParticipantComponent implements OnInit {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// Has been mandatory fullscreen Input because of Input user did not fire changing
|
// Has been mandatory fullscreen Input because of Input user did not fire changing
|
||||||
// the fullscreen user property in publisherStartSpeaking event in VideoRoom Component
|
// the fullscreen user property in publisherStartSpeaking event in SessionComponent
|
||||||
@Input()
|
@Input()
|
||||||
set videoEnlarged(enlarged: boolean) {
|
set videoEnlarged(enlarged: boolean) {
|
||||||
this.checkVideoSizeBigIcon(enlarged);
|
this.checkVideoSizeBigIcon(enlarged);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
set participant(participant: ConnectionWrapper) {
|
set participant(participant: StreamModel) {
|
||||||
this._participant = participant;
|
this._participant = participant;
|
||||||
this.nicknameFormControl = new FormControl(this._participant.nickname, [Validators.maxLength(25), Validators.required]);
|
this.nicknameFormControl = new FormControl(this._participant.nickname, [Validators.maxLength(25), Validators.required]);
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
#call-container, #room-container {
|
#call-container, #session-container {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
<span>{{errorMessage}}</span>
|
<span>{{errorMessage}}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="room-container" *ngIf="joinSessionClicked && isSessionAlive && !error">
|
<div id="session-container" *ngIf="joinSessionClicked && isSessionAlive && !error">
|
||||||
<ov-room [tokens]="_tokens">
|
<ov-session [tokens]="_tokens">
|
||||||
<ng-template #toolbar>
|
<ng-template #toolbar>
|
||||||
<ov-toolbar
|
<ov-toolbar
|
||||||
(onCamClicked)="onCamClicked()"
|
(onCamClicked)="onCamClicked()"
|
||||||
|
@ -25,6 +25,6 @@
|
||||||
></ov-toolbar>
|
></ov-toolbar>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
<ov-layout layout></ov-layout>
|
<ov-layout layout></ov-layout>
|
||||||
</ov-room>
|
</ov-session>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Publisher, StreamManager } from 'openvidu-browser';
|
import { Publisher, StreamManager } from 'openvidu-browser';
|
||||||
import { VideoType } from './video-type.model';
|
import { VideoType } from './video-type.model';
|
||||||
|
|
||||||
export interface ConnectionWrapper {
|
export interface StreamModel {
|
||||||
local: boolean;
|
local: boolean;
|
||||||
connected: boolean;
|
connected: boolean;
|
||||||
nickname: string;
|
nickname: string;
|
||||||
|
@ -12,11 +12,11 @@ export interface ConnectionWrapper {
|
||||||
}
|
}
|
||||||
|
|
||||||
export abstract class ParticipantAbstractModel {
|
export abstract class ParticipantAbstractModel {
|
||||||
connections: Map<VideoType, ConnectionWrapper> = new Map();
|
connections: Map<VideoType, StreamModel> = new Map();
|
||||||
id: string;
|
id: string;
|
||||||
|
|
||||||
addConnection(connWrapper: ConnectionWrapper) {
|
addConnection(streamModel: StreamModel) {
|
||||||
this.connections.set(connWrapper.type, connWrapper);
|
this.connections.set(streamModel.type, streamModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
public isCameraAudioActive(): boolean {
|
public isCameraAudioActive(): boolean {
|
||||||
|
@ -37,11 +37,11 @@ export abstract class ParticipantAbstractModel {
|
||||||
return this.connections.has(type);
|
return this.connections.has(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public getCameraConnection(): ConnectionWrapper {
|
public getCameraConnection(): StreamModel {
|
||||||
return this.connections.get(VideoType.CAMERA);
|
return this.connections.get(VideoType.CAMERA);
|
||||||
}
|
}
|
||||||
|
|
||||||
public getScreenConnection(): ConnectionWrapper {
|
public getScreenConnection(): StreamModel {
|
||||||
return this.connections.get(VideoType.SCREEN);
|
return this.connections.get(VideoType.SCREEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,11 +68,11 @@ export abstract class ParticipantAbstractModel {
|
||||||
return Array.from(this.connections.values()).some((conn) => conn.connectionId === connectionId);
|
return Array.from(this.connections.values()).some((conn) => conn.connectionId === connectionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
getConnectionById(connectionId: string): ConnectionWrapper {
|
getConnectionById(connectionId: string): StreamModel {
|
||||||
return Array.from(this.connections.values()).find((conn) => conn.connectionId === connectionId);
|
return Array.from(this.connections.values()).find((conn) => conn.connectionId === connectionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
getAvailableConnections(): ConnectionWrapper[] {
|
getAvailableConnections(): StreamModel[] {
|
||||||
return Array.from(this.connections.values()).filter((conn) => conn.connected);
|
return Array.from(this.connections.values()).filter((conn) => conn.connected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,18 +161,18 @@ export abstract class ParticipantAbstractModel {
|
||||||
|
|
||||||
export class ParticipantModel extends ParticipantAbstractModel {
|
export class ParticipantModel extends ParticipantAbstractModel {
|
||||||
|
|
||||||
constructor(connWrapper?: ConnectionWrapper, id?: string) {
|
constructor(model?: StreamModel, id?: string) {
|
||||||
super();
|
super();
|
||||||
let connectionWrapper: ConnectionWrapper = {
|
let streamModel: StreamModel = {
|
||||||
local: connWrapper ? connWrapper.local : true,
|
local: model ? model.local : true,
|
||||||
connected: true,
|
connected: true,
|
||||||
nickname: connWrapper ? connWrapper.nickname : 'OpenVidu_User',
|
nickname: model ? model.nickname : 'OpenVidu_User',
|
||||||
type: connWrapper ? connWrapper.type : VideoType.CAMERA,
|
type: model ? model.type : VideoType.CAMERA,
|
||||||
streamManager: connWrapper ? connWrapper.streamManager : null,
|
streamManager: model ? model.streamManager : null,
|
||||||
videoEnlarged: connWrapper ? connWrapper.videoEnlarged : false,
|
videoEnlarged: model ? model.videoEnlarged : false,
|
||||||
connectionId: connWrapper ? connWrapper.connectionId : null
|
connectionId: model ? model.connectionId : null
|
||||||
};
|
};
|
||||||
this.connections.set(connectionWrapper.type, connectionWrapper);
|
this.connections.set(streamModel.type, streamModel);
|
||||||
this.id = id ? id : new Date().getTime().toString();
|
this.id = id ? id : new Date().getTime().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,10 +29,10 @@ import { HttpClientModule } from '@angular/common/http';
|
||||||
import { UserSettingsComponent } from './components/user-settings/user-settings.component';
|
import { UserSettingsComponent } from './components/user-settings/user-settings.component';
|
||||||
import { ToolbarComponent } from './components/toolbar/toolbar.component';
|
import { ToolbarComponent } from './components/toolbar/toolbar.component';
|
||||||
import { VideoComponent } from './components/video/video.component';
|
import { VideoComponent } from './components/video/video.component';
|
||||||
import { ChatComponent } from './components/chat/chat.component';
|
import { ChatPanelComponent } from './components/chat-panel/chat-panel.component';
|
||||||
import { RoomComponent } from './components/room/room.component';
|
import { SessionComponent } from './components/session/session.component';
|
||||||
import { LayoutComponent } from './components/layout/layout.component';
|
import { LayoutComponent } from './components/layout/layout.component';
|
||||||
import { ParticipantComponent } from './components/participant/participant.component';
|
import { StreamComponent } from './components/stream/stream.component';
|
||||||
import { DialogTemplateComponent } from './components/material/dialog.component';
|
import { DialogTemplateComponent } from './components/material/dialog.component';
|
||||||
|
|
||||||
import { LinkifyPipe } from './pipes/linkify.pipe';
|
import { LinkifyPipe } from './pipes/linkify.pipe';
|
||||||
|
@ -55,7 +55,7 @@ import { LayoutService } from './services/layout/layout.service';
|
||||||
import { SidenavMenuService } from './services/sidenav-menu/sidenav-menu.service';
|
import { SidenavMenuService } from './services/sidenav-menu/sidenav-menu.service';
|
||||||
import { ParticipantService } from './services/participant/participant.service';
|
import { ParticipantService } from './services/participant/participant.service';
|
||||||
import { ParticipantItemComponent } from './components/participants-panel/participant-item/participant-item.component';
|
import { ParticipantItemComponent } from './components/participants-panel/participant-item/participant-item.component';
|
||||||
import { ParticipantPanelComponent } from './components/participants-panel/participant-panel/participant-panel.component';
|
import { ParticipantsPanelComponent } from './components/participants-panel/participants-panel/participants-panel.component';
|
||||||
import { VideoconferenceComponent } from './components/videoconference/videoconference.component';
|
import { VideoconferenceComponent } from './components/videoconference/videoconference.component';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
|
@ -63,10 +63,10 @@ import { VideoconferenceComponent } from './components/videoconference/videoconf
|
||||||
UserSettingsComponent,
|
UserSettingsComponent,
|
||||||
VideoComponent,
|
VideoComponent,
|
||||||
ToolbarComponent,
|
ToolbarComponent,
|
||||||
ChatComponent,
|
ChatPanelComponent,
|
||||||
RoomComponent,
|
SessionComponent,
|
||||||
LayoutComponent,
|
LayoutComponent,
|
||||||
ParticipantComponent,
|
StreamComponent,
|
||||||
DialogTemplateComponent,
|
DialogTemplateComponent,
|
||||||
LinkifyPipe,
|
LinkifyPipe,
|
||||||
TooltipListPipe,
|
TooltipListPipe,
|
||||||
|
@ -74,7 +74,7 @@ import { VideoconferenceComponent } from './components/videoconference/videoconf
|
||||||
ConnectionsEnabledPipe,
|
ConnectionsEnabledPipe,
|
||||||
NicknamePipe,
|
NicknamePipe,
|
||||||
ParticipantItemComponent,
|
ParticipantItemComponent,
|
||||||
ParticipantPanelComponent,
|
ParticipantsPanelComponent,
|
||||||
VideoconferenceComponent
|
VideoconferenceComponent
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
|
@ -124,10 +124,10 @@ import { VideoconferenceComponent } from './components/videoconference/videoconf
|
||||||
VideoconferenceComponent,
|
VideoconferenceComponent,
|
||||||
UserSettingsComponent,
|
UserSettingsComponent,
|
||||||
ToolbarComponent,
|
ToolbarComponent,
|
||||||
ChatComponent,
|
ChatPanelComponent,
|
||||||
RoomComponent,
|
SessionComponent,
|
||||||
LayoutComponent,
|
LayoutComponent,
|
||||||
ParticipantComponent,
|
StreamComponent,
|
||||||
VideoComponent,
|
VideoComponent,
|
||||||
ParticipantConnectionsPipe,
|
ParticipantConnectionsPipe,
|
||||||
CommonModule
|
CommonModule
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import { Pipe, PipeTransform } from '@angular/core';
|
import { Pipe, PipeTransform } from '@angular/core';
|
||||||
import { ConnectionWrapper, ParticipantAbstractModel } from '../models/participant.model';
|
import { StreamModel, ParticipantAbstractModel } from '../models/participant.model';
|
||||||
|
|
||||||
@Pipe({ name: 'connections' })
|
@Pipe({ name: 'connections' })
|
||||||
export class ParticipantConnectionsPipe implements PipeTransform {
|
export class ParticipantConnectionsPipe implements PipeTransform {
|
||||||
constructor() {}
|
constructor() {}
|
||||||
|
|
||||||
transform(participants: ParticipantAbstractModel[] | ParticipantAbstractModel): ConnectionWrapper[] {
|
transform(participants: ParticipantAbstractModel[] | ParticipantAbstractModel): StreamModel[] {
|
||||||
let connections: ConnectionWrapper[] = [];
|
let connections: StreamModel[] = [];
|
||||||
if (Array.isArray(participants)) {
|
if (Array.isArray(participants)) {
|
||||||
participants.forEach((p) => {
|
participants.forEach((p) => {
|
||||||
connections = connections.concat(Array.from(p.connections.values()));
|
connections = connections.concat(Array.from(p.connections.values()));
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
|
||||||
import { Publisher, Subscriber } from 'openvidu-browser';
|
import { Publisher, Subscriber } from 'openvidu-browser';
|
||||||
import { BehaviorSubject, Observable } from 'rxjs';
|
import { BehaviorSubject, Observable } from 'rxjs';
|
||||||
import { ILogger } from '../../models/logger.model';
|
import { ILogger } from '../../models/logger.model';
|
||||||
import { ConnectionWrapper, 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 { LoggerService } from '../logger/logger.service';
|
import { LoggerService } from '../logger/logger.service';
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ export class ParticipantService {
|
||||||
enableScreenUser(screenPublisher: Publisher) {
|
enableScreenUser(screenPublisher: Publisher) {
|
||||||
this.log.d('Enabling screen publisher');
|
this.log.d('Enabling screen publisher');
|
||||||
|
|
||||||
const connWrapper: ConnectionWrapper = {
|
const steramModel: StreamModel = {
|
||||||
local: true,
|
local: true,
|
||||||
type: VideoType.SCREEN,
|
type: VideoType.SCREEN,
|
||||||
videoEnlarged: true,
|
videoEnlarged: true,
|
||||||
|
@ -97,7 +97,7 @@ export class ParticipantService {
|
||||||
connectionId: null
|
connectionId: null
|
||||||
};
|
};
|
||||||
|
|
||||||
this.localParticipant.addConnection(connWrapper);
|
this.localParticipant.addConnection(steramModel);
|
||||||
|
|
||||||
this._screensharing.next(true);
|
this._screensharing.next(true);
|
||||||
|
|
||||||
|
@ -205,7 +205,7 @@ export class ParticipantService {
|
||||||
|
|
||||||
addRemoteConnection(connectionId:string, data: string, subscriber: Subscriber) {
|
addRemoteConnection(connectionId:string, data: string, subscriber: Subscriber) {
|
||||||
|
|
||||||
const connWrapper: ConnectionWrapper = {
|
const steramModel: StreamModel = {
|
||||||
local: false,
|
local: false,
|
||||||
type: this.getTypeConnectionData(data),
|
type: this.getTypeConnectionData(data),
|
||||||
videoEnlarged: false,
|
videoEnlarged: false,
|
||||||
|
@ -219,16 +219,16 @@ export class ParticipantService {
|
||||||
const participantAdded = this.getRemoteParticipantById(participantId);
|
const participantAdded = this.getRemoteParticipantById(participantId);
|
||||||
if (!!participantAdded) {
|
if (!!participantAdded) {
|
||||||
this.log.d('Adding connection to existing participant: ', participantId);
|
this.log.d('Adding connection to existing participant: ', participantId);
|
||||||
if(participantAdded.hasConnectionType(connWrapper.type)) {
|
if(participantAdded.hasConnectionType(steramModel.type)) {
|
||||||
this.log.d('Participant has publisher, updating it');
|
this.log.d('Participant has publisher, updating it');
|
||||||
participantAdded.setPublisher(connWrapper.type, subscriber);
|
participantAdded.setPublisher(steramModel.type, subscriber);
|
||||||
} else {
|
} else {
|
||||||
this.log.d('Participant has not publisher, adding it');
|
this.log.d('Participant has not publisher, adding it');
|
||||||
participantAdded.addConnection(connWrapper);
|
participantAdded.addConnection(steramModel);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.log.d('Creating new participant with id: ', participantId);
|
this.log.d('Creating new participant with id: ', participantId);
|
||||||
const remoteParticipant = this.newParticipant(connWrapper, participantId);
|
const remoteParticipant = this.newParticipant(steramModel, participantId);
|
||||||
this.remoteParticipants.push(remoteParticipant);
|
this.remoteParticipants.push(remoteParticipant);
|
||||||
}
|
}
|
||||||
this.updateRemoteParticipants();
|
this.updateRemoteParticipants();
|
||||||
|
@ -300,7 +300,7 @@ export class ParticipantService {
|
||||||
protected updateRemoteParticipants() {
|
protected updateRemoteParticipants() {
|
||||||
this._remoteParticipants.next(this.remoteParticipants);
|
this._remoteParticipants.next(this.remoteParticipants);
|
||||||
}
|
}
|
||||||
protected newParticipant(connWrapper?: ConnectionWrapper, participantId?: string) {
|
protected newParticipant(steramModel?: StreamModel, participantId?: string) {
|
||||||
return new ParticipantModel(connWrapper, participantId);
|
return new ParticipantModel(steramModel, participantId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,10 +24,11 @@ export * from './lib/services/storage/storage.service';
|
||||||
export * from './lib/components/videoconference/videoconference.component';
|
export * from './lib/components/videoconference/videoconference.component';
|
||||||
export * from './lib/components/user-settings/user-settings.component';
|
export * from './lib/components/user-settings/user-settings.component';
|
||||||
export * from './lib/components/toolbar/toolbar.component';
|
export * from './lib/components/toolbar/toolbar.component';
|
||||||
export * from './lib/components/chat/chat.component';
|
export * from './lib/components/chat-panel/chat-panel.component';
|
||||||
export * from './lib/components/room/room.component';
|
export * from './lib/components/participants-panel/participants-panel/participants-panel.component';
|
||||||
|
export * from './lib/components/session/session.component';
|
||||||
export * from './lib/components/layout/layout.component';
|
export * from './lib/components/layout/layout.component';
|
||||||
export * from './lib/components/participant/participant.component';
|
export * from './lib/components/stream/stream.component';
|
||||||
export * from './lib/components/video/video.component';
|
export * from './lib/components/video/video.component';
|
||||||
|
|
||||||
// Models
|
// Models
|
||||||
|
|
|
@ -14,14 +14,14 @@ import { ToolbarTestComponent } from './components/toolbar-test/toolbar-test.com
|
||||||
import { DashboardComponent } from './dashboard/dashboard.component';
|
import { DashboardComponent } from './dashboard/dashboard.component';
|
||||||
import { ChatTestComponent } from './components/chat-test/chat-test.component';
|
import { ChatTestComponent } from './components/chat-test/chat-test.component';
|
||||||
import { LayoutTestComponent } from './components/layout-test/layout-test.component';
|
import { LayoutTestComponent } from './components/layout-test/layout-test.component';
|
||||||
import { ParticipantTestComponent } from './components/participant-test/participant-test.component';
|
import { StreamTestComponent } from './components/stream-test/stream-test.component';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
OpenviduAngularModule,
|
OpenviduAngularModule,
|
||||||
UserSettingsComponent,
|
UserSettingsComponent,
|
||||||
ChatComponent,
|
ChatPanelComponent,
|
||||||
ToolbarComponent,
|
ToolbarComponent,
|
||||||
RoomComponent,
|
SessionComponent,
|
||||||
LayoutComponent,
|
LayoutComponent,
|
||||||
VideoconferenceComponent
|
VideoconferenceComponent
|
||||||
} from 'openvidu-angular';
|
} from 'openvidu-angular';
|
||||||
|
@ -35,7 +35,7 @@ import { MatButtonModule } from '@angular/material/button';
|
||||||
ToolbarTestComponent,
|
ToolbarTestComponent,
|
||||||
ChatTestComponent,
|
ChatTestComponent,
|
||||||
LayoutTestComponent,
|
LayoutTestComponent,
|
||||||
ParticipantTestComponent
|
StreamTestComponent
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
BrowserModule,
|
BrowserModule,
|
||||||
|
@ -44,7 +44,7 @@ import { MatButtonModule } from '@angular/material/button';
|
||||||
OpenviduAngularModule.forRoot(environment),
|
OpenviduAngularModule.forRoot(environment),
|
||||||
AppRoutingModule // Order is important, AppRoutingModule must be the last import for useHash working
|
AppRoutingModule // Order is important, AppRoutingModule must be the last import for useHash working
|
||||||
],
|
],
|
||||||
providers: [VideoconferenceComponent, UserSettingsComponent, ToolbarComponent, ChatComponent, RoomComponent, LayoutComponent],
|
providers: [VideoconferenceComponent, UserSettingsComponent, ToolbarComponent, ChatPanelComponent, SessionComponent, LayoutComponent],
|
||||||
bootstrap: [AppComponent]
|
bootstrap: [AppComponent]
|
||||||
})
|
})
|
||||||
export class AppModule {}
|
export class AppModule {}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { CallComponent } from './openvidu-call/call.component';
|
||||||
import { ToolbarTestComponent } from './components/toolbar-test/toolbar-test.component';
|
import { ToolbarTestComponent } from './components/toolbar-test/toolbar-test.component';
|
||||||
import { ChatTestComponent } from './components/chat-test/chat-test.component';
|
import { ChatTestComponent } from './components/chat-test/chat-test.component';
|
||||||
import { LayoutTestComponent } from './components/layout-test/layout-test.component';
|
import { LayoutTestComponent } from './components/layout-test/layout-test.component';
|
||||||
import { ParticipantTestComponent } from './components/participant-test/participant-test.component';
|
import { StreamTestComponent } from './components/stream-test/stream-test.component';
|
||||||
|
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
{ path: '', component: DashboardComponent },
|
{ path: '', component: DashboardComponent },
|
||||||
|
@ -13,7 +13,7 @@ const routes: Routes = [
|
||||||
{ path: 'toolbar', component: ToolbarTestComponent },
|
{ path: 'toolbar', component: ToolbarTestComponent },
|
||||||
{ path: 'chat', component: ChatTestComponent },
|
{ path: 'chat', component: ChatTestComponent },
|
||||||
{ path: 'layout', component: LayoutTestComponent },
|
{ path: 'layout', component: LayoutTestComponent },
|
||||||
{ path: 'participant', component: ParticipantTestComponent }
|
{ path: 'stream', component: StreamTestComponent }
|
||||||
];
|
];
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [RouterModule.forRoot(routes, { useHash: true })],
|
imports: [RouterModule.forRoot(routes, { useHash: true })],
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
|
|
||||||
<div id="chat-test-container">
|
<div id="chat-test-container">
|
||||||
<!-- OPENVIDU CHAT -->
|
<!-- OPENVIDU CHAT -->
|
||||||
<ov-chat></ov-chat>
|
<ov-chat-panel></ov-chat-panel>
|
||||||
<span>WARNING: Like chat component need an active room, this page only allow check and test the UI</span>
|
<span>WARNING: Like chat component need an active room, this page only allow check and test the UI</span>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -29,9 +29,9 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="participant-test-container">
|
<div id="stream-test-container">
|
||||||
<!-- OPENVIDU PARTICIPANT -->
|
|
||||||
<ov-participant [participant]="participant"></ov-participant>
|
<ov-stream [participant]="participant"></ov-stream>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#participant-test-container{
|
#stream-test-container{
|
||||||
background: #d1d1d1;
|
background: #d1d1d1;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 50px;
|
left: 50px;
|
|
@ -1,20 +1,20 @@
|
||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
import { ParticipantTestComponent } from './participant-test.component';
|
import { StreamTestComponent } from './stream-test.component';
|
||||||
|
|
||||||
describe('ParticipantTestComponent', () => {
|
describe('StreamTestComponent', () => {
|
||||||
let component: ParticipantTestComponent;
|
let component: StreamTestComponent;
|
||||||
let fixture: ComponentFixture<ParticipantTestComponent>;
|
let fixture: ComponentFixture<StreamTestComponent>;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
await TestBed.configureTestingModule({
|
await TestBed.configureTestingModule({
|
||||||
declarations: [ ParticipantTestComponent ]
|
declarations: [ StreamTestComponent ]
|
||||||
})
|
})
|
||||||
.compileComponents();
|
.compileComponents();
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
fixture = TestBed.createComponent(ParticipantTestComponent);
|
fixture = TestBed.createComponent(StreamTestComponent);
|
||||||
component = fixture.componentInstance;
|
component = fixture.componentInstance;
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
});
|
});
|
|
@ -2,11 +2,11 @@ import { Component, OnInit } from '@angular/core';
|
||||||
import { ParticipantModel } from 'openvidu-angular';
|
import { ParticipantModel } from 'openvidu-angular';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-participant-test',
|
selector: 'app-stream-test',
|
||||||
templateUrl: './participant-test.component.html',
|
templateUrl: './stream-test.component.html',
|
||||||
styleUrls: ['./participant-test.component.scss']
|
styleUrls: ['./stream-test.component.scss']
|
||||||
})
|
})
|
||||||
export class ParticipantTestComponent implements OnInit {
|
export class StreamTestComponent implements OnInit {
|
||||||
|
|
||||||
participant: ParticipantModel;
|
participant: ParticipantModel;
|
||||||
constructor() { }
|
constructor() { }
|
|
@ -45,8 +45,8 @@
|
||||||
<span>Layout Component</span>
|
<span>Layout Component</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card card-small" (click)="goTo('participant')" tabindex="0">
|
<div class="card card-small" (click)="goTo('stream')" tabindex="0">
|
||||||
<span>Participant Component</span>
|
<span>Stream Component</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card card-small" (click)="goTo('chat')" tabindex="0">
|
<div class="card card-small" (click)="goTo('chat')" tabindex="0">
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div *ngIf="joinSessionClicked && isSessionAlive" style="height: 100%;">
|
<div *ngIf="joinSessionClicked && isSessionAlive" style="height: 100%;">
|
||||||
<ov-room [tokens]="tokens">
|
<ov-session [tokens]="tokens">
|
||||||
<ng-template #toolbar>
|
<ng-template #toolbar>
|
||||||
<ov-toolbar
|
<ov-toolbar
|
||||||
(onCamClicked)="onCamClicked()"
|
(onCamClicked)="onCamClicked()"
|
||||||
|
@ -15,6 +15,6 @@
|
||||||
></ov-toolbar>
|
></ov-toolbar>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
<ov-layout layout></ov-layout>
|
<ov-layout layout></ov-layout>
|
||||||
</ov-room>
|
</ov-session>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue