mirror of https://github.com/OpenVidu/openvidu.git
openvidu-components: Refactored streams types enabled pipe
parent
d78774b218
commit
55db788f50
|
@ -160,13 +160,14 @@ export abstract class ParticipantAbstractModel {
|
|||
|
||||
/**
|
||||
* @internal
|
||||
* @returns The participant active connection types
|
||||
*/
|
||||
getConnectionTypesActive(): VideoType[] {
|
||||
let connType = [];
|
||||
if (this.isCameraActive()) connType.push(VideoType.CAMERA);
|
||||
if (this.isScreenActive()) connType.push(VideoType.SCREEN);
|
||||
getActiveConnectionTypes(): VideoType[] {
|
||||
const activeTypes: VideoType[] = [];
|
||||
if (this.isCameraActive()) activeTypes.push(VideoType.CAMERA);
|
||||
if (this.isScreenActive()) activeTypes.push(VideoType.SCREEN);
|
||||
|
||||
return connType;
|
||||
return activeTypes;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -27,15 +27,11 @@ export class StreamTypesEnabledPipe implements PipeTransform {
|
|||
constructor(private translateService: TranslateService) {}
|
||||
|
||||
transform(participant: ParticipantAbstractModel): string {
|
||||
let result = '';
|
||||
let activeStreams = participant?.getConnectionTypesActive().toString();
|
||||
const activeStreamsArr: string[] = activeStreams.split(',');
|
||||
activeStreamsArr.forEach((type, index) => {
|
||||
result += this.translateService.translate(`PANEL.PARTICIPANTS.${type}`)
|
||||
if(activeStreamsArr.length > 0 && index < activeStreamsArr.length - 1){
|
||||
result += ', ';
|
||||
}
|
||||
});
|
||||
return `(${result})`;
|
||||
|
||||
const activeStreams = participant?.getActiveConnectionTypes() ?? [];
|
||||
const streamNames = activeStreams.map(streamType => this.translateService.translate(`PANEL.PARTICIPANTS.${streamType}`));
|
||||
const streamsString = streamNames.join(', ');
|
||||
|
||||
return `(${streamsString})`;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue