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
|
* @internal
|
||||||
|
* @returns The participant active connection types
|
||||||
*/
|
*/
|
||||||
getConnectionTypesActive(): VideoType[] {
|
getActiveConnectionTypes(): VideoType[] {
|
||||||
let connType = [];
|
const activeTypes: VideoType[] = [];
|
||||||
if (this.isCameraActive()) connType.push(VideoType.CAMERA);
|
if (this.isCameraActive()) activeTypes.push(VideoType.CAMERA);
|
||||||
if (this.isScreenActive()) connType.push(VideoType.SCREEN);
|
if (this.isScreenActive()) activeTypes.push(VideoType.SCREEN);
|
||||||
|
|
||||||
return connType;
|
return activeTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -27,15 +27,11 @@ export class StreamTypesEnabledPipe implements PipeTransform {
|
||||||
constructor(private translateService: TranslateService) {}
|
constructor(private translateService: TranslateService) {}
|
||||||
|
|
||||||
transform(participant: ParticipantAbstractModel): string {
|
transform(participant: ParticipantAbstractModel): string {
|
||||||
let result = '';
|
|
||||||
let activeStreams = participant?.getConnectionTypesActive().toString();
|
const activeStreams = participant?.getActiveConnectionTypes() ?? [];
|
||||||
const activeStreamsArr: string[] = activeStreams.split(',');
|
const streamNames = activeStreams.map(streamType => this.translateService.translate(`PANEL.PARTICIPANTS.${streamType}`));
|
||||||
activeStreamsArr.forEach((type, index) => {
|
const streamsString = streamNames.join(', ');
|
||||||
result += this.translateService.translate(`PANEL.PARTICIPANTS.${type}`)
|
|
||||||
if(activeStreamsArr.length > 0 && index < activeStreamsArr.length - 1){
|
return `(${streamsString})`;
|
||||||
result += ', ';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return `(${result})`;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue