openvidu-testapp: allow configuring URI for Ingress URL types

master
pabloFuente 2025-02-06 18:59:29 +01:00
parent de5f67dd3c
commit 5c97301c6d
4 changed files with 55 additions and 18 deletions

View File

@ -39,6 +39,7 @@ mat-dialog-content button {
.inner-text-input {
margin-left: 6px;
width: 22%;
min-width: 200px;
}
#clear-response-text-area-btn {

View File

@ -228,6 +228,12 @@
</mat-select>
</mat-form-field>
</span>
<span style="display: inline-block" matTooltip="Only for URL input type" [matTooltipDisabled]="inputTypeSelected === 2">
<mat-form-field class="inner-text-input" [style.fontSize.px]=14>
<mat-label>URI</mat-label>
<input matInput id="ingress-url-uri-field" placeholder="URI" [(ngModel)]="ingressUrlUri" [disabled]="inputTypeSelected !== 2">
</mat-form-field>
</span>
</div>
<mat-divider></mat-divider>

View File

@ -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,

View File

@ -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<IngressInfo> {
let url;
if (inputType === IngressInput.URL_INPUT) {
if (urlUri) {
url = urlUri;
} else {
switch (urlInputType) {
case 'HTTP':
if (!withVideo) {
url =
'https://s3.eu-west-1.amazonaws.com/public.openvidu.io/bbb_sunflower_1080p_60fps_normal_onlyaudio.mp3';
if (withVideo && withAudio) {
url = DEFAULT_URI_HTTP_VIDEO_AUDIO;
} 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 (withVideo) {
url = DEFAULT_URI_HTTP_ONLY_VIDEO;
} else {
url = DEFAULT_URI_HTTP_ONLY_AUDIO;
}
}
break;
case 'SRT':
url = 'srt://host.docker.internal:8554/';
url = DEFAULT_URI_SRT;
break;
case 'RTSP':
url = 'rtsp://host.docker.internal:8554/';
url = DEFAULT_URI_RTSP;
break;
default:
const errorMsg = 'Invalid URL type';
console.error(errorMsg);
window.alert(errorMsg);
throw new Error(errorMsg);
}
}
}
let options: CreateIngressOptions = {
name: inputType + '-' + room_name,