diff --git a/openvidu-testapp/src/app/components/dialogs/room-api-dialog/room-api-dialog.component.css b/openvidu-testapp/src/app/components/dialogs/room-api-dialog/room-api-dialog.component.css index 0743aa8fef..acb05c0f9e 100644 --- a/openvidu-testapp/src/app/components/dialogs/room-api-dialog/room-api-dialog.component.css +++ b/openvidu-testapp/src/app/components/dialogs/room-api-dialog/room-api-dialog.component.css @@ -126,8 +126,8 @@ mat-chip-row { margin-bottom: 7px; } -#ingress-simulcast { - margin-right: 6px; +#ingress-video-codec-select { + margin-left: 6px; } #ingress-video-codec-select { 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 bb92d6421e..9d39ea0267 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 @@ -194,6 +194,9 @@

API REST

Simulcast + + Transcoding + 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 c84ecd25e1..3654196f93 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 @@ -65,6 +65,7 @@ export class RoomApiDialogComponent { ingressWithAudio: boolean = false; ingressVideoCodecSelected: VideoCodec = VideoCodec.H264_BASELINE; ingressSimulcast: boolean = true; + ingressEnableTranscoding: boolean = false; ingressVideoEncodingPresetSelected?: IngressVideoEncodingPreset = undefined; response: string; @@ -306,6 +307,7 @@ export class RoomApiDialogComponent { this.ingressWithVideo, this.ingressVideoCodecSelected, this.ingressSimulcast, + this.ingressEnableTranscoding, this.ingressVideoEncodingPresetSelected ); this.response = JSON.stringify(ingress, null, 4); diff --git a/openvidu-testapp/src/app/services/room-api.service.ts b/openvidu-testapp/src/app/services/room-api.service.ts index 24a685f324..8907c92c35 100644 --- a/openvidu-testapp/src/app/services/room-api.service.ts +++ b/openvidu-testapp/src/app/services/room-api.service.ts @@ -207,11 +207,12 @@ export class RoomApiService { async createIngress( room_name: string, - input_type: IngressInput, + inputType: IngressInput, withAudio: boolean, withVideo: boolean, codec: VideoCodec, simulcast: boolean, + enableTranscoding: boolean, preset?: IngressVideoEncodingPreset ): Promise { let url; @@ -224,59 +225,63 @@ export class RoomApiService { : 'https://s3.eu-west-1.amazonaws.com/public.openvidu.io/bbb_sunflower_1080p_60fps_normal_noaudio.mp4'; } let options: CreateIngressOptions = { - name: input_type + '-' + room_name, + name: inputType + '-' + room_name, roomName: room_name, participantIdentity: 'IngressParticipantIdentity', participantName: 'MyIngress', participantMetadata: 'IngressParticipantMetadata', url, - video: { + }; + if (inputType === IngressInput.WHIP_INPUT) { + options.enableTranscoding = enableTranscoding; + } + if (inputType != IngressInput.WHIP_INPUT || enableTranscoding) { + options.video = { encodingOptions: { case: preset != undefined ? 'preset' : 'options', value: {}, }, - } as any, - }; - if (preset != undefined) { - options.video!.encodingOptions.value = preset; - } else { - const encodingOptions = options.video!.encodingOptions - .value! as IngressVideoEncodingOptions; - encodingOptions.videoCodec = codec; - encodingOptions.frameRate = 30; - let layers: VideoLayer[] = []; - if (simulcast) { - layers = [ - { - quality: VideoQuality.HIGH, - width: 1920, - height: 1080, - }, - { - quality: VideoQuality.MEDIUM, - width: 1280, - height: 720, - }, - { - quality: VideoQuality.LOW, - width: 640, - height: 360, - }, - ] as VideoLayer[]; + } as any; + if (preset != undefined) { + options.video!.encodingOptions.value = preset; } else { - layers = [ - { - quality: VideoQuality.HIGH, - width: 1920, - height: 1080, - } as VideoLayer, - ]; + const encodingOptions = options.video!.encodingOptions + .value! as IngressVideoEncodingOptions; + encodingOptions.videoCodec = codec; + encodingOptions.frameRate = 30; + let layers: VideoLayer[] = []; + if (simulcast) { + layers = [ + { + quality: VideoQuality.HIGH, + width: 1920, + height: 1080, + }, + { + quality: VideoQuality.MEDIUM, + width: 1280, + height: 720, + }, + { + quality: VideoQuality.LOW, + width: 640, + height: 360, + }, + ] as VideoLayer[]; + } else { + layers = [ + { + quality: VideoQuality.HIGH, + width: 1920, + height: 1080, + } as VideoLayer, + ]; + } + encodingOptions.layers = layers; } - encodingOptions.layers = layers; } - const ingressInfo = await this.ingressClient.createIngress( - input_type, + inputType, options ); return ingressInfo;