openvidu-components: Added constructor in participant abstract class

pull/690/head
csantosm 2022-01-26 16:08:04 +01:00
parent e16816422c
commit 4ebc22d9d0
1 changed files with 14 additions and 14 deletions

View File

@ -15,6 +15,20 @@ export abstract class ParticipantAbstractModel {
connections: Map<VideoType, StreamModel> = new Map();
id: string;
constructor(model?: StreamModel, id?: string) {
let streamModel: StreamModel = {
local: model ? model.local : true,
connected: true,
nickname: model ? model.nickname : 'OpenVidu_User',
type: model ? model.type : VideoType.CAMERA,
streamManager: model ? model.streamManager : null,
videoEnlarged: model ? model.videoEnlarged : false,
connectionId: model ? model.connectionId : null
};
this.connections.set(streamModel.type, streamModel);
this.id = id ? id : new Date().getTime().toString();
}
addConnection(streamModel: StreamModel) {
this.connections.set(streamModel.type, streamModel);
}
@ -161,20 +175,6 @@ export abstract class ParticipantAbstractModel {
export class ParticipantModel extends ParticipantAbstractModel {
constructor(model?: StreamModel, id?: string) {
super();
let streamModel: StreamModel = {
local: model ? model.local : true,
connected: true,
nickname: model ? model.nickname : 'OpenVidu_User',
type: model ? model.type : VideoType.CAMERA,
streamManager: model ? model.streamManager : null,
videoEnlarged: model ? model.videoEnlarged : false,
connectionId: model ? model.connectionId : null
};
this.connections.set(streamModel.type, streamModel);
this.id = id ? id : new Date().getTime().toString();
}
}