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 8679e114..13bbd961 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 @@ -39,6 +39,7 @@ mat-dialog-content button { .inner-text-input { margin-left: 6px; width: 22%; + min-width: 200px; } #clear-response-text-area-btn { 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 db0e1d51..236cd953 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 @@ -228,6 +228,12 @@ + + + URI + + + 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 d7c937fa..138f56e9 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 @@ -7,7 +7,6 @@ import { VideoCodec } from '@livekit/protocol'; import { LocalParticipant } from 'livekit-client'; import { - DirectFileOutput, EgressClient, EncodedFileOutput, EncodedFileType, @@ -23,7 +22,14 @@ import { StreamOutput, StreamProtocol, } from 'livekit-server-sdk'; -import { RoomApiService } from 'src/app/services/room-api.service'; +import { + DEFAULT_URI_HTTP_ONLY_AUDIO, + DEFAULT_URI_HTTP_ONLY_VIDEO, + DEFAULT_URI_HTTP_VIDEO_AUDIO, + DEFAULT_URI_RTSP, + DEFAULT_URI_SRT, + RoomApiService, +} from 'src/app/services/room-api.service'; @Component({ selector: 'app-room-api-dialog', @@ -70,6 +76,7 @@ export class RoomApiDialogComponent { INGRESS_URL_TYPES: string[] = ['HTTP', 'SRT', 'RTSP']; ingressUrlType: string = 'HTTP'; + ingressUrlUri: string; response: string; @@ -307,6 +314,7 @@ export class RoomApiDialogComponent { this.ingressRoomName, this.inputTypeSelected, this.ingressUrlType, + this.ingressUrlUri, this.ingressWithAudio, this.ingressWithVideo, this.ingressVideoCodecSelected, diff --git a/openvidu-testapp/src/app/services/room-api.service.ts b/openvidu-testapp/src/app/services/room-api.service.ts index aecf964c..7d38e10e 100644 --- a/openvidu-testapp/src/app/services/room-api.service.ts +++ b/openvidu-testapp/src/app/services/room-api.service.ts @@ -31,6 +31,15 @@ import { VideoLayer, } from '@livekit/protocol'; +export const DEFAULT_URI_HTTP_VIDEO_AUDIO = + 'https://s3.eu-west-1.amazonaws.com/public.openvidu.io/bbb_sunflower_1080p_60fps_normal.mp4'; +export const DEFAULT_URI_HTTP_ONLY_VIDEO = + 'https://s3.eu-west-1.amazonaws.com/public.openvidu.io/bbb_sunflower_1080p_60fps_normal_noaudio.mp4'; +export const DEFAULT_URI_HTTP_ONLY_AUDIO = + 'https://s3.eu-west-1.amazonaws.com/public.openvidu.io/bbb_sunflower_1080p_60fps_normal_onlyaudio.mp3'; +export const DEFAULT_URI_RTSP = 'rtsp://127.0.0.1:8554/live'; +export const DEFAULT_URI_SRT = 'srt://127.0.0.1:8554/'; + @Injectable({ providedIn: 'root', }) @@ -209,6 +218,7 @@ export class RoomApiService { room_name: string, inputType: IngressInput, urlInputType: string, + urlUri: string, withAudio: boolean, withVideo: boolean, codec: VideoCodec, @@ -217,23 +227,35 @@ export class RoomApiService { preset?: IngressVideoEncodingPreset ): Promise { let url; - switch (urlInputType) { - case 'HTTP': - if (!withVideo) { - url = - 'https://s3.eu-west-1.amazonaws.com/public.openvidu.io/bbb_sunflower_1080p_60fps_normal_onlyaudio.mp3'; - } else { - url = withAudio - ? 'https://s3.eu-west-1.amazonaws.com/public.openvidu.io/bbb_sunflower_1080p_60fps_normal.mp4' - : 'https://s3.eu-west-1.amazonaws.com/public.openvidu.io/bbb_sunflower_1080p_60fps_normal_noaudio.mp4'; + if (inputType === IngressInput.URL_INPUT) { + if (urlUri) { + url = urlUri; + } else { + switch (urlInputType) { + case 'HTTP': + if (withVideo && withAudio) { + url = DEFAULT_URI_HTTP_VIDEO_AUDIO; + } else { + if (withVideo) { + url = DEFAULT_URI_HTTP_ONLY_VIDEO; + } else { + url = DEFAULT_URI_HTTP_ONLY_AUDIO; + } + } + break; + case 'SRT': + url = DEFAULT_URI_SRT; + break; + case 'RTSP': + url = DEFAULT_URI_RTSP; + break; + default: + const errorMsg = 'Invalid URL type'; + console.error(errorMsg); + window.alert(errorMsg); + throw new Error(errorMsg); } - break; - case 'SRT': - url = 'srt://host.docker.internal:8554/'; - break; - case 'RTSP': - url = 'rtsp://host.docker.internal:8554/'; - break; + } } let options: CreateIngressOptions = { name: inputType + '-' + room_name,