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 { .inner-text-input {
margin-left: 6px; margin-left: 6px;
width: 22%; width: 22%;
min-width: 200px;
} }
#clear-response-text-area-btn { #clear-response-text-area-btn {

View File

@ -228,6 +228,12 @@
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
</span> </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> </div>
<mat-divider></mat-divider> <mat-divider></mat-divider>

View File

@ -7,7 +7,6 @@ import { VideoCodec } from '@livekit/protocol';
import { LocalParticipant } from 'livekit-client'; import { LocalParticipant } from 'livekit-client';
import { import {
DirectFileOutput,
EgressClient, EgressClient,
EncodedFileOutput, EncodedFileOutput,
EncodedFileType, EncodedFileType,
@ -23,7 +22,14 @@ import {
StreamOutput, StreamOutput,
StreamProtocol, StreamProtocol,
} from 'livekit-server-sdk'; } 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({ @Component({
selector: 'app-room-api-dialog', selector: 'app-room-api-dialog',
@ -70,6 +76,7 @@ export class RoomApiDialogComponent {
INGRESS_URL_TYPES: string[] = ['HTTP', 'SRT', 'RTSP']; INGRESS_URL_TYPES: string[] = ['HTTP', 'SRT', 'RTSP'];
ingressUrlType: string = 'HTTP'; ingressUrlType: string = 'HTTP';
ingressUrlUri: string;
response: string; response: string;
@ -307,6 +314,7 @@ export class RoomApiDialogComponent {
this.ingressRoomName, this.ingressRoomName,
this.inputTypeSelected, this.inputTypeSelected,
this.ingressUrlType, this.ingressUrlType,
this.ingressUrlUri,
this.ingressWithAudio, this.ingressWithAudio,
this.ingressWithVideo, this.ingressWithVideo,
this.ingressVideoCodecSelected, this.ingressVideoCodecSelected,

View File

@ -31,6 +31,15 @@ import {
VideoLayer, VideoLayer,
} from '@livekit/protocol'; } 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({ @Injectable({
providedIn: 'root', providedIn: 'root',
}) })
@ -209,6 +218,7 @@ export class RoomApiService {
room_name: string, room_name: string,
inputType: IngressInput, inputType: IngressInput,
urlInputType: string, urlInputType: string,
urlUri: string,
withAudio: boolean, withAudio: boolean,
withVideo: boolean, withVideo: boolean,
codec: VideoCodec, codec: VideoCodec,
@ -217,23 +227,35 @@ export class RoomApiService {
preset?: IngressVideoEncodingPreset preset?: IngressVideoEncodingPreset
): Promise<IngressInfo> { ): Promise<IngressInfo> {
let url; let url;
switch (urlInputType) { if (inputType === IngressInput.URL_INPUT) {
case 'HTTP': if (urlUri) {
if (!withVideo) { url = urlUri;
url = } else {
'https://s3.eu-west-1.amazonaws.com/public.openvidu.io/bbb_sunflower_1080p_60fps_normal_onlyaudio.mp3'; switch (urlInputType) {
} else { case 'HTTP':
url = withAudio if (withVideo && withAudio) {
? 'https://s3.eu-west-1.amazonaws.com/public.openvidu.io/bbb_sunflower_1080p_60fps_normal.mp4' url = DEFAULT_URI_HTTP_VIDEO_AUDIO;
: 'https://s3.eu-west-1.amazonaws.com/public.openvidu.io/bbb_sunflower_1080p_60fps_normal_noaudio.mp4'; } 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 = { let options: CreateIngressOptions = {
name: inputType + '-' + room_name, name: inputType + '-' + room_name,