mirror of https://github.com/OpenVidu/openvidu.git
37 lines
1.1 KiB
TypeScript
37 lines
1.1 KiB
TypeScript
![]() |
import { Pipe, PipeTransform } from '@angular/core';
|
||
![]() |
import { StreamModel, ParticipantAbstractModel } from '../models/participant.model';
|
||
![]() |
|
||
![]() |
@Pipe({ name: 'streams' })
|
||
|
export class ParticipantStreamsPipe implements PipeTransform {
|
||
![]() |
constructor() {}
|
||
|
|
||
![]() |
transform(participants: ParticipantAbstractModel[] | ParticipantAbstractModel): StreamModel[] {
|
||
![]() |
let streams: StreamModel[] = [];
|
||
![]() |
if (Array.isArray(participants)) {
|
||
|
participants.forEach((p) => {
|
||
![]() |
streams = streams.concat(Array.from(p.streams.values()));
|
||
![]() |
});
|
||
|
} else {
|
||
![]() |
streams = Array.from(participants.streams.values());
|
||
![]() |
}
|
||
![]() |
return streams;
|
||
![]() |
}
|
||
|
}
|
||
|
|
||
![]() |
@Pipe({ name: 'streamsEnabled', pure: false })
|
||
|
export class StreamsEnabledPipe 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();
|
||
|
}
|
||
|
}
|