diff --git a/openvidu-testapp/src/app/components/dialogs/room-api-dialog/room-api-dialog.component.html b/openvidu-testapp/src/app/components/dialogs/room-api-dialog/room-api-dialog.component.html index 8bc04af8c..48532ff5c 100644 --- a/openvidu-testapp/src/app/components/dialogs/room-api-dialog/room-api-dialog.component.html +++ b/openvidu-testapp/src/app/components/dialogs/room-api-dialog/room-api-dialog.component.html @@ -62,6 +62,10 @@ Room + + Participant + + Audio Track @@ -93,6 +97,11 @@ [disabled]="!egressRoomName || (!!audioTrackId && !!videoTrackId || !audioTrackId && !videoTrackId)">Start Track Egress + + + diff --git a/openvidu-testapp/src/app/components/dialogs/room-api-dialog/room-api-dialog.component.ts b/openvidu-testapp/src/app/components/dialogs/room-api-dialog/room-api-dialog.component.ts index 717d11c41..f2dd63179 100644 --- a/openvidu-testapp/src/app/components/dialogs/room-api-dialog/room-api-dialog.component.ts +++ b/openvidu-testapp/src/app/components/dialogs/room-api-dialog/room-api-dialog.component.ts @@ -55,6 +55,7 @@ export class RoomApiDialogComponent { muteTrack: boolean = true; egressRoomName: string; + egressParticipantIdentity: string; egressId: string; audioTrackId: string; videoTrackId: string; @@ -146,6 +147,7 @@ export class RoomApiDialogComponent { .values() .next().value?.trackSid!; this.egressRoomName = this.room?.name; + this.egressParticipantIdentity = this.localParticipant?.identity; this.audioTrackId = this.localParticipant?.audioTrackPublications .values() .next().value?.trackSid!; @@ -308,6 +310,20 @@ export class RoomApiDialogComponent { } } + async startParticipantPassthroughEgress() { + console.log('Starting participant passthrough egress'); + try { + const egress = await this.roomApiService.startParticipantPassthroughEgress( + this.egressRoomName, + this.egressParticipantIdentity + ); + this.response = JSON.stringify(egress, null, 4); + this.egressId = egress.egressId; + } catch (error: any) { + this.response = error; + } + } + async stopEgress() { console.log('Stopping egress'); try { diff --git a/openvidu-testapp/src/app/services/room-api.service.ts b/openvidu-testapp/src/app/services/room-api.service.ts index 920354c16..062778b9a 100644 --- a/openvidu-testapp/src/app/services/room-api.service.ts +++ b/openvidu-testapp/src/app/services/room-api.service.ts @@ -8,6 +8,8 @@ import { DirectFileOutput, EgressClient, EgressInfo, + EncodedFileOutput, + EncodedFileType, EncodedOutputs, EncodingOptions, EncodingOptionsPreset, @@ -209,6 +211,29 @@ export class RoomApiService { return await this.egressClient.startTrackEgress(roomName, output, track_id); } + /** + * The participant's audio and video tracks, as they are published, without + * transcoding, in one Matroska file (OpenVidu egress: PASSTHROUGH for an + * audio track plus a video track). Needs exactly one file output of the + * default file type: ".webm" filepaths give WebM, anything else Matroska. + */ + async startParticipantPassthroughEgress( + roomName: string, + identity: string + ): Promise { + const file = new EncodedFileOutput({ + fileType: EncodedFileType.DEFAULT_FILETYPE, + filepath: + 'ParticipantPassthrough-{room_id}-{room_name}-{time}-{publisher_identity}.mkv', + }); + return await this.egressClient.startParticipantEgress( + roomName, + identity, + { file }, + { encodingOptions: EncodingOptionsPreset.PASSTHROUGH } + ); + } + async stopEgress(egressId: string): Promise { return await this.egressClient.stopEgress(egressId); }