2022-01-19 17:24:11 +01:00
|
|
|
import { Pipe, PipeTransform } from '@angular/core';
|
2022-01-26 11:30:30 +01:00
|
|
|
import { StreamModel, ParticipantAbstractModel } from '../models/participant.model';
|
2022-01-19 17:24:11 +01:00
|
|
|
|
|
|
|
@Pipe({ name: 'connections' })
|
|
|
|
export class ParticipantConnectionsPipe implements PipeTransform {
|
|
|
|
constructor() {}
|
|
|
|
|
2022-01-26 11:30:30 +01:00
|
|
|
transform(participants: ParticipantAbstractModel[] | ParticipantAbstractModel): StreamModel[] {
|
|
|
|
let connections: StreamModel[] = [];
|
2022-01-19 17:24:11 +01:00
|
|
|
if (Array.isArray(participants)) {
|
|
|
|
participants.forEach((p) => {
|
|
|
|
connections = connections.concat(Array.from(p.connections.values()));
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
connections = Array.from(participants.connections.values());
|
|
|
|
}
|
|
|
|
return connections;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Pipe({ name: 'connectionsEnabled', pure: false })
|
|
|
|
export class ConnectionsEnabledPipe implements PipeTransform {
|
|
|
|
constructor() {}
|
|
|
|
|
|
|
|
transform(participant: ParticipantAbstractModel): string {
|
|
|
|
return `(${participant.getConnectionTypesEnabled().toString().replace(',', ', ')})`;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Pipe({ name: 'nickname', pure: false })
|
|
|
|
export class NicknamePipe implements PipeTransform {
|
|
|
|
constructor() {}
|
|
|
|
transform(participant: ParticipantAbstractModel): string {
|
|
|
|
return participant.getCameraNickname();
|
|
|
|
}
|
|
|
|
}
|